Skip to content

Commit a28c993

Browse files
author
Joris Schellekens
committed
Revert "Revert "added non-breaking-space and non-breaking hyphen in TextRenderer#isGlyphPartOfWordForHyphenation""
This reverts commit 5f5b110c18fddfed9da676fef0e4b9cff01ba0d7. Autoported commit. Original commit hash: [3dce250af]
1 parent b63d9bb commit a28c993

File tree

3 files changed

+73
-36
lines changed

3 files changed

+73
-36
lines changed

itext.tests/itext.layout.tests/itext/layout/HyphenateTest.cs

Lines changed: 71 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,77 @@ source product.
4949

5050
namespace iText.Layout {
5151
public class HyphenateTest : ExtendedITextTest {
52-
private IList<HyphenateTest.TestParams> @params = iText.IO.Util.JavaUtil.ArraysAsList(new HyphenateTest.TestParams
53-
("af"), new HyphenateTest.TestParams("as", "\u09A8\u09AE\u09B8\u09CD\u0995\u09BE\u09F0"), new HyphenateTest.TestParams
54-
("bg", "\u0417\u0434\u0440\u0430\u0432\u0435\u0439"), new HyphenateTest.TestParams("bn", "\u0986\u09B2\u09BE\u0987\u0995\u09C1\u09AE"
55-
), new HyphenateTest.TestParams("ca", "Benvinguts"), new HyphenateTest.TestParams("cop", "\u2C98\u2C89\u2CA7\u2CA2\u2C89\u2C99\u0300\u2C9B\u2CAD\u2C8F\u2C99\u2C93"
56-
), new HyphenateTest.TestParams("cs"), new HyphenateTest.TestParams("cy"), new HyphenateTest.TestParams
57-
("da"), new HyphenateTest.TestParams("de"), new HyphenateTest.TestParams("de_1901"), new HyphenateTest.TestParams
58-
("de_CH"), new HyphenateTest.TestParams("de_DR"), new HyphenateTest.TestParams("el", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"
59-
), new HyphenateTest.TestParams("el_Polyton", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"), new
60-
HyphenateTest.TestParams("en"), new HyphenateTest.TestParams("en_GB"), new HyphenateTest.TestParams("en_US"
61-
), new HyphenateTest.TestParams("eo"), new HyphenateTest.TestParams("es", "gracias"), new HyphenateTest.TestParams
62-
("et", "Vabandust"), new HyphenateTest.TestParams("eu", "euskara"), new HyphenateTest.TestParams("fi",
63-
"N\u00E4kemiin"), new HyphenateTest.TestParams("fr"), new HyphenateTest.TestParams("ga"), new HyphenateTest.TestParams
64-
("gl"), new HyphenateTest.TestParams("grc", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"), new HyphenateTest.TestParams
65-
("gu", "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0"), new HyphenateTest.TestParams("hi", "\u0938\u0941\u092A\u094D\u0930\u092D\u093E\u0924\u092E\u094D"
66-
), new HyphenateTest.TestParams("hr"), new HyphenateTest.TestParams("hsb"), new HyphenateTest.TestParams
67-
("hu", "sziasztok"), new HyphenateTest.TestParams("hy", "\u0577\u0576\u0578\u0580\u0570\u0561\u056F\u0561\u056C\u0578\u0582\u0569\u0575\u0578\u0582\u0576"
68-
), new HyphenateTest.TestParams("ia"), new HyphenateTest.TestParams("id"), new HyphenateTest.TestParams
69-
("is"), new HyphenateTest.TestParams("it"), new HyphenateTest.TestParams("kmr"), new HyphenateTest.TestParams
70-
("kn", "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"), new HyphenateTest.TestParams("la"), new HyphenateTest.TestParams
71-
("lo", "\u0E8D\u0EB4\u0E99\u0E94\u0EB5\u0E95\u0EC9\u0EAD\u0E99\u0EAE\u0EB1\u0E9A"), new HyphenateTest.TestParams
72-
("lt", "Labanakt"), new HyphenateTest.TestParams("lv", "Labvakar"), new HyphenateTest.TestParams("ml",
73-
"\u0D38\u0D4D\u0D35\u0D3E\u0D17\u0D24\u0D02"), new HyphenateTest.TestParams("mn", "\u04E8\u0440\u0448\u04E9\u04E9\u0433\u04E9\u04E9\u0440\u044D\u0439"
74-
), new HyphenateTest.TestParams("mr", "\u0928\u092E\u0938\u094D\u0915\u093E\u0930"), new HyphenateTest.TestParams
75-
("nb"), new HyphenateTest.TestParams("nl"), new HyphenateTest.TestParams("nn"), new HyphenateTest.TestParams
76-
("no"), new HyphenateTest.TestParams("or", "\u0B28\u0B2E\u0B38\u0B4D\u0B15\u0B3E\u0B30"), new HyphenateTest.TestParams
77-
("pa", "\u0A28\u0A2E\u0A38\u0A15\u0A3E\u0A30"), new HyphenateTest.TestParams("pl"), new HyphenateTest.TestParams
78-
("pt"), new HyphenateTest.TestParams("ro"), new HyphenateTest.TestParams("ru", "\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439"
79-
), new HyphenateTest.TestParams("sa"), new HyphenateTest.TestParams("sk"), new HyphenateTest.TestParams
80-
("sl"), new HyphenateTest.TestParams("sr_Cyrl", "\u0414\u043E\u0431\u0440\u043E\u0434\u043E\u0448\u043B\u0438"
81-
), new HyphenateTest.TestParams("sr_Latn"), new HyphenateTest.TestParams("sv", "V\u00E4lkommen"), new
82-
HyphenateTest.TestParams("ta", "\u0BB5\u0BBE\u0BB0\u0BC1\u0B99\u0BCD\u0B95\u0BB3\u0BCD"), new HyphenateTest.TestParams
83-
("te", "\u0C38\u0C41\u0C38\u0C4D\u0C35\u0C3E\u0C17\u0C24\u0C02"), new HyphenateTest.TestParams("tk"),
84-
new HyphenateTest.TestParams("tr", "Merhaba"), new HyphenateTest.TestParams("uk", "\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439"
85-
), new HyphenateTest.TestParams("zh_Latn"));
52+
private IList<HyphenateTest.TestParams> @params = iText.IO.Util.JavaUtil.ArraysAsList(
53+
new HyphenateTest.TestParams("af"),
54+
new HyphenateTest.TestParams("as", "\u09A8\u09AE\u09B8\u09CD\u0995\u09BE\u09F0"),
55+
new HyphenateTest.TestParams("bg", "\u0417\u0434\u0440\u0430\u0432\u0435\u0439"),
56+
new HyphenateTest.TestParams("bn", "\u0986\u09B2\u09BE\u0987\u0995\u09C1\u09AE"),
57+
new HyphenateTest.TestParams("ca", "Benvinguts"),
58+
new HyphenateTest.TestParams("cop", "\u2C98\u2C89\u2CA7\u2CA2\u2C89\u2C99\u0300\u2C9B\u2CAD\u2C8F\u2C99\u2C93"),
59+
new HyphenateTest.TestParams("cs"),
60+
new HyphenateTest.TestParams("cy"),
61+
new HyphenateTest.TestParams("da"),
62+
new HyphenateTest.TestParams("de"),
63+
new HyphenateTest.TestParams("de_DE", "14\u00a0Tagen 14\u00a0Tagen 14\u00a0Tagen "),
64+
new HyphenateTest.TestParams("de_DE", "14\u20110Tagen 14\u2011Tagen 14\u20110Tagen "),
65+
new HyphenateTest.TestParams("de_1901"),
66+
new HyphenateTest.TestParams("de_CH"),
67+
new HyphenateTest.TestParams("de_DR"),
68+
new HyphenateTest.TestParams("el", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"),
69+
new HyphenateTest.TestParams("el_Polyton", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"),
70+
new HyphenateTest.TestParams("en"),
71+
new HyphenateTest.TestParams("en_GB"),
72+
new HyphenateTest.TestParams("en_US"),
73+
new HyphenateTest.TestParams("eo"),
74+
new HyphenateTest.TestParams("es", "gracias"),
75+
new HyphenateTest.TestParams("et", "Vabandust"),
76+
new HyphenateTest.TestParams("eu", "euskara"),
77+
new HyphenateTest.TestParams("fi", "N\u00E4kemiin"),
78+
new HyphenateTest.TestParams("fr"),
79+
new HyphenateTest.TestParams("ga"),
80+
new HyphenateTest.TestParams("gl"),
81+
new HyphenateTest.TestParams("grc", "\u03BA\u03B1\u03BB\u03B7\u03BC\u03AD\u03C1\u03B1"),
82+
new HyphenateTest.TestParams("gu", "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0"),
83+
new HyphenateTest.TestParams("hi", "\u0938\u0941\u092A\u094D\u0930\u092D\u093E\u0924\u092E\u094D"),
84+
new HyphenateTest.TestParams("hr"),
85+
new HyphenateTest.TestParams("hsb"),
86+
new HyphenateTest.TestParams("hu", "sziasztok"),
87+
new HyphenateTest.TestParams("hy", "\u0577\u0576\u0578\u0580\u0570\u0561\u056F\u0561\u056C\u0578\u0582\u0569\u0575\u0578\u0582\u0576"),
88+
new HyphenateTest.TestParams("ia"),
89+
new HyphenateTest.TestParams("id"),
90+
new HyphenateTest.TestParams("is"),
91+
new HyphenateTest.TestParams("it"),
92+
new HyphenateTest.TestParams("kmr"),
93+
new HyphenateTest.TestParams("kn", "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"),
94+
new HyphenateTest.TestParams("la"),
95+
new HyphenateTest.TestParams("lo", "\u0E8D\u0EB4\u0E99\u0E94\u0EB5\u0E95\u0EC9\u0EAD\u0E99\u0EAE\u0EB1\u0E9A"),
96+
new HyphenateTest.TestParams("lt", "Labanakt"),
97+
new HyphenateTest.TestParams("lv", "Labvakar"),
98+
new HyphenateTest.TestParams("ml", "\u0D38\u0D4D\u0D35\u0D3E\u0D17\u0D24\u0D02"),
99+
new HyphenateTest.TestParams("mn", "\u04E8\u0440\u0448\u04E9\u04E9\u0433\u04E9\u04E9\u0440\u044D\u0439"),
100+
new HyphenateTest.TestParams("mr", "\u0928\u092E\u0938\u094D\u0915\u093E\u0930"),
101+
new HyphenateTest.TestParams("nb"),
102+
new HyphenateTest.TestParams("nl"),
103+
new HyphenateTest.TestParams("nn"),
104+
new HyphenateTest.TestParams("no"),
105+
new HyphenateTest.TestParams("or", "\u0B28\u0B2E\u0B38\u0B4D\u0B15\u0B3E\u0B30"),
106+
new HyphenateTest.TestParams("pa", "\u0A28\u0A2E\u0A38\u0A15\u0A3E\u0A30"),
107+
new HyphenateTest.TestParams("pl"),
108+
new HyphenateTest.TestParams("pt"),
109+
new HyphenateTest.TestParams("ro"),
110+
new HyphenateTest.TestParams("ru", "\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439"),
111+
new HyphenateTest.TestParams("sa"),
112+
new HyphenateTest.TestParams("sk"),
113+
new HyphenateTest.TestParams("sl"),
114+
new HyphenateTest.TestParams("sr_Cyrl", "\u0414\u043E\u0431\u0440\u043E\u0434\u043E\u0448\u043B\u0438"),
115+
new HyphenateTest.TestParams("sr_Latn"),
116+
new HyphenateTest.TestParams("sv", "V\u00E4lkommen"),
117+
new HyphenateTest.TestParams("ta", "\u0BB5\u0BBE\u0BB0\u0BC1\u0B99\u0BCD\u0B95\u0BB3\u0BCD"),
118+
new HyphenateTest.TestParams("te", "\u0C38\u0C41\u0C38\u0C4D\u0C35\u0C3E\u0C17\u0C24\u0C02"),
119+
new HyphenateTest.TestParams("tk"),
120+
new HyphenateTest.TestParams("tr", "Merhaba"),
121+
new HyphenateTest.TestParams("uk", "\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439"),
122+
new HyphenateTest.TestParams("zh_Latn"));
86123

87124
private IList<String> errors = new List<String>();
88125

itext/itext.layout/itext/layout/renderer/TextRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ private int[] GetWordBoundsForHyphenation(GlyphLine text, int leftTextPos, int r
12571257

12581258
private bool IsGlyphPartOfWordForHyphenation(Glyph g) {
12591259
return char.IsLetter((char)g.GetUnicode()) || char.IsDigit((char)g.GetUnicode()) || '\u00ad' == g.GetUnicode
1260-
() || '\u00a0' == g.GetUnicode();
1260+
() || '\u00a0' == g.GetUnicode() || '\u2011' == g.GetUnicode();
12611261
}
12621262

12631263
private void UpdateFontAndText() {

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5f5b110c18fddfed9da676fef0e4b9cff01ba0d7
1+
3dce250af7123278a91ba573fa511470e19017f8

0 commit comments

Comments
 (0)