Author: manolo
Date: 2011-04-04 05:28:20 -0700 (Mon, 04 Apr 2011)
New Revision: 8558
Log:
Fix error that can happen with some 3rd party fonts lacking certain size
information.
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-03 17:31:07 UTC (rev
8557)
+++ branches/branch-1.3/src/fl_font_mac.cxx 2011-04-04 12:28:20 UTC (rev
8558)
@@ -80,6 +80,17 @@
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue (attributes, kCTKernAttributeName, zero_ref);
}
+ if (ascent == 0) { // this may happen with some third party fonts
+ CFDictionarySetValue (attributes, kCTFontAttributeName, fontref);
+ CFAttributedStringRef mastr =
CFAttributedStringCreate(kCFAllocatorDefault, CFSTR("Wj"), attributes);
+ CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
+ CFRelease(mastr);
+ CGFloat fascent, fdescent;
+ CTLineGetTypographicBounds(ctline, &fascent, &fdescent, NULL);
+ CFRelease(ctline);
+ ascent = (short)(fascent + 0.5);
+ descent = (short)(fdescent + 0.5);
+ }
}
else {
#endif
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit