diff options
-rw-r--r-- | pango/itemize.c | 40 | ||||
-rw-r--r-- | tests/fonts/README | 2 | ||||
-rw-r--r-- | tests/fonts/amiri-06dd.ttf | bin | 0 -> 1872 bytes | |||
-rw-r--r-- | tests/layouts/arabic-format.layout | 89 | ||||
-rw-r--r-- | tests/meson.build | 1 |
5 files changed, 114 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 || diff --git a/tests/fonts/README b/tests/fonts/README index fb33f8f2..9cc88ca7 100644 --- a/tests/fonts/README +++ b/tests/fonts/README @@ -3,5 +3,7 @@ test-layout tests. Cantarell-VF.otf: Cantarell DejaVSans.ttf: DejaVu Sans +DejaVSansMono.ttf: DejaVu Sans Mono emoji-subset.ttf: subset of Noto Color Emoji droid-sans-subset.ttf: subset of Droid Sans Japanese +amiri-06dd.ttf: subset of Amiri containing U+06dd diff --git a/tests/fonts/amiri-06dd.ttf b/tests/fonts/amiri-06dd.ttf Binary files differnew file mode 100644 index 00000000..e60637d1 --- /dev/null +++ b/tests/fonts/amiri-06dd.ttf diff --git a/tests/layouts/arabic-format.layout b/tests/layouts/arabic-format.layout new file mode 100644 index 00000000..630a0f03 --- /dev/null +++ b/tests/layouts/arabic-format.layout @@ -0,0 +1,89 @@ +{ + "context" : { + "font" : "serif 12", + "base-gravity" : "south", + "gravity-hint" : "natural", + "base-dir" : "weak-ltr", + "round-glyph-positions" : true, + "transform" : [ + 1, + 0, + 0, + 1, + 0, + 0 + ] + }, + "comment" : "Test that font fallback works\nfor visible format characters\nin the Arabic block.", + "text" : "", + "font" : "Sans 32", + "output" : { + "is-wrapped" : false, + "is-ellipsized" : false, + "unknown-glyphs" : 0, + "width" : 56320, + "height" : 56320, + "log-attrs" : [ + { + "char-break" : true, + "cursor-position" : true, + "sentence-boundary" : true, + "backspace-deletes-character" : true, + "word-boundary" : true + }, + { + "line-break" : true, + "mandatory-break" : true, + "char-break" : true, + "white" : true, + "cursor-position" : true, + "sentence-boundary" : true, + "backspace-deletes-character" : true, + "word-boundary" : true + } + ], + "lines" : [ + { + "start-index" : 0, + "length" : 2, + "paragraph-start" : true, + "direction" : "ltr", + "runs" : [ + { + "offset" : 0, + "length" : 2, + "text" : "", + "bidi-level" : 2, + "gravity" : "south", + "language" : "en-us", + "script" : "common", + "font" : { + "description" : "Amiri 32", + "checksum" : "d5e6374130d6df09e66f80f0bbcb7262112584ebadb861f0a412a21cc742a5dd", + "matrix" : [ + 1, + -0, + -0, + 1, + 0, + 0 + ] + }, + "flags" : 0, + "y-offset" : 0, + "start-x-offset" : 0, + "end-x-offset" : 0, + "glyphs" : [ + { + "glyph" : 1, + "width" : 56320, + "is-cluster-start" : true, + "log-cluster" : 0 + } + ] + } + ] + } + ] + } +} diff --git a/tests/meson.build b/tests/meson.build index 54592668..79510fb6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -121,6 +121,7 @@ installed_test_layouts_data = [ 'layouts/valid-22.layout', 'layouts/tab-crash.layout', 'layouts/tab-assert.layout', + 'layouts/arabic-format.layout', ] test_markups_data = [ |