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
This commit is contained in:
Manolo Gouy 2017-08-27 07:24:49 +00:00
parent 4703285d28
commit d9e36a352f

View File

@ -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);