summaryrefslogtreecommitdiff
path: root/pango/break-latin.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-07 15:03:44 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-08 07:04:44 -0500
commit73a3c19e3db38c23260e282f7fb219c854baf086 (patch)
treedd1071f8b313d4e7aaec48e7bb8cc657109c0ed1 /pango/break-latin.c
parent8b46f5db285c6c661a2a7c28c5b354426a8d5c61 (diff)
downloadpango-73a3c19e3db38c23260e282f7fb219c854baf086.tar.gz
Fix break-latin.c
The loop termination condition in break_latin() was incorrect. Fix this by copying the loop setup from break_arabic(). Fixes #636
Diffstat (limited to 'pango/break-latin.c')
-rw-r--r--pango/break-latin.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/pango/break-latin.c b/pango/break-latin.c
index 608bff94..69ad5110 100644
--- a/pango/break-latin.c
+++ b/pango/break-latin.c
@@ -25,37 +25,35 @@
static void
break_latin (const char *text,
- int len,
- const PangoAnalysis *analysis G_GNUC_UNUSED,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+ int length,
+ const PangoAnalysis *analysis,
+ PangoLogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
+ int i;
+ const char *p, *next;
+ gunichar wc, prev_wc;
- if (analysis && analysis->language &&
- g_ascii_strncasecmp (pango_language_to_string (analysis->language), "ca-", 3) != 0)
- return;
+ 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++)
+ for (p = text, i = 0, prev_wc = 0;
+ p < text + length;
+ p = next, i++, prev_wc = wc)
{
- wc = g_utf8_get_char (next);
- next = g_utf8_next_char (next);
+ wc = g_utf8_get_char (p);
+ next = g_utf8_next_char (p);
- /* 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;
}
}
-