DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR Pending]
Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature
Fix Version: 1.3.0 (r6951)
Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature
Fix Version: 1.3.0 (r6951)
Index: fl_font_mac.cxx
===================================================================
--- fl_font_mac.cxx (revision 6985)
+++ fl_font_mac.cxx (working copy)
@@ -34,6 +34,9 @@
#define check_default_font() {if (!fl_fontsize) fl_font(0, 12);}
static const CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
+#if defined(__APPLE_COCOA__)
+static SInt32 MACsystemVersion = 0;
+#endif
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
next = 0;
@@ -47,7 +50,9 @@
size = Size;
minsize = maxsize = Size;
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_5
-if(CTFontCreateWithName != NULL) {
+ if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
+
+if(MACsystemVersion >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL
on 10.4 also!
CFStringRef str = CFStringCreateWithCString(NULL, name,
kCFStringEncodingUTF8);
fontref = CTFontCreateWithName(str, size, NULL);
CGGlyph glyph[2];
@@ -58,11 +63,11 @@
CTFontGetAdvancesForGlyphs(fontref, kCTFontHorizontalOrientation, glyph,
advances, 2);
w = advances[0].width;
if( abs(advances[0].width - advances[1].width) < 1E-2 ) {//this is a
fixed-width font
- //slightly rescale fixed-width fonts so the character width has an
integral value
- CFRelease(fontref);
- CGFloat fsize = size / ( w/floor(w + 0.5) );
- fontref = CTFontCreateWithName(str, fsize, NULL);
- w = CTFontGetAdvancesForGlyphs(fontref, kCTFontHorizontalOrientation,
glyph, NULL, 1);
+ //slightly rescale fixed-width fonts so the character width has an
integral value
+ CFRelease(fontref);
+ CGFloat fsize = size / ( w/floor(w + 0.5) );
+ fontref = CTFontCreateWithName(str, fsize, NULL);
+ w = CTFontGetAdvancesForGlyphs(fontref, kCTFontHorizontalOrientation,
glyph, NULL, 1);
}
CFRelease(str);
ascent = (short)(CTFontGetAscent(fontref) + 0.5);
@@ -165,7 +170,7 @@
*/
if (this == fl_fontsize) fl_fontsize = 0;
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_5
- if(CTFontCreateWithName != NULL) CFRelease(fontref);
+ if(MACsystemVersion >= 0x1050) CFRelease(fontref);
#else
/* ATSUDisposeTextLayout(layout);
ATSUDisposeStyle(style); */
@@ -272,7 +277,7 @@
return 8*n; // user must select a font first!
}
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_5
-if(CTFontCreateWithName != NULL) {
+if(MACsystemVersion >= 0x1050) {
CTFontRef fontref = fl_fontsize->fontref;
CFStringRef str = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n *
sizeof(UniChar), kCFStringEncodingUTF16, false);
CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str, NULL);
@@ -340,7 +345,7 @@
return;
}
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_5
-if(CTFontCreateWithName != NULL) {
+if(MACsystemVersion >= 0x1050) {
CTFontRef fontref = fl_fontsize->fontref;
CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n
*sizeof(UniChar), kCFStringEncodingUTF16, false);
CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str16, NULL);
@@ -444,7 +449,7 @@
// convert to UTF-16 first
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >=
MAC_OS_X_VERSION_10_5
- if(CTFontCreateWithName != NULL) {
+ if(MACsystemVersion >= 0x1050) {
CFStringRef keys[2];
CFTypeRef values[2];
CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)uniStr, n
* sizeof(UniChar), kCFStringEncodingUTF16, false);
Index: Fl_cocoa.mm
===================================================================
--- Fl_cocoa.mm (revision 6989)
+++ Fl_cocoa.mm (working copy)
@@ -1725,7 +1725,7 @@
- (void)drawRect:(NSRect)rect;
- (BOOL)acceptsFirstResponder;
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent;
-//- (BOOL)performKeyEquivalent:(NSEvent*)theEvent;
+- (BOOL)performKeyEquivalent:(NSEvent*)theEvent;
- (void)mouseUp:(NSEvent *)theEvent;
- (void)rightMouseUp:(NSEvent *)theEvent;
- (void)otherMouseUp:(NSEvent *)theEvent;
@@ -1755,12 +1755,11 @@
{
return YES;
}
-/*
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
{
OSStatus err = cocoaKeyboardHandler(theEvent);
return (err ? NO : YES);
-}*/
+}
- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent
{
Fl_Window *w = [(FLWindow*)[theEvent window] getFl_Window];
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev