summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-02-21 04:35:42 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2013-02-21 04:35:42 +0000
commit359d37585d7e0ebacd576b47800a0b6893c062c2 (patch)
tree9625312b627b96aea67f6e2c45c9f5d4fcf67f8d /Build/source/texk/web2c/xetexdir/XeTeX_mac.c
parent6c5a13637f8ede4a74f8becfdd41c46a0397d22c (diff)
More Mac fixes
git-svn-id: svn://tug.org/texlive/trunk@29185 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/XeTeX_mac.c')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_mac.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
index 477998a3143..edef3b570b7 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
@@ -377,7 +377,7 @@ char* getFileNameFromCTFont(CTFontRef ctFontRef)
char *ret = NULL;
CFURLRef url = NULL;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
/* kCTFontURLAttribute was not avialable before 10.6 */
ATSFontRef atsFont;
FSRef fsref;
@@ -406,7 +406,7 @@ char* getFileNameFromCTFont(CTFontRef ctFontRef)
if (noErr != ATSFontGetFileReference(id2, &dummy)) /* check if id2 is valid, any better way? */
break;
ctFontRef2 = CTFontCreateWithPlatformFont(id2, 0.0, NULL, NULL);
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
status = ATSFontGetFileReference(id2, &fsref);
if (status == noErr)
url2 = CFURLCreateFromFSRef(NULL, &fsref);
@@ -846,19 +846,22 @@ find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page)
CFNumberRef imageHeight = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);
CFNumberRef DPIWidth = CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth);
CFNumberRef DPIHeight = CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight);
- int w = 0, h = 0, hRes = 72, vRes = 72;
- CFNumberGetValue(imageWidth, kCFNumberIntType, &w);
- CFNumberGetValue(imageHeight, kCFNumberIntType, &h);
- CFNumberGetValue(DPIWidth, kCFNumberIntType, &hRes);
- CFNumberGetValue(DPIHeight, kCFNumberIntType, &vRes);
-
- bounds->x = 0;
- bounds->y = 0;
- bounds->wd = w * 72.27 / hRes;
- bounds->ht = h * 72.27 / vRes;
- CFRelease(properties);
- CFRelease(picFileSource);
- result = noErr;
+
+ if (imageWidth && imageHeight && DPIWidth && DPIHeight) {
+ int w = 0, h = 0, hRes = 72, vRes = 72;
+ CFNumberGetValue(imageWidth, kCFNumberIntType, &w);
+ CFNumberGetValue(imageHeight, kCFNumberIntType, &h);
+ CFNumberGetValue(DPIWidth, kCFNumberIntType, &hRes);
+ CFNumberGetValue(DPIHeight, kCFNumberIntType, &vRes);
+
+ bounds->x = 0;
+ bounds->y = 0;
+ bounds->wd = w * 72.27 / hRes;
+ bounds->ht = h * 72.27 / vRes;
+ CFRelease(properties);
+ CFRelease(picFileSource);
+ result = noErr;
+ }
}
}