summaryrefslogtreecommitdiff
path: root/src/drivers/Xlib
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-30 16:27:41 +0000
committerManolo Gouy <Manolo>2016-03-30 16:27:41 +0000
commit730f2d12b275552cc142970f4f8a6a21e1beb5f0 (patch)
tree99c1ff41911cfeb6001e8c830ef18f9271db7fbc /src/drivers/Xlib
parent4a633d2aefd5fd538a3b446beaad17ce9a9caa6d (diff)
Continue removing platform-dependent code from Fl_PostScript.cxx
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11476 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx13
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx12
3 files changed, 25 insertions, 1 deletions
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$"