From 1d4412cd77807223a33c0f6cd0aee0568e7e0e44 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Tue, 14 Nov 2006 08:22:19 +0000 Subject: [PATCH] [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if CGContextShowGlyphsWithAdvances is available. --- src/macterm.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/macterm.c b/src/macterm.c index 97a87cd3d3a..e36fafa2740 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -1360,20 +1360,31 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold) CGContextSetShouldAntialias (context, false); #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 - CGContextSetTextPosition (context, gx, gy); - CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); - if (overstrike_p) +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 + if (CGContextShowGlyphsWithAdvances != NULL) +#endif { - CGContextSetTextPosition (context, gx + 1.0f, gy); + CGContextSetTextPosition (context, gx, gy); CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); + if (overstrike_p) + { + CGContextSetTextPosition (context, gx + 1.0f, gy); + CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); + } } -#else - for (i = 0; i < nchars; i++) +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 + else +#endif +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 { - CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1); - if (overstrike_p) - CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1); - gx += advances[i].width; + for (i = 0; i < nchars; i++) + { + CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1); + if (overstrike_p) + CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1); + gx += advances[i].width; + } } #endif #if USE_CG_DRAWING -- 2.39.2