|
|
@@ -23,9 +23,9 @@ |
|
|
==============================================================================
|
|
|
==============================================================================
|
|
|
*/
|
|
|
*/
|
|
|
|
|
|
|
|
|
#if (JUCE_MAC && defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 \
|
|
|
|
|
|
&& MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5) \
|
|
|
|
|
|
|| (JUCE_IOS && defined (__IPHONE_3_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_2)
|
|
|
|
|
|
|
|
|
#if JUCE_IOS || (JUCE_MAC && defined (MAC_OS_X_VERSION_10_5) \
|
|
|
|
|
|
&& MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 \
|
|
|
|
|
|
&& MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
|
|
|
#define JUCE_CORETEXT_AVAILABLE 1
|
|
|
#define JUCE_CORETEXT_AVAILABLE 1
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@@ -631,7 +631,7 @@ StringArray Font::findAllTypefaceStyles (const String& family) |
|
|
#else
|
|
|
#else
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
//==============================================================================
|
|
|
// The stuff that follows is a mash-up that supports pre-OSX 10.5 and pre-iOS 3.2 APIs.
|
|
|
|
|
|
|
|
|
// The stuff that follows is a mash-up that supports pre-OSX 10.5 APIs.
|
|
|
// (Hopefully all of this can be ditched at some point in the future).
|
|
|
// (Hopefully all of this can be ditched at some point in the future).
|
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
//==============================================================================
|
|
|
@@ -663,23 +663,6 @@ public: |
|
|
JUCE_AUTORELEASEPOOL
|
|
|
JUCE_AUTORELEASEPOOL
|
|
|
renderingTransform = CGAffineTransformIdentity;
|
|
|
renderingTransform = CGAffineTransformIdentity;
|
|
|
|
|
|
|
|
|
#if JUCE_IOS
|
|
|
|
|
|
NSString* fontName = juceStringToNS (style);
|
|
|
|
|
|
fontRef = CGFontCreateWithFontName ((CFStringRef) fontName);
|
|
|
|
|
|
|
|
|
|
|
|
if (fontRef == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Sometimes, UIFont manages to handle names that CGFontCreateWithFontName fails on...
|
|
|
|
|
|
UIFont* uiFont = [UIFont fontWithName: fontName size: 12];
|
|
|
|
|
|
fontRef = CGFontCreateWithFontName ((CFStringRef) uiFont.fontName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const int ascender = abs (CGFontGetAscent (fontRef));
|
|
|
|
|
|
const float totalHeight = ascender + abs (CGFontGetDescent (fontRef));
|
|
|
|
|
|
ascent = ascender / totalHeight;
|
|
|
|
|
|
unitsToHeightScaleFactor = 1.0f / totalHeight;
|
|
|
|
|
|
fontHeightToCGSizeFactor = CGFontGetUnitsPerEm (fontRef) / totalHeight;
|
|
|
|
|
|
#else
|
|
|
|
|
|
NSDictionary* nsDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
|
NSDictionary* nsDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
|
juceStringToNS (name), NSFontFamilyAttribute,
|
|
|
juceStringToNS (name), NSFontFamilyAttribute,
|
|
|
juceStringToNS (style), NSFontFaceAttribute, nil];
|
|
|
juceStringToNS (style), NSFontFaceAttribute, nil];
|
|
|
@@ -731,8 +714,6 @@ public: |
|
|
fontHeightToCGSizeFactor = CGFontGetUnitsPerEm (fontRef) / (float) totalHeight;
|
|
|
fontHeightToCGSizeFactor = CGFontGetUnitsPerEm (fontRef) / (float) totalHeight;
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
~OSXTypeface()
|
|
|
~OSXTypeface()
|
|
|
@@ -1067,21 +1048,12 @@ StringArray Font::findAllTypefaceStyles (const String& family) |
|
|
StringArray results;
|
|
|
StringArray results;
|
|
|
JUCE_AUTORELEASEPOOL
|
|
|
JUCE_AUTORELEASEPOOL
|
|
|
|
|
|
|
|
|
#if JUCE_IOS
|
|
|
|
|
|
NSArray* styles = [UIFont fontNamesForFamilyName: juceStringToNS (family)];
|
|
|
|
|
|
#else
|
|
|
|
|
|
NSArray* styles = [[NSFontManager sharedFontManager] availableMembersOfFontFamily: juceStringToNS (family)];
|
|
|
NSArray* styles = [[NSFontManager sharedFontManager] availableMembersOfFontFamily: juceStringToNS (family)];
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < [styles count]; ++i)
|
|
|
for (unsigned int i = 0; i < [styles count]; ++i)
|
|
|
{
|
|
|
{
|
|
|
#if JUCE_IOS
|
|
|
|
|
|
// Fonts are returned in the form of "Arial-BoldMT"
|
|
|
|
|
|
results.add (nsStringToJuce ((NSString*) [styles objectAtIndex: i]));
|
|
|
|
|
|
#else
|
|
|
|
|
|
NSArray* style = [styles objectAtIndex: i];
|
|
|
NSArray* style = [styles objectAtIndex: i];
|
|
|
results.add (nsStringToJuce ((NSString*) [style objectAtIndex: 1]));
|
|
|
results.add (nsStringToJuce ((NSString*) [style objectAtIndex: 1]));
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return results;
|
|
|
return results;
|
|
|
@@ -1128,13 +1100,6 @@ Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font) |
|
|
if (font.getTypefaceStyle() == getDefaultStyle())
|
|
|
if (font.getTypefaceStyle() == getDefaultStyle())
|
|
|
newFont.setTypefaceStyle ("Regular");
|
|
|
newFont.setTypefaceStyle ("Regular");
|
|
|
|
|
|
|
|
|
#if JUCE_IOS && ! JUCE_CORETEXT_AVAILABLE
|
|
|
|
|
|
// Fonts style names on Cocoa Touch are unusual like "Arial-BoldMT"
|
|
|
|
|
|
// No font will be found for the style of "Regular" so we must modify the style
|
|
|
|
|
|
if (newFont.getTypefaceStyle() == "Regular")
|
|
|
|
|
|
newFont.setTypefaceStyle (faceName);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
return Typeface::createSystemTypefaceFor (newFont);
|
|
|
return Typeface::createSystemTypefaceFor (newFont);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|