From 5adda33f962a1c9798d6723aff80e94b4dee69f9 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 30 Mar 2016 17:09:15 +0000 Subject: Finish removing platform-dependent code from Fl_PostScript.cxx git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11477 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/PostScript/Fl_PostScript.cxx | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/drivers/PostScript') diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 9027faca4..d25915a5a 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -16,9 +16,7 @@ // http://www.fltk.org/str.php // -#include #include -#include #include #include #include @@ -26,12 +24,6 @@ #include #include #include -#if defined(USE_X11) -#include -#if USE_XFT -#include -#endif -#endif /** \brief Label of the PostScript file chooser window */ const char *Fl_PostScript_File_Device::file_chooser_title = "Select a .ps file"; @@ -1041,12 +1033,8 @@ static uchar *calc_mask(uchar *img, int w, int h, Fl_Color bg) // write to PostScript a bitmap image of a UTF8 string void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int n, double x, double y, int w, bool rtl) { - // scale for bitmask computation -#if defined(USE_X11) && !USE_XFT - float scale = 1; // don't scale because we can't expect to have scalable fonts -#else - float scale = 2; -#endif + // scale for bitmask computation is set to 1 when we can't expect to have scalable fonts + float scale = Fl_Display_Device::display_device()->driver()->scale_bitmap_for_PostScript(); Fl_Fontsize old_size = size(); Fl_Font fontnum = Fl_Graphics_Driver::font(); int w_scaled = (int)(w * (scale + 0.5)); @@ -1060,11 +1048,11 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int // color offscreen background with a shade contrasting with the text color fl_rectf(0, 0, w_scaled, (int)(h+3*scale) ); fl_color(text_color); -#if defined(USE_X11) && !USE_XFT - // force seeing this font as new so it's applied to the offscreen graphics context - fl_graphics_driver->font_descriptor(NULL); - fl_font(fontnum, 0); -#endif + if (scale < 1.5) { + // force seeing this font as new so it's applied to the offscreen graphics context + fl_graphics_driver->font_descriptor(NULL); + fl_font(fontnum, 0); + } fl_font(fontnum, (Fl_Fontsize)(scale * old_size) ); int w2 = (int)fl_width(str, n); // draw string in offscreen -- cgit v1.2.3