FLTK logo

Re: [MOD] STR #3519: Sometimes Segmentation fault when printing some Unicode char's

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.bugs  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [MOD] STR #3519: Sometimes Segmentation fault when printing some Unicode char's Manolo Gouy Apr 07, 2019  
 
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: https://www.fltk.org/str.php?L3519
Version: 1.3.4


Attached file "str_3519_V3.patch"...


Link: https://www.fltk.org/str.php?L3519
Version: 1.3.4
diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx
index 4d74f0840..0f3b91978 100644
--- a/src/drivers/PostScript/Fl_PostScript.cxx
+++ b/src/drivers/PostScript/Fl_PostScript.cxx
@@ -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);
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.