diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | pango/fonts.c | 31 |
2 files changed, 36 insertions, 2 deletions
@@ -1,3 +1,10 @@ +2008-05-28 Behdad Esfahbod <behdad@gnome.org> + + Bug 510299 – OpenType font variants are broken with ATSUI/Cairo + + * pango/fonts.c (field_matches), (find_field): Ignore dashes when + matching fong description fields. + 2008-05-28 Tor Lillqvist <tml@novell.com> * pango/pangowin32-fontmap.c (synthesize_foreach) diff --git a/pango/fonts.c b/pango/fonts.c index 56dc4177..4e1c6928 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -885,14 +885,41 @@ static const FieldMap gravity_map[] = { }; static gboolean +field_matches (const gchar *s1, + const gchar *s2, + gsize n) +{ + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (n && *s1 && *s2) + { + c1 = (gint)(guchar) TOLOWER (*s1); + c2 = (gint)(guchar) TOLOWER (*s2); + if (c1 != c2) { + if (c1 == '-') { + s1++; + continue; + } + return FALSE; + } + s1++; s2++; + n--; + } + + return n == 0 && *s1 == '\0'; +} + +static gboolean find_field (const FieldMap *map, int n_elements, const char *str, int len, int *val) { int i; for (i=0; i<n_elements; i++) { - if (map[i].str[0] && g_ascii_strncasecmp (map[i].str, str, len) == 0 && - map[i].str[len] == '\0') + if (map[i].str[0] && field_matches (map[i].str, str, len)) { if (val) *val = map[i].value; |