summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/quartz/salgdi.h9
-rw-r--r--vcl/quartz/ctfonts.cxx8
-rw-r--r--vcl/quartz/salgdi.cxx24
3 files changed, 36 insertions, 5 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 7cd2e83264da..a6c8a8ce003f 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -29,6 +29,15 @@
#include <ApplicationServices/ApplicationServices.h>
#include "osx/osxvcltypes.h"
#include "osx/salframe.h"
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+// The following symbols are SPI (System Programming Interface) in 10.5.
+extern "C" {
+ void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]);
+ const CGSize* CTRunGetAdvancesPtr(CTRunRef run);
+ extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel;
+}
+#endif
#else
#include <CoreGraphics/CoreGraphics.h>
#include <CoreText/CoreText.h>
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index ea89b5318f8d..72bc087ca368 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -80,9 +80,13 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
((mpFontData->GetWeight() < WEIGHT_SEMIBOLD) &&
(mpFontData->GetWeight() != WEIGHT_DONTKNOW)) )
{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
int nStroke = -10.0;
CFNumberRef rStroke = CFNumberCreate(NULL, kCFNumberSInt32Type, &nStroke);
CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke);
+#else /* kCTStrokeWidthAttributeName is not available */
+ /* do we really need "fake" bold? */
+#endif
}
// fake italic
@@ -335,9 +339,11 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
// get font-enabled status
if( bFontEnabled ) {
- int bEnabled = FALSE;
+ int bEnabled = TRUE; // by default (and when we're on OS X < 10.6) it's "enabled"
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
CFNumberRef pEnabled = (CFNumberRef)CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute );
CFNumberGetValue( pEnabled, kCFNumberIntType, &bEnabled );
+#endif
*bFontEnabled = bEnabled;
}
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index d82621576e34..41e1b492baa6 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -337,16 +337,32 @@ static bool AddTempDevFont(const OUString& rFontFileURL)
CFStringRef rFontPath = CFStringCreateWithCString(NULL, aCFileName.getStr(), kCFStringEncodingUTF8);
CFURLRef rFontURL = CFURLCreateWithFileSystemPath(NULL, rFontPath, kCFURLPOSIXPathStyle, true);
- CFErrorRef error;
- bool success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, &error);
+ bool success = false;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+ CFErrorRef error;
+ success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, &error);
if (!success)
{
CFRelease(error);
- return false;
}
+#else /* CTFontManagerRegisterFontsForURL is not available on OS X <10.6 */
+ CGDataProviderRef dataProvider = CGDataProviderCreateWithURL(rFontURL);
+ CGFontRef graphicsFont = CGFontCreateWithDataProvider(dataProvider);
+ if (graphicsFont)
+ {
+ CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, /*fontSize*/ 0, /*matrix*/ NULL, /*attributes*/ NULL);
+ if (coreTextFont)
+ {
+ success = true;
+ CFRelease(coreTextFont);
+ }
+ CGFontRelease(graphicsFont);
+ }
+ CGDataProviderRelease(dataProvider);
+#endif
- return true;
+ return success;
}
static void AddTempFontDir( const OUString &rFontDirUrl )