Author: manolo
Date: 2011-04-07 00:51:26 -0700 (Thu, 07 Apr 2011)
New Revision: 8569
Log:
Modified Fl_Quartz_Graphics_Driver::width(unsigned int wc) so it handles
properly
cases with wc > 0xFFFF.
Modified:
branches/branch-1.3/src/fl_font_mac.cxx
Modified: branches/branch-1.3/src/fl_font_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_mac.cxx 2011-04-06 21:37:13 UTC (rev
8568)
+++ branches/branch-1.3/src/fl_font_mac.cxx 2011-04-07 07:51:26 UTC (rev
8569)
@@ -374,9 +374,19 @@
}
double Fl_Quartz_Graphics_Driver::width(unsigned int wc) {
- const UniChar uc = wc;
if (!font_descriptor()) font(FL_HELVETICA, FL_NORMAL_SIZE);
- return fl_mac_width(&uc, 1, font_descriptor());
+
+ UniChar utf16[3];
+ int l = 1;
+ if (wc <= 0xFFFF) {
+ *utf16 = wc;
+ }
+ else {
+ char buf[4];
+ l = fl_utf8encode(wc, buf);
+ l = (int)fl_utf8toUtf16(buf, l, utf16, 3);
+ }
+ return fl_mac_width(utf16, l, font_descriptor());
}
// text extent calculation
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit