File: Update-Word-Boundary-to-Unicode-11.patch

package info (click to toggle)
pango1.0 1.42.4-8~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,564 kB
  • sloc: ansic: 42,694; sh: 4,360; makefile: 1,075; python: 305; perl: 56; cpp: 20
file content (49 lines) | stat: -rw-r--r-- 1,630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Peng Wu <alexepico@gmail.com>
Date: Thu, 16 Aug 2018 14:18:20 +0800
Subject: Update Word Boundary to Unicode 11

(cherry picked from commit f1d3992379134812d81930c526ff1021d36ea7a5)
---
 pango/break.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/pango/break.c b/pango/break.c
index c50c18e..136d500 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -218,6 +218,7 @@ pango_default_break (const gchar   *text,
     WB_ExtendNumLet,
     WB_RI_Odd,
     WB_RI_Even,
+    WB_WSegSpace,
   } WordBreakType;
   WordBreakType prev_prev_WB_type = WB_Other, prev_WB_type = WB_Other;
   gint prev_WB_i = -1;
@@ -660,7 +661,14 @@ pango_default_break (const gchar   *text,
 		  break;
 		}
 
-	    /* Grapheme Cluster Boundary Rules */
+	    if (WB_type == WB_Other)
+	      {
+		if (type == G_UNICODE_SPACE_SEPARATOR &&
+		    break_type != G_UNICODE_BREAK_NON_BREAKING_GLUE)
+		  WB_type = WB_WSegSpace;
+	      }
+
+	    /* Word Cluster Boundary Rules */
 
 	    /* We apply Rules WB1 and WB2 at the end of the function */
 
@@ -676,6 +684,11 @@ pango_default_break (const gchar   *text,
 	      }
 	    else if (WB_type == WB_NewlineCRLF)
 	      is_word_boundary = TRUE; /* Rule WB3b */
+	    else if (prev_wc == 0x200D && is_Extended_Pictographic)
+	      is_word_boundary = FALSE; /* Rule WB3c */
+	    else if (prev_WB_type == WB_WSegSpace &&
+		     WB_type == WB_WSegSpace && prev_WB_i + 1 == i)
+	      is_word_boundary = FALSE; /* Rule WB3d */
 	    else if (WB_type == WB_ExtendFormat)
 	      is_word_boundary = FALSE; /* Rules WB4? */
 	    else if ((prev_WB_type == WB_ALetter  ||