Browse Source

Removed compatibility for iOS versions before 3.2.

tags/2021-05-28
jules 13 years ago
parent
commit
75f8a6a440
3 changed files with 8 additions and 43 deletions
  1. +4
    -0
      modules/juce_graphics/juce_graphics.cpp
  2. +4
    -39
      modules/juce_graphics/native/juce_mac_Fonts.mm
  3. +0
    -4
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 4
- 0
modules/juce_graphics/juce_graphics.cpp View File

@@ -57,6 +57,10 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <CoreText/CoreText.h> #import <CoreText/CoreText.h>
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
#error "JUCE no longer supports targets earlier than iOS 3.2"
#endif
#elif JUCE_LINUX #elif JUCE_LINUX
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H


+ 4
- 39
modules/juce_graphics/native/juce_mac_Fonts.mm View File

@@ -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);
} }


+ 0
- 4
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -1285,10 +1285,6 @@ private:
L"", type, 0, 0, 0, 0, parentToAddTo, 0, L"", type, 0, 0, 0, 0, parentToAddTo, 0,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(), 0); (HINSTANCE) Process::getCurrentModuleInstanceHandle(), 0);
#if JUCE_DIRECT2D
setCurrentRenderingEngine (1);
#endif
if (hwnd != 0) if (hwnd != 0)
{ {
SetWindowLongPtr (hwnd, 0, 0); SetWindowLongPtr (hwnd, 0, 0);


Loading…
Cancel
Save