summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-15 23:45:25 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-16 09:36:47 -0500
commit9562a09675ab7e63c4f70c5c6c97356b78dc907c (patch)
tree32687d6095392698137dade54a08b86c193ea40e
parent23eb92fd4c454d790e4531810ca49b58f3816030 (diff)
downloadpango-9562a09675ab7e63c4f70c5c6c97356b78dc907c.tar.gz
Fix Arabic format chars
We can't treat these like spaces, since they are visible and need the proper font. Fixes: #642
-rw-r--r--pango/itemize.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/pango/itemize.c b/pango/itemize.c
index 1d71b5c6..6c07e4c2 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -507,8 +507,7 @@ itemize_state_init (ItemizeState *state,
if (!PANGO_GRAVITY_IS_VERTICAL (state->context->resolved_gravity))
state->width_iter.end = state->end;
- else
- if (state->emoji_iter.is_emoji)
+ else if (state->emoji_iter.is_emoji)
state->width_iter.end = MAX (state->width_iter.end, state->emoji_iter.end);
update_end (state);
@@ -903,27 +902,32 @@ itemize_state_update_for_new_run (ItemizeState *state)
}
/* We don't want space characters to affect font selection; in general,
-* it's always wrong to select a font just to render a space.
-* We assume that all fonts have the ASCII space, and for other space
-* characters if they don't, HarfBuzz will compatibility-decompose them
-* to ASCII space...
-* See bugs #355987 and #701652.
-*
-* We don't want to change fonts just for variation selectors.
-* See bug #781123.
-*
-* Finally, don't change fonts for line or paragraph separators.
-*
-* Note that we want spaces to use the 'better' font, comparing
-* the font that is used before and after the space. This is handled
-* in itemize_state_add_character().
-*/
+ * it's always wrong to select a font just to render a space.
+ *
+ * We assume that all fonts have the ASCII space, and for other space
+ * characters if they don't, HarfBuzz will compatibility-decompose them
+ * to ASCII space...
+ * See bugs #355987 and #701652.
+ *
+ * We don't want to change fonts just for variation selectors.
+ * See bug #781123.
+ *
+ * We don't want to change fonts for default ignorables such as Cf chars.
+ * Note that Cf chars in the Arabic block are visible and need to have
+ * a font, so we exclude.
+ *
+ * Finally, don't change fonts for line or paragraph separators.
+ *
+ * Note that we want spaces to use the 'better' font, comparing
+ * the font that is used before and after the space. This is handled
+ * in itemize_state_add_character().
+ */
static gboolean
consider_as_space (gunichar wc)
{
GUnicodeType type = g_unichar_type (wc);
return type == G_UNICODE_CONTROL ||
- type == G_UNICODE_FORMAT ||
+ (type == G_UNICODE_FORMAT && !((wc >= 0x600 && wc <= 0x06ff) || wc == 0x70f || wc == 0x8e2)) ||
type == G_UNICODE_SURROGATE ||
type == G_UNICODE_LINE_SEPARATOR ||
type == G_UNICODE_PARAGRAPH_SEPARATOR ||