diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_font_mac.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index bc777ad12..dfadfcb15 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -80,6 +80,17 @@ if (fl_mac_os_version >= 100500) {//unfortunately, CTFontCreateWithName != NULL &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 |
