[pango/line-breaking-fixes4: 3/4] break: Fix hyphen condition
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaking-fixes4: 3/4] break: Fix hyphen condition
- Date: Tue, 23 Nov 2021 04:14:55 +0000 (UTC)
commit a3185889535b89fa38c085099dc8b60bce139add
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Nov 21 16:17:37 2021 -0500
break: Fix hyphen condition
When looking at scripts, we want to look
at the script of the *previous* character.
And then we need to exclude SHY from the
common script.
pango/break.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index 3af083ce..5622ca21 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -170,6 +170,8 @@ default_break (const char *text,
GUnicodeBreakType prev_break_type;
GUnicodeBreakType prev_prev_break_type;
+ PangoScript prev_script;
+
/* See Grapheme_Cluster_Break Property Values table of UAX#29 */
typedef enum
{
@@ -262,6 +264,7 @@ default_break (const char *text,
prev_break_type = G_UNICODE_BREAK_UNKNOWN;
prev_prev_break_type = G_UNICODE_BREAK_UNKNOWN;
prev_wc = 0;
+ prev_script = PANGO_SCRIPT_COMMON;
prev_jamo = NO_JAMO;
prev_space_or_hyphen = FALSE;
@@ -539,7 +542,6 @@ default_break (const char *text,
}
script = (PangoScript)g_unichar_get_script (wc);
-
/* ---- UAX#29 Word Boundaries ---- */
{
is_word_boundary = FALSE;
@@ -1571,9 +1573,11 @@ default_break (const char *text,
attrs[i].break_inserts_hyphen = FALSE;
attrs[i].break_removes_preceding = FALSE;
- switch ((int)script)
+ switch ((int)prev_script)
{
case PANGO_SCRIPT_COMMON:
+ insert_hyphens = prev_wc == 0x00ad;
+ break;
case PANGO_SCRIPT_HAN:
case PANGO_SCRIPT_HANGUL:
case PANGO_SCRIPT_HIRAGANA:
@@ -1634,6 +1638,7 @@ default_break (const char *text,
}
prev_wc = wc;
+ prev_script = script;
/* wc might not be a valid Unicode base character, but really all we
* need to know is the last non-combining character */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]