diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-04-09 16:26:15 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-04-09 16:26:15 +0200 |
| commit | 0ddf5e74a94132e00e117372d0350f798d537543 (patch) | |
| tree | 84045647d32e92549a5a0863310a5d00b82c34ae /src/drivers | |
| parent | 86849aac8ff3810ec104b8041cef026a5ba60c84 (diff) | |
Fix for STR 3519: the PostScript graphics driver fails with some narrow unicode characters
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/PostScript/Fl_PostScript.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 4d74f0840..1b6fed13e 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -1019,7 +1019,7 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int float scale = Fl_Graphics_Driver::default_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)); + int w_scaled = (int)(w * (scale + 0.5) + 1); int h = (int)(height() * scale); // create an offscreen image of the string Fl_Color text_color = Fl_Graphics_Driver::color(); @@ -1037,11 +1037,12 @@ void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int } fl_font(fontnum, (Fl_Fontsize)(scale * old_size) ); int w2 = (int)fl_width(str, n); + if (w2 > w_scaled) w2 = w_scaled; // draw string in offscreen if (rtl) fl_rtl_draw(str, n, w2, (int)(h * 0.8) ); - else fl_draw(str, n, 1, (int)(h * 0.8) ); + else fl_draw(str, n, 0, (int)(h * 0.8) ); // read (most of) the offscreen image - uchar *img = fl_read_image(NULL, 1, 1, w2, h, 0); + uchar *img = fl_read_image(NULL, 0, 1, w2, h, 0); fl_end_offscreen(); font(fontnum, old_size); fl_delete_offscreen(off); |
