diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/PostScript/Fl_PostScript.cxx | 19 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx | 13 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 12 |
4 files changed, 26 insertions, 19 deletions
diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 003f39807..9027faca4 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -953,25 +953,8 @@ void Fl_PostScript_Graphics_Driver::font(int f, int s) { Fl_Font_Descriptor *desc = driver->font_descriptor(); this->font_descriptor(desc); if (f < FL_FREE_FONT) { - float ps_size = (float) s; fprintf(output, "/%s SF\n" , _fontNames[f]); -#if defined(USE_X11) -#if USE_XFT - // Xft font height is sometimes larger than the required size (see STR 2566). - // Increase the PostScript font size by 15% without exceeding the display font height - int max = desc->font->height; - ps_size = s * 1.15; - if (ps_size > max) ps_size = max; -#else - // Non-Xft fonts can be smaller than required. - // Set the PostScript font size to the display font height - char *name = desc->font->font_name_list[0]; - char *p = strstr(name, "--"); - if (p) { - sscanf(p + 2, "%f", &ps_size); - } -#endif // USE_XFT -#endif // USE_X11 + float ps_size = driver->scale_font_for_PostScript(desc, s); clocale_printf("%.1f FS\n", ps_size); } } diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index 4d4a1ab30..eb5662245 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -127,6 +127,7 @@ protected: void color(Fl_Color c); Fl_Color color() { return color_; } void color(uchar r, uchar g, uchar b); + virtual float scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s); }; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx index cdf304894..bf14b4923 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx @@ -680,6 +680,19 @@ void Fl_Xlib_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) { } if (gc_) XUtf8DrawRtlString(fl_display, fl_window, font_descriptor()->font, gc_, x, y, c, n); } + +float Fl_Xlib_Graphics_Driver::scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s) { + float ps_size = (float) s; + // Non-Xft fonts can be smaller than required. + // Set the PostScript font size to the display font height + char *name = desc->font->font_name_list[0]; + char *p = strstr(name, "--"); + if (p) { + sscanf(p + 2, "%f", &ps_size); + } + return ps_size; +} + #endif // FL_DOXYGEN // // End of "$Id$". 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 c419b4fd6..fd6d24b47 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx @@ -1087,7 +1087,17 @@ void Fl_Xlib_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) { delete[] ucs_txt; } -#endif + +float Fl_Xlib_Graphics_Driver::scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s) { + // Xft font height is sometimes larger than the required size (see STR 2566). + // Increase the PostScript font size by 15% without exceeding the display font height + int max = desc->font->height; + float ps_size = s * 1.15; + if (ps_size > max) ps_size = max; + return ps_size; +} + +#endif // FL_DOXYGEN // // End of "$Id$" |
