diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-02-19 21:46:39 +0000 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2013-02-19 21:46:39 +0000 |
commit | 142b5ec17f7b4296c53b7e77fae4ba2a9c6bf772 (patch) | |
tree | df041514fbe99c53c7c10753e94687c1adb84023 /Build/source/texk/web2c | |
parent | 46269cbc4c5e9e78c5159cae275f276c4c54e26a (diff) |
More Mac fixes
git-svn-id: svn://tug.org/texlive/trunk@29167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 95 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 76 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/am/xetex.am | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xewebmac.tex (renamed from Build/source/texk/web2c/xetexdir/xetexwebmac.tex) | 0 |
5 files changed, 75 insertions, 99 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 56b00d66fd0..8a156db6f2c 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -2483,28 +2483,30 @@ atsufontgetnamed(int what, CFDictionaryRef attributes) case XeTeX_find_variation_by_name: { CFArrayRef axes = CTFontCopyVariationAxes(font); - CFDictionaryRef variation = findDictionaryInArray(axes, kCTFontVariationAxisNameKey, - (const char*)nameoffile + 1, namelength); - if (variation) { - CFNumberRef identifier = CFDictionaryGetValue(variation, kCTFontVariationAxisIdentifierKey); - CFNumberGetValue(identifier, kCFNumberIntType, &rval); - } else - rval = -1; - CFRelease(axes); + if (axes) { + CFDictionaryRef variation = findDictionaryInArray(axes, kCTFontVariationAxisNameKey, + (const char*)nameoffile + 1, namelength); + if (variation) { + CFNumberRef identifier = CFDictionaryGetValue(variation, kCTFontVariationAxisIdentifierKey); + CFNumberGetValue(identifier, kCFNumberIntType, &rval); + } + CFRelease(axes); + } break; } case XeTeX_find_feature_by_name: { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArray(features, kCTFontFeatureTypeNameKey, - (const char*)nameoffile + 1, namelength); - if (feature) { - CFNumberRef identifier = CFDictionaryGetValue(feature, kCTFontFeatureTypeIdentifierKey); - CFNumberGetValue(identifier, kCFNumberIntType, &rval); - } else - rval = -1; - CFRelease(features); + if (features) { + CFDictionaryRef feature = findDictionaryInArray(features, kCTFontFeatureTypeNameKey, + (const char*)nameoffile + 1, namelength); + if (feature) { + CFNumberRef identifier = CFDictionaryGetValue(feature, kCTFontFeatureTypeIdentifierKey); + CFNumberGetValue(identifier, kCFNumberIntType, &rval); + } + CFRelease(features); + } break; } } @@ -2523,13 +2525,15 @@ atsufontgetnamed1(int what, CFDictionaryRef attributes, int param) if (what == XeTeX_find_selector_by_name) { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, kCTFontFeatureTypeIdentifierKey, param); - if (feature) { - CFNumberRef selector = findSelectorByName(feature, (const char*)nameoffile + 1, namelength); - if (selector) - CFNumberGetValue(selector, kCFNumberIntType, &rval); + if (features) { + CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, kCTFontFeatureTypeIdentifierKey, param); + if (feature) { + CFNumberRef selector = findSelectorByName(feature, (const char*)nameoffile + 1, namelength); + if (selector) + CFNumberGetValue(selector, kCFNumberIntType, &rval); + } + CFRelease(features); } - CFRelease(features); } #endif @@ -2544,31 +2548,34 @@ atsuprintfontname(int what, CFDictionaryRef attributes, int param1, int param2) CFStringRef name = NULL; if (what == XeTeX_variation_name) { CFArrayRef axes = CTFontCopyVariationAxes(font); - CFDictionaryRef variation = findDictionaryInArrayWithIdentifier(axes, - kCTFontVariationAxisIdentifierKey, - param1); - if (variation) - name = CFDictionaryGetValue(variation, kCTFontVariationAxisNameKey); - CFRelease(axes); - } - else if (what == XeTeX_feature_name || XeTeX_selector_name) { + if (axes) { + CFDictionaryRef variation = findDictionaryInArrayWithIdentifier(axes, + kCTFontVariationAxisIdentifierKey, + param1); + if (variation) + name = CFDictionaryGetValue(variation, kCTFontVariationAxisNameKey); + CFRelease(axes); + } + } else if (what == XeTeX_feature_name || what == XeTeX_selector_name) { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, - kCTFontFeatureTypeIdentifierKey, - param1); - if (feature) { - if (what == XeTeX_feature_name) - name = CFDictionaryGetValue(feature, kCTFontFeatureTypeNameKey); - else { - CFArrayRef selectors = CFDictionaryGetValue(feature, kCTFontFeatureTypeSelectorsKey); - CFDictionaryRef selector = findDictionaryInArrayWithIdentifier(selectors, - kCTFontFeatureSelectorIdentifierKey, - param2); - if (selector) - name = CFDictionaryGetValue(selector, kCTFontFeatureSelectorNameKey); + if (features) { + CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, + kCTFontFeatureTypeIdentifierKey, + param1); + if (feature) { + if (what == XeTeX_feature_name) + name = CFDictionaryGetValue(feature, kCTFontFeatureTypeNameKey); + else { + CFArrayRef selectors = CFDictionaryGetValue(feature, kCTFontFeatureTypeSelectorsKey); + CFDictionaryRef selector = findDictionaryInArrayWithIdentifier(selectors, + kCTFontFeatureSelectorIdentifierKey, + param2); + if (selector) + name = CFDictionaryGetValue(selector, kCTFontFeatureSelectorNameKey); + } } + CFRelease(features); } - CFRelease(features); } if (name) { diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 0d8047a96d1..dab8fba93a1 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -62,6 +62,7 @@ typedef struct UFILE* unicodefile; but otherwise we'll need these substitute definitions */ #ifdef XETEX_MAC +#include <CoreFoundation/CoreFoundation.h> #include <ApplicationServices/ApplicationServices.h> #else typedef int32_t Fixed; diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index 4f0f186bdf4..df72c4e969c 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -36,12 +36,6 @@ authorization from the copyright holders. * additional plain C extensions for XeTeX - MacOS-specific routines */ -#ifdef __POWERPC__ -#define MAC_OS_X_VERSION_MIN_REQUIRED 1030 -#else -#define MAC_OS_X_VERSION_MIN_REQUIRED 1040 -#endif - #define EXTERN extern #include "xetexd.h" @@ -186,9 +180,8 @@ void getGlyphBBoxFromCTFont(CTFontRef font, UInt16 gid, GlyphBBox* bbox) bbox->xMin = bbox->yMin = bbox->xMax = bbox->yMax = 0; else { // convert PS to TeX points and flip y-axis - // TODO: do we need to flip for bounding rect returned by Core Text? - bbox->yMin = -PStoTeXPoints(rect.origin.y + rect.size.height); - bbox->yMax = -PStoTeXPoints(rect.origin.y); + bbox->yMin = PStoTeXPoints(rect.origin.y); + bbox->yMax = PStoTeXPoints(rect.origin.y + rect.size.height); bbox->xMin = PStoTeXPoints(rect.origin.x); bbox->xMax = PStoTeXPoints(rect.origin.x + rect.size.width); } @@ -761,52 +754,27 @@ find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page) page = nPages; CGRect r; -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 - if (&CGPDFDocumentGetPage == NULL) { - switch (pdfBoxType) { - case pdfbox_crop: - default: - r = CGPDFDocumentGetCropBox(document, page); - break; - case pdfbox_media: - r = CGPDFDocumentGetMediaBox(document, page); - break; - case pdfbox_bleed: - r = CGPDFDocumentGetBleedBox(document, page); - break; - case pdfbox_trim: - r = CGPDFDocumentGetTrimBox(document, page); - break; - case pdfbox_art: - r = CGPDFDocumentGetArtBox(document, page); - break; - } - } - else -#endif - { - CGPDFPageRef pageRef = CGPDFDocumentGetPage(document, page); - CGPDFBox boxType; - switch (pdfBoxType) { - case pdfbox_crop: - default: - boxType = kCGPDFCropBox; - break; - case pdfbox_media: - boxType = kCGPDFMediaBox; - break; - case pdfbox_bleed: - boxType = kCGPDFBleedBox; - break; - case pdfbox_trim: - boxType = kCGPDFTrimBox; - break; - case pdfbox_art: - boxType = kCGPDFArtBox; - break; - } - r = CGPDFPageGetBoxRect(pageRef, boxType); + CGPDFPageRef pageRef = CGPDFDocumentGetPage(document, page); + CGPDFBox boxType; + switch (pdfBoxType) { + case pdfbox_crop: + default: + boxType = kCGPDFCropBox; + break; + case pdfbox_media: + boxType = kCGPDFMediaBox; + break; + case pdfbox_bleed: + boxType = kCGPDFBleedBox; + break; + case pdfbox_trim: + boxType = kCGPDFTrimBox; + break; + case pdfbox_art: + boxType = kCGPDFArtBox; + break; } + r = CGPDFPageGetBoxRect(pageRef, boxType); bounds->x = r.origin.x * 72.27 / 72.0; bounds->y = r.origin.y * 72.27 / 72.0; diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am index eef92eb9a09..7a9c190f789 100644 --- a/Build/source/texk/web2c/xetexdir/am/xetex.am +++ b/Build/source/texk/web2c/xetexdir/am/xetex.am @@ -184,5 +184,5 @@ endif XETEX ## Not used ## -EXTRA_DIST += xetexdir/COPYING +EXTRA_DIST += xetexdir/COPYING xetexdir/xewebmac.tex diff --git a/Build/source/texk/web2c/xetexdir/xetexwebmac.tex b/Build/source/texk/web2c/xetexdir/xewebmac.tex index 771d58df240..771d58df240 100644 --- a/Build/source/texk/web2c/xetexdir/xetexwebmac.tex +++ b/Build/source/texk/web2c/xetexdir/xewebmac.tex |