diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-04-01 17:09:51 +0000 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2013-04-01 17:09:51 +0000 |
commit | a3bce7ae198c593453ec374e55c5f43c8cf7800c (patch) | |
tree | 3e7613ce06119a9e1d8eb76eaf313bdbc57b0ff5 /Build/source/texk/web2c | |
parent | 933cc495359069e85180dca97e504080315ef8ec (diff) |
XeTeX updates
git-svn-id: svn://tug.org/texlive/trunk@29587 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index fca095e2b36..02fdc428c05 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -143,6 +143,7 @@ DoAATLayout(void* p, int justify) CTRunRef run = CFArrayGetValueAtIndex(glyphRuns, i); CFIndex count = CTRunGetGlyphCount(run); CFDictionaryRef runAttributes = CTRunGetAttributes(run); + CFBooleanRef vertical = CFDictionaryGetValue(runAttributes, kCTVerticalFormsAttributeName); // TODO(jjgod): Avoid unnecessary allocation with CTRunGetFoosPtr(). CGGlyph* glyphs = (CGGlyph*) xmalloc(count * sizeof(CGGlyph)); CGPoint* positions = (CGPoint*) xmalloc(count * sizeof(CGPoint)); @@ -158,14 +159,25 @@ DoAATLayout(void* p, int justify) // of the resulting run is not the same font we asked for, use // the glyph at index 0 (usually .notdef) instead or we will be // showing garbage or even invalid glyphs - if (fontFromAttributes(attributes) != fontFromAttributes(runAttributes)) + char *ps_name1 = getNameFromCTFont(fontFromAttributes(attributes), kCTFontPostScriptNameKey); + char *ps_name2 = getNameFromCTFont(fontFromAttributes(runAttributes), kCTFontPostScriptNameKey); + if (strcmp(ps_name1, ps_name2) != 0) glyphIDs[totalGlyphCount] = 0; else glyphIDs[totalGlyphCount] = glyphs[j]; - locations[totalGlyphCount].x = FixedPStoTeXPoints(positions[j].x); - // XXX trasformation matrix changes y positions! - //locations[totalGlyphCount].y = FixedPStoTeXPoints(positions[j].y); - locations[totalGlyphCount].y = 0; + + // Swap X and Y when doing vertical layout + if (vertical == kCFBooleanTrue) { + locations[totalGlyphCount].x = FixedPStoTeXPoints(-positions[j].y); + // XXX trasformation matrix changes y positions! + //locations[totalGlyphCount].y = FixedPStoTeXPoints(-positions[j].x); + locations[totalGlyphCount].y = 0; + } else { + locations[totalGlyphCount].x = FixedPStoTeXPoints(positions[j].x); + // XXX trasformation matrix changes y positions! + //locations[totalGlyphCount].y = FixedPStoTeXPoints(positions[j].y); + locations[totalGlyphCount].y = 0; + } glyphAdvances[totalGlyphCount] = advances[j].width; totalGlyphCount++; } @@ -537,6 +549,8 @@ loadAATfont(CTFontDescriptorRef descriptor, integer scaled_size, const char* cp1 CGFloat ctSize; CFMutableDictionaryRef stringAttributes, attributes; CGAffineTransform matrix; + CFMutableArrayRef cascadeList; + CTFontDescriptorRef lastResort; double tracking = 0.0; float extend = 1.0; float slant = 0.0; @@ -771,9 +785,8 @@ loadAATfont(CTFontDescriptorRef descriptor, integer scaled_size, const char* cp1 // Disable Core Text font fallback (cascading) with only the last resort font // in the cascade list. - CFMutableArrayRef cascadeList = CFArrayCreateMutable(NULL, 1, &kCFTypeArrayCallBacks); cascadeList = CFArrayCreateMutable(NULL, 1, &kCFTypeArrayCallBacks); - CTFontDescriptorRef lastResort = CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0); + lastResort = CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0); CFArrayAppendValue(cascadeList, lastResort); CFRelease(lastResort); CFDictionaryAddValue(attributes, kCTFontCascadeListAttribute, cascadeList); |