From d9e36a352fde27c59fde7b64edc796e2b463e701 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 27 Aug 2017 07:24:49 +0000 Subject: [PATCH] Fix for STR#3397: Font size/type not working inside GL window with gl_font(), gl_draw() Function load_xfont_for_xft2() tries to load an X font corresponding to a given xft font, to use it with GL. Under Ubuntu, always the same font was loaded, whatever the family, style and size. With this fix, style and size requests are honored under Ubuntu. Family request may not be honored. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@12403 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_font_xft.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx index 5089d4053..7a0f6efc4 100644 --- a/src/fl_font_xft.cxx +++ b/src/fl_font_xft.cxx @@ -497,9 +497,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);