Dominique Leuenberger
2743b43758
- Applied upstream patch that fixes build errors in perl-Gtk2 introduced after the recent pango update to version 1.40.11 + Commit 33c10cb0c40503630146e4d32de807728d99ab0c - Added patch pango-fix-default-break-function.patch OBS-URL: https://build.opensuse.org/request/show/519926 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/pango?expand=0&rev=173
74 lines
2.3 KiB
Diff
74 lines
2.3 KiB
Diff
From 6ff8f019170241188b4b76531c60f420bf81ffe2 Mon Sep 17 00:00:00 2001
|
|
From: Peng Wu <alexepico@gmail.com>
|
|
Date: Wed, 16 Aug 2017 15:02:36 +0800
|
|
Subject: [PATCH] Fix pango_default_break function for sentence start/end
|
|
|
|
Skip the space characters in sentence start/end.
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=785978
|
|
---
|
|
pango/break.c | 39 +++++++++++++++++++++++++++++----------
|
|
1 file changed, 29 insertions(+), 10 deletions(-)
|
|
|
|
Index: pango-1.40.11/pango/break.c
|
|
===================================================================
|
|
--- pango-1.40.11.orig/pango/break.c
|
|
+++ pango-1.40.11/pango/break.c
|
|
@@ -559,6 +559,7 @@ pango_default_break (const gchar *text
|
|
gunichar base_character = 0;
|
|
|
|
gint last_sentence_start = -1;
|
|
+ gint last_non_space = -1;
|
|
|
|
gboolean almost_done = FALSE;
|
|
gboolean done = FALSE;
|
|
@@ -1660,19 +1661,37 @@ pango_default_break (const gchar *text
|
|
}
|
|
|
|
/* ---- Sentence breaks ---- */
|
|
+ {
|
|
|
|
- /* default to not a sentence start/end */
|
|
- attrs[i].is_sentence_start = FALSE;
|
|
- attrs[i].is_sentence_end = FALSE;
|
|
-
|
|
- if (last_sentence_start == -1 && !is_sentence_boundary) {
|
|
- last_sentence_start = i - 1;
|
|
- attrs[i - 1].is_sentence_start = TRUE;
|
|
- }
|
|
+ /* default to not a sentence start/end */
|
|
+ attrs[i].is_sentence_start = FALSE;
|
|
+ attrs[i].is_sentence_end = FALSE;
|
|
+
|
|
+ /* maybe start sentence */
|
|
+ if (last_sentence_start == -1 && !is_sentence_boundary)
|
|
+ last_sentence_start = i - 1;
|
|
+
|
|
+ /* remember last non space character position */
|
|
+ if (i > 0 && !attrs[i - 1].is_white)
|
|
+ last_non_space = i;
|
|
+
|
|
+ /* meets sentence end, mark both sentence start and end */
|
|
+ if (last_sentence_start != -1 && is_sentence_boundary) {
|
|
+ if (last_non_space != -1) {
|
|
+ attrs[last_sentence_start].is_sentence_start = TRUE;
|
|
+ attrs[last_non_space].is_sentence_end = TRUE;
|
|
+ }
|
|
+
|
|
+ last_sentence_start = -1;
|
|
+ last_non_space = -1;
|
|
+ }
|
|
+
|
|
+ /* meets space character, move sentence start */
|
|
+ if (last_sentence_start != -1 &&
|
|
+ last_sentence_start == i - 1 &&
|
|
+ attrs[i - 1].is_white)
|
|
+ last_sentence_start++;
|
|
|
|
- if (last_sentence_start != -1 && is_sentence_boundary) {
|
|
- last_sentence_start = -1;
|
|
- attrs[i].is_sentence_end = TRUE;
|
|
}
|
|
|
|
prev_wc = wc;
|