diff options
| author | Manolo Gouy <Manolo> | 2011-02-15 15:54:06 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-02-15 15:54:06 +0000 |
| commit | 37362e255b8a2c8f966709cdf1366300c59358ab (patch) | |
| tree | a652e823dc5dd3d3f66f856e1e596545b95c4ed4 /src | |
| parent | 63dbae51d289dd6f33f9ffd48bea93a319dd3325 (diff) | |
About PostScript text output under X11: Non-Xft fonts can have a different size from that required.
Give to the PostScript font the same size as that used on the display.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8429 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_PostScript.cxx | 21 | ||||
| -rw-r--r-- | src/fl_font_x.cxx | 6 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx index 92ad12491..fc71ce199 100644 --- a/src/Fl_PostScript.cxx +++ b/src/Fl_PostScript.cxx @@ -31,6 +31,9 @@ #include <stdio.h> #include <FL/Fl_PostScript.H> #include <FL/Fl_Native_File_Chooser.H> +#if defined(USE_X11) && !USE_XFT +#include "Fl_Font.H" +#endif const char *Fl_PostScript_Graphics_Driver::class_id = "Fl_PostScript_Graphics_Driver"; const char *Fl_PostScript_File_Device::class_id = "Fl_PostScript_File_Device"; @@ -927,12 +930,24 @@ static const char *_fontNames[] = { }; void Fl_PostScript_Graphics_Driver::font(int f, int s) { + Fl_Display_Device::display_device()->driver()->font(f,s); // Use display fonts for font measurement + Fl_Graphics_Driver::font(f, s); if (f < FL_FREE_FONT) { + int ps_size = s; fprintf(output, "/%s SF\n" , _fontNames[f]); - fprintf(output,"%i FS\n", s); +#if defined(USE_X11) && !USE_XFT +// Non-Xft fonts can have a different size from that required. +// Give to the PostScript font the same size as that used on the display + Fl_Font_Descriptor *desc = Fl_Display_Device::display_device()->driver()->font_descriptor(); + this->font_descriptor(desc); + char *name = desc->font->font_name_list[0]; + char *p = strstr(name, "--"); + if (p) { + sscanf(p + 2, "%d", &ps_size); } - Fl_Display_Device::display_device()->driver()->font(f,s); // Use display fonts for font measurement - Fl_Graphics_Driver::font(f, s); +#endif + fprintf(output,"%i FS\n", ps_size); + } } void Fl_PostScript_Graphics_Driver::color(Fl_Color c) { diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx index c671e6444..6c033f72c 100644 --- a/src/fl_font_x.cxx +++ b/src/fl_font_x.cxx @@ -273,9 +273,9 @@ void Fl_Xlib_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) { if (fnum == Fl_Graphics_Driver::font() && size == Fl_Graphics_Driver::size()) return; Fl_Graphics_Driver::font(fnum, size); Fl_Font_Descriptor* f = find(fnum, size); - if (f != fl_graphics_driver->font_descriptor()) { - fl_graphics_driver->font_descriptor(f); - fl_xfont = current_font->fonts[0]; + if (f != this->font_descriptor()) { + this->font_descriptor(f); + fl_xfont = f->font->fonts[0]; font_gc = 0; } } |
