[pango/fix-break-latin] Fix break-latin.c
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-break-latin] Fix break-latin.c
- Date: Tue, 7 Dec 2021 20:04:31 +0000 (UTC)
commit 1638c6c69a19ab970c7d703e0a81ff3c6ec8248f
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 7 15:03:44 2021 -0500
Fix break-latin.c
Fix out the issues pointed out in #636.
pango/break-latin.c | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
---
diff --git a/pango/break-latin.c b/pango/break-latin.c
index 608bff94..4e9f44a9 100644
--- a/pango/break-latin.c
+++ b/pango/break-latin.c
@@ -25,37 +25,38 @@
static void
break_latin (const char *text,
- int len,
- const PangoAnalysis *analysis G_GNUC_UNUSED,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+ int len,
+ const PangoAnalysis *analysis,
+ PangoLogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
-
- if (analysis && analysis->language &&
- g_ascii_strncasecmp (pango_language_to_string (analysis->language), "ca-", 3) != 0)
- return;
-
- const gchar *next;
- gunichar wc;
- gunichar prev_wc = 0;
-
- next = text;
- for (int i = 0; i < len; i++)
+ const gchar *next;
+ gunichar wc;
+ gunichar prev_wc = 0;
+ int i;
+
+ if (analysis && analysis->language &&
+ g_ascii_strncasecmp (pango_language_to_string (analysis->language), "ca-", 3) != 0)
+ return;
+
+ next = text;
+ i = 0;
+ while (next - text < len)
{
- wc = g_utf8_get_char (next);
- next = g_utf8_next_char (next);
+ wc = g_utf8_get_char (next);
+ next = g_utf8_next_char (next);
- /* Catalan middle dot does not break words */
- if (wc == 0x00b7)
+ /* Catalan middle dot does not break words */
+ if (wc == 0x00b7)
{
- gunichar middle_next = g_utf8_get_char (next);
- if (g_unichar_tolower (middle_next) == 'l' && g_unichar_tolower (prev_wc) == 'l')
+ gunichar middle_next = g_utf8_get_char (next);
+ if (g_unichar_tolower (middle_next) == 'l' && g_unichar_tolower (prev_wc) == 'l')
{
attrs[i].is_word_end = FALSE;
attrs[i+1].is_word_start = FALSE;
}
}
- prev_wc = wc;
+ prev_wc = wc;
+ i++;
}
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]