summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2019-08-28 16:38:23 +0800
committerPeng Wu <alexepico@gmail.com>2019-08-28 17:48:21 +0800
commita2af11ca9d5af9ce9549303f0df3948a842af6fe (patch)
treec2028d905c748ed1f5edbe8db1d27f19079652ee
parent2720ccade26cad2fcadc20a5168883fd7d827e31 (diff)
downloadpango-a2af11ca9d5af9ce9549303f0df3948a842af6fe.tar.gz
Disable hyphen for some languages
Some languages like CJK languages, usually don't use the hyphen character.
-rw-r--r--pango/pango-layout.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 110311a8..7404dd77 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3466,6 +3466,19 @@ get_need_hyphen (PangoItem *item,
attr = pango_attr_iterator_get (iter, PANGO_ATTR_INSERT_HYPHENS);
if (attr)
insert_hyphens = ((PangoAttrInt*)attr)->value;
+
+ /* Some scripts don't use hyphen.*/
+ switch (item->analysis.script)
+ {
+ case PANGO_SCRIPT_HAN:
+ case PANGO_SCRIPT_HANGUL:
+ case PANGO_SCRIPT_HIRAGANA:
+ case PANGO_SCRIPT_KATAKANA:
+ insert_hyphens = FALSE;
+ break;
+ default:
+ break;
+ }
}
switch (g_unichar_type (wc))