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
This commit is contained in:
parent
4a633d2aef
commit
730f2d12b2
@ -236,6 +236,8 @@ public:
|
||||
virtual uchar **mask_bitmap() { return 0; }
|
||||
/** Support for pixmap drawing */
|
||||
virtual void mask_bitmap(uchar **) {}
|
||||
// default implementation may be enough
|
||||
virtual float scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s) { return float(s); }
|
||||
// each platform implements that its own way
|
||||
static void add_rectangle_to_region(Fl_Region r, int x, int y, int w, int h);
|
||||
protected:
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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$".
|
||||
|
@ -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$"
|
||||
|
Loading…
Reference in New Issue
Block a user