DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2355
Version: 1.1.10


When using FLTK with Xft, if the machine lacks a working fontconfig
configuration, and the built in font directory does not exist either, the
application will crash. Typical traceback:

Program terminated with signal 11, Segmentation fault.
#0  FcPatternObjectPosition (object=<value optimized out>, p=<value
optimized
out>) at fcpat.c:309
309     fcpat.c: Filen eller katalogen finns inte.
        in fcpat.c
(gdb) bt
#0  FcPatternObjectPosition (object=<value optimized out>, p=<value
optimized
out>) at fcpat.c:309
#1  FcPatternObjectFindElt (object=<value optimized out>, p=<value
optimized
out>) at fcpat.c:334
#2  0x080eb6e0 in FcPatternObjectGet (p=0x0, object=21, id=0,
v=0xff832814) at
fcpat.c:728
#3  0x080eb896 in FcPatternObjectGetString (p=0x0, object=21, id=0,
s=0xff832894) at fcpat.c:812
#4  0x080d0c52 in XftFontInfoFill (dpy=<value optimized out>, pattern=0x0,
fi=0xff8328c8) at xftfreetype.c:402
#5  0x080d1f23 in XftFontOpenPattern (dpy=0xa1aa7a0, pattern=0x0) at
xftfreetype.c:1015
#6  0x080c2c9c in T.75 ()
#7  0x00000000 in ?? ()

This happens, for example, on Thinstation, where the local fonts are found
in 
/usr/X11R6/lib/X11/fonts rather than /usr/share/fonts. 

It's quite bad that Xft/fontconfig lacks support for server side fonts,
but in any case, FLTK shouldn't call XftFontOpenPattern with NULL. The
attached patch fixes this.


Link: http://www.fltk.org/str.php?L2355
Version: 1.1.10
Index: src/fl_font_xft.cxx
===================================================================
--- src/fl_font_xft.cxx (revision 7565)
+++ src/fl_font_xft.cxx (arbetskopia)
@@ -62,6 +62,7 @@
 // are several web pages of information on how to do this.
 //
 
+#include <stdio.h>
 #include <X11/Xft/Xft.h>
 
 // The predefined fonts that FLTK has:
@@ -212,6 +213,10 @@
     XftResult match_result; // the result of our matching attempt
     // query the system to find a match for this font
     match_pat = XftFontMatch(fl_display, fl_screen, fnt_pat, &match_result);
+    if (!match_pat) {
+       fprintf(stderr, "Unable to find fonts. Check your FontConfig 
configuration.\n");
+       ::exit(1);
+    }
     // open the matched font
     the_font = XftFontOpenPattern(fl_display, match_pat);
     // Tidy up the resources we allocated
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to