summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-08-27 07:58:38 +0000
committerManolo Gouy <Manolo>2017-08-27 07:58:38 +0000
commitab7c915bf026fe9eb574942717953a000af2dd73 (patch)
tree2833af987ecde4b118808fe40e2c9969f0c0706d /src/drivers
parent04565cdcad7fa330b930e27925874c4f05bbdc98 (diff)
Fix for STR#3397: find adequate X font to use it with GL.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12404 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
index 2f9ca8b4c..f130acbd3 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
@@ -1078,20 +1078,8 @@ static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) {
char xlfd[128]; // we will put our synthetic XLFD in here
char *pc = strdup(fl_fonts[fnum].name); // what font were we asked for?
#if USE_PANGO
- char *p = pc;
+ char *p = pc + 1;
while (*p) { *p = tolower(*p); p++; }
- p = pc + strlen(pc) - 12;
- if (memcmp(p, " bold italic\0", 13) == 0) {
- *pc = 'P'; *p = 0;
- }
- p = pc + strlen(pc) - 5;
- if (memcmp(p, " bold\0", 6) == 0) {
- *pc = 'B'; *p = 0;
- }
- p = pc + strlen(pc) - 7;
- if (memcmp(p, " italic\0", 8) == 0) {
- *pc = 'I'; *p = 0;
- }
#endif // USE_PANGO
const char *name = pc; // keep a handle to the original name for freeing later
// Parse the "fltk-name" of the font
@@ -1137,9 +1125,14 @@ static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) {
snprintf(xlfd, 128, "-*-helvetica-*-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
xgl_font = XLoadQueryFont(fl_display, xlfd);
}
+ // If that still didn't work, try courier with resquested weight and slant
+ if(!xgl_font && weight != wt_med) {
+ snprintf(xlfd, 128, "-*-courier*-%s-%c-*--*-%d-*-*-*-*-*-*", weight, slant, (size*10));
+ xgl_font = XLoadQueryFont(fl_display, xlfd);
+ }
// If that still didn't work, try this instead
if(!xgl_font) {
- snprintf(xlfd, 128, "-*-courier-medium-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
+ snprintf(xlfd, 128, "-*-courier*-medium-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
xgl_font = XLoadQueryFont(fl_display, xlfd);
}
//printf("glf: %d\n%s\n%s\n", size, xlfd, fl_fonts[fl_font_].name);