diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-25 00:09:37 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-25 00:40:17 -0400 |
commit | 2c9792d4b435e87e8616c22e1e5516d7302b06dc (patch) | |
tree | b695f35cb5977fea3f58950d2b1d9051d515c2d0 /pango/break.c | |
parent | dec273128a15821949011c66836db4f87c04a442 (diff) | |
download | pango-2c9792d4b435e87e8616c22e1e5516d7302b06dc.tar.gz |
Refine hyphenation
Replace ‧ and | with a - when we break there.
Update affected test output.
Fixes: #603
Diffstat (limited to 'pango/break.c')
-rw-r--r-- | pango/break.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pango/break.c b/pango/break.c index 8e1aeb56..043ac0cc 100644 --- a/pango/break.c +++ b/pango/break.c @@ -1559,10 +1559,14 @@ default_break (const char *text, } /* --- Hyphens --- */ + { gboolean insert_hyphens; gboolean space_or_hyphen = FALSE; + attrs[i].break_inserts_hyphen = FALSE; + attrs[i].break_removes_preceding = FALSE; + switch ((int)script) { case PANGO_SCRIPT_COMMON: @@ -1599,7 +1603,6 @@ default_break (const char *text, wc == 0x1400 || /* Canadian syllabics hyphen */ wc == 0x1806 || /* Mongolian todo hyphen */ wc == 0x2010 || /* Hyphen */ - wc == 0x2027 || /* Hyphenation point */ wc == 0x2e17 || /* Double oblique hyphen */ wc == 0x2e40 || /* Double hyphen */ wc == 0x30a0 || /* Katakana-Hiragana double hyphen */ @@ -1617,6 +1620,13 @@ default_break (const char *text, else attrs[i].break_inserts_hyphen = insert_hyphens; + if (prev_wc == 0x007C || /* Vertical Line */ + prev_wc == 0x2027) /* Hyphenation point */ + { + attrs[i].break_inserts_hyphen = TRUE; + attrs[i].break_removes_preceding = TRUE; + } + prev_space_or_hyphen = space_or_hyphen; } @@ -1774,7 +1784,8 @@ break_attrs (const char *text, for (pos = start_pos + 1; pos < end_pos; pos++) { - log_attrs[pos].break_inserts_hyphen = FALSE; + if (!log_attrs[pos].break_removes_preceding) + log_attrs[pos].break_inserts_hyphen = FALSE; } } } while (pango_attr_iterator_next (&iter)); |