diff options
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | pango.doap | 6 | ||||
-rw-r--r-- | pango/pango-script.c | 23 | ||||
-rw-r--r-- | pango/pangowin32-dwrite-fontmap.cpp | 16 | ||||
-rw-r--r-- | tests/itemize/three.expected | 9 | ||||
-rw-r--r-- | tests/itemize/three.items | 1 |
6 files changed, 50 insertions, 11 deletions
diff --git a/meson.build b/meson.build index fcd0bee8..930f4108 100644 --- a/meson.build +++ b/meson.build @@ -363,7 +363,11 @@ cairo_dwrite_dep = disabler() # Only for Windows if cairo_dep.found() cairo_found_type = cairo_dep.type_name() if host_system == 'windows' - cairo_dwrite_dep = dependency('cairo-win32-dwrite-font', version: cairo_req_version, required: false) + cairo_dwrite_dep = dependency('cairo-dwrite-font', version: cairo_req_version, required: false) + # cairo < 1.17.8 used a different name + if not cairo_dwrite_dep.found() + cairo_dwrite_dep = dependency('cairo-win32-dwrite-font', version: cairo_req_version, required: false) + endif endif else if cc.get_id() == 'msvc' and cc.has_header('cairo.h') @@ -12,8 +12,8 @@ <homepage rdf:resource="http://www.pango.org/" /> - <mailing-list - rdf:resource="http://mail.gnome.org/mailman/listinfo/gtk-i18n-list" /> + <developer-forum + rdf:resource="https://discourse.gnome.org/tag/pango" /> <download-page rdf:resource="http://download.gnome.org/sources/pango/"/> <bug-database @@ -30,7 +30,7 @@ <foaf:Person> <foaf:name>Behdad Esfahbod</foaf:name> <foaf:mbox rdf:resource="mailto:behdad@gnome.org" /> - <gnome:userid>behdad</gnome:userid> +<!-- <gnome:userid>behdad</gnome:userid> --> </foaf:Person> </maintainer> <maintainer> diff --git a/pango/pango-script.c b/pango/pango-script.c index 71c519fd..fa9ab21d 100644 --- a/pango/pango-script.c +++ b/pango/pango-script.c @@ -286,12 +286,29 @@ get_pair_index (gunichar ch) return -1; } +static gboolean +is_cluster_extender (gunichar ch) +{ + GUnicodeType type = g_unichar_type (ch); + return (type >= G_UNICODE_SPACING_MARK && type <= G_UNICODE_NON_SPACING_MARK) || + (ch >= 0x200C && ch <= 0x200D) || /* ZWJ, ZWNJ */ + (ch >= 0xFF9E && ch <= 0xFF9F) || /* katakana sound marks */ + (ch >= 0x1F3FB && ch <= 0x1F3FF) || /* fitzpatrick skin tone modifiers */ + (ch >= 0xE0020 && ch <= 0xE007F); /* emoji (flag) tag characters */ +} + /* duplicated in pango-language.c */ #define REAL_SCRIPT(script) \ ((script) > PANGO_SCRIPT_INHERITED && (script) != PANGO_SCRIPT_UNKNOWN) -#define SAME_SCRIPT(script1, script2) \ - (!REAL_SCRIPT (script1) || !REAL_SCRIPT (script2) || (script1) == (script2)) +#define IS_CLUSTER_EXTENDER(ch) \ + g_unichar_type (ch) + +/* TODO: Use Unicode ScriptExtensions */ +#define SAME_SCRIPT(script1, script2, ch) \ + (!REAL_SCRIPT (script1) || !REAL_SCRIPT (script2) || \ + (script1) == (script2) || \ + is_cluster_extender (ch)) #define IS_OPEN(pair_index) (((pair_index) & 1) == 0) @@ -372,7 +389,7 @@ pango_script_iter_next (PangoScriptIter *iter) } } - if (SAME_SCRIPT (iter->script_code, sc)) + if (SAME_SCRIPT (iter->script_code, sc, ch)) { if (!REAL_SCRIPT (iter->script_code) && REAL_SCRIPT (sc)) { diff --git a/pango/pangowin32-dwrite-fontmap.cpp b/pango/pangowin32-dwrite-fontmap.cpp index 2db0972a..7e712b57 100644 --- a/pango/pangowin32-dwrite-fontmap.cpp +++ b/pango/pangowin32-dwrite-fontmap.cpp @@ -512,22 +512,30 @@ pango_win32_dwrite_font_check_is_hinted (PangoWin32Font *font) &table_ctx, &exists))) { - if (exists) + if (exists && table_size > 4) { guint16 version = DWRITE_NEXT_USHORT (table_data); if (version == 0 || version == 1) { guint16 num_ranges = DWRITE_NEXT_USHORT (table_data); - guint16 i; + UINT32 max_ranges = (table_size - 4) / (sizeof (guint16) * 2); + guint16 i = 0; - for (i = 0; !result && i < num_ranges && i < (table_size / sizeof (guint16)); i ++) + if (num_ranges > max_ranges) + num_ranges = max_ranges; + + for (i = 0; i < num_ranges; i++) { + G_GNUC_UNUSED guint16 ppem = DWRITE_NEXT_USHORT (table_data); guint16 behavior = DWRITE_NEXT_USHORT (table_data); if (behavior & (GASP_GRIDFIT | GASP_SYMMETRIC_GRIDFIT)) - result = TRUE; + { + result = TRUE; + break; + } } } } diff --git a/tests/itemize/three.expected b/tests/itemize/three.expected new file mode 100644 index 00000000..eb45fbd3 --- /dev/null +++ b/tests/itemize/three.expected @@ -0,0 +1,9 @@ +<span font="Cantarell 11" fallback="false">عַرַبִ</span> + +Items: عַرַبִ +Chars: 6(0) +Font: Cantarell 11 +Script: arabic +Lang: ar +Bidi: 1 +Attrs: 0 12 fallback false diff --git a/tests/itemize/three.items b/tests/itemize/three.items new file mode 100644 index 00000000..394767e5 --- /dev/null +++ b/tests/itemize/three.items @@ -0,0 +1 @@ +<span font="Cantarell 11" fallback="false">عַرַبִ</span> |