diff options
| author | Manolo Gouy <Manolo> | 2010-11-25 18:21:21 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-11-25 18:21:21 +0000 |
| commit | 7eb27fa4bd313e4c9f83df5aa8b774f54a7aaca2 (patch) | |
| tree | b46139e955b531bfdd09f25e785a8cd91ac46f99 /src/fl_font_mac.cxx | |
| parent | 0f3e028a13cd7fadfba39964bebd42639a06a6c4 (diff) | |
Mac OS X: introduced global variable fl_mac_os_version and cleaned a few unused variables.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7892 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_font_mac.cxx')
| -rw-r--r-- | src/fl_font_mac.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index e1e4bead6..e87bad9d7 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -34,9 +34,6 @@ extern unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* #define check_default_font() {if (!fl_fontsize) fl_font(0, 12);} static const CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 }; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -static SInt32 MACsystemVersion = 0; -#endif Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) { next = 0; @@ -50,9 +47,8 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) { size = Size; minsize = maxsize = Size; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion); - -if(MACsystemVersion >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also! +if(fl_mac_os_version == 0) fl_open_display(); +if(fl_mac_os_version >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also! CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8); fontref = CTFontCreateWithName(str, size, NULL); CGGlyph glyph[2]; @@ -170,7 +166,7 @@ Fl_Font_Descriptor::~Fl_Font_Descriptor() { */ if (this == fl_fontsize) fl_fontsize = 0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if(MACsystemVersion >= 0x1050) CFRelease(fontref); + if(fl_mac_os_version >= 0x1050) CFRelease(fontref); #else /* ATSUDisposeTextLayout(layout); ATSUDisposeStyle(style); */ @@ -273,7 +269,7 @@ double fl_width(const UniChar* txt, int n) { return 8*n; // user must select a font first! } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if(MACsystemVersion >= 0x1050) { +if(fl_mac_os_version >= 0x1050) { CTFontRef fontref = fl_fontsize->fontref; CFStringRef str = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n * sizeof(UniChar), kCFStringEncodingUTF16, false); CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str, NULL); @@ -342,7 +338,7 @@ void fl_text_extents(const UniChar* txt, int n, int &dx, int &dy, int &w, int &h return; } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if(MACsystemVersion >= 0x1050) { +if(fl_mac_os_version >= 0x1050) { CTFontRef fontref = fl_fontsize->fontref; CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n *sizeof(UniChar), kCFStringEncodingUTF16, false); CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str16, NULL); @@ -435,7 +431,7 @@ void fl_draw(const char *str, int n, float x, float y) { // convert to UTF-16 first UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if(MACsystemVersion >= 0x1050) { + if(fl_mac_os_version >= 0x1050) { CFStringRef keys[2]; CFTypeRef values[2]; CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)uniStr, n * sizeof(UniChar), kCFStringEncodingUTF16, false); |
