From 25316b29d1bb45dfef788cc380f2f14275699f6b Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Sun, 27 Dec 2015 10:25:41 -0500 Subject: [PATCH] Restore 10.6 support --- src/MacVim/MMCoreTextView.m | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m index bb4edf9463..5bd76d63d9 100644 --- a/src/MacVim/MMCoreTextView.m +++ b/src/MacVim/MMCoreTextView.m @@ -44,6 +44,23 @@ #define DRAW_CURSOR 0x20 #define DRAW_WIDE 0x40 /* draw wide text */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 + +#define kCTFontOrientationDefault kCTFontDefaultOrientation + + static void +CTFontDrawGlyphs(CTFontRef fontRef, const CGGlyph glyphs[], + const CGPoint positions[], UniCharCount count, + CGContextRef context) +{ + CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL); + CGContextSetFont(context, cgFontRef); + CGContextShowGlyphsAtPositions(context, glyphs, positions, count); + CGFontRelease(cgFontRef); +} + +#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 + @interface MMCoreTextView (Private) - (MMWindowController *)windowController; - (MMVimController *)vimController; @@ -1128,7 +1145,8 @@ ligatureGlyphsForChars(const unichar *chars, CGGlyph *glyphs, #define fless(a, b)((a) - (b) < FLT_EPSILON) && (fabs((a) - (b)) > FLT_EPSILON) CFIndex skip = 0; - for (CFIndex i = 0; i < offset && skip + i < length; ++i) { + CFIndex i; + for (i = 0; i < offset && skip + i < length; ++i) { memcpy(&positions[i], &refPositions[skip + i], sizeof(CGSize)); if (fequal(ligatureRanges[i].width, regularRanges[skip + i].width)) {