[pango/soft-hyphen-cleanup: 2/4] Don't rely on log attrs for soft	hyphen
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [pango/soft-hyphen-cleanup: 2/4] Don't rely on log attrs for soft	hyphen
- Date: Tue,  9 Jul 2019 13:48:12 +0000 (UTC)
commit 221199b62189c2fd9fdd70fc6d981ddbc4b74bca
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jul 9 09:42:40 2019 -0400
    Don't rely on log attrs for soft hyphen
    
    Instead, look at the pre- and post-break
    text to figure out what is needed.
 pango/pango-layout.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index d61b93a5..b6e6ac89 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3443,7 +3443,18 @@ break_needs_hyphen (PangoLayout    *layout,
                     ParaBreakState *state,
                     int             num_chars)
 {
-  return layout->log_attrs[state->start_offset + num_chars].is_soft_hyphen;
+  gunichar *ch;
+
+  if (state->start_offset + num_chars == 0)
+    return FALSE;
+
+  ch = g_utf8_get_char (layout->text + state->start_offset + num_chars - 1);
+
+  /* Just look for soft hyphen, for now */
+  if (ch == 0xAD)
+    return TRUE;
+
+  return FALSE;
 }
 
 static int
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]