font checking problem

Hi,

Thanks to nice fontconfig system, I can display multi-byte (in my case, 
Japanese) characters on Gtk-Amaya, but Gtk-Amaya and xfs eat up many CPU time.

It seems that, whenever calculating character-width for each characters by
calling BoxCharacterWidth(in thotlib/dialogue/font.c),
XListFonts is called(in IsXLFDPatterneAFont of thotlib/dialogue/fontconfig.c)
and such frequent XListFonts calling has caused this problem.
How about calling IsXLFDPatterneAFont only one time for each XLFD?
I will post a patch.

Thanks,
--
ymnk

/*****************************************************************************/
diff -Naur Amaya/thotlib/dialogue/fontconfig.c Amaya-20021127/thotlib/dialogue/fontconfig.c
--- Amaya/thotlib/dialogue/fontconfig.c	2002-11-05 16:24:31.000000000 +0000
+++ Amaya-20021127/thotlib/dialogue/fontconfig.c	2002-11-27 01:35:13.000000000 +0000
@@ -358,6 +358,12 @@
 				     fontface = TtaGetMemory (sizeof (char) 
 							      * (strlen (&word[2]) + 1));
 				     strcpy (fontface, &word[2]);
+#ifndef _GL
+				     if(!IsXLFDPatterneAFont(fontface)){
+				       TtaFreeMemory (fontface);
+				       fontface=(char *)NULL;
+				     }
+#endif /*_GL*/
 				     fontsscript_tab[script]->family[font_face_index]->highlight[font_style]
 				       = fontface;
 				   }
@@ -475,14 +481,7 @@
       g_print ("\n%s",
 	       Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
 #endif /*_PCLFONTDEBUG*/
-#ifndef _GL
-      if (IsXLFDPatterneAFont (Fonttab[intscript]->family[font_face_index]->highlight[font_style]))
-	return (Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
-      else
-	return NULL;
-#else /*_GL*/
       return  (Fonttab[intscript]->family[font_face_index]->highlight[font_style]);
-#endif /*_GL*/
     }
   return NULL;
 }

Received on Tuesday, 26 November 2002 20:46:40 UTC