pango r2786 - in trunk: . pango



Author: behdad
Date: Tue Jan  6 10:40:30 2009
New Revision: 2786
URL: http://svn.gnome.org/viewvc/pango?rev=2786&view=rev

Log:
2009-01-06  Behdad Esfahbod  <behdad gnome org>

        * pango/fonts.c (pango_font_description_to_filename):
        Make it Unicode safe.

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

Modified: trunk/pango/fonts.c
==============================================================================
--- trunk/pango/fonts.c	(original)
+++ trunk/pango/fonts.c	Tue Jan  6 10:40:30 2009
@@ -1280,13 +1280,12 @@
 
   result = pango_font_description_to_string (desc);
 
-  /* XXX This should be rewritten to read char-by-char instead
-   * of byte-by-byte, to be Unicode safe.
-   */
   p = result;
   while (*p)
     {
-      if (strchr ("-+_.", *p) == NULL && !g_ascii_isalnum (*p))
+      if (G_UNLIKELY ((guchar) *p >= 128))
+        /* skip over non-ASCII chars */;
+      else if (strchr ("-+_.", *p) == NULL && !g_ascii_isalnum (*p))
 	*p = '_';
       else
 	*p = g_ascii_tolower (*p);



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