font checking problem

[email protected] (Atsuhiko Yamanaka)
Newsgroups gmane.comp.web.amaya.devel
Message-ID <[email protected]>
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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.