[pango: 1/2] Disable hyphen for some languages



commit a2af11ca9d5af9ce9549303f0df3948a842af6fe
Author: Peng Wu <alexepico gmail com>
Date:   Wed Aug 28 16:38:23 2019 +0800

    Disable hyphen for some languages
    
    Some languages like CJK languages,
    usually don't use the hyphen character.

 pango/pango-layout.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]