pango r2646 - in trunk: . pango



Author: behdad
Date: Wed May 28 16:43:46 2008
New Revision: 2646
URL: http://svn.gnome.org/viewvc/pango?rev=2646&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/pango/fonts.c

Modified: trunk/pango/fonts.c
==============================================================================
--- trunk/pango/fonts.c	(original)
+++ trunk/pango/fonts.c	Wed May 28 16:43:46 2008
@@ -885,14 +885,41 @@
 };
 
 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]