6bdd276d05
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
68 lines
2.8 KiB
Diff
68 lines
2.8 KiB
Diff
From 9d460070fca2c0a61aac60ba7cad6f9a6af82309 Mon Sep 17 00:00:00 2001
|
|
From: Andrea Canciani <ranma42@gmail.com>
|
|
Date: Tue, 9 Dec 2014 16:13:00 +0100
|
|
Subject: [PATCH] quartz: Remove call to obsolete CGFontGetGlyphPath
|
|
|
|
CGFontGetGlyphPath was not public and is not available anymore on
|
|
modern OSX/iOS systems. The same functionality is available through
|
|
the CoreText API since OSX 10.5.
|
|
|
|
Based on a patch by Simon Cozens.
|
|
|
|
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
|
|
---
|
|
src/cairo-quartz-font.c | 10 ++++------
|
|
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
|
|
index e6a379a..02f3426 100644
|
|
--- a/src/cairo-quartz-font.c
|
|
+++ b/src/cairo-quartz-font.c
|
|
@@ -81,9 +81,6 @@ static void (*CGFontGetGlyphsForUnicharsPtr) (CGFontRef, const UniChar[], const
|
|
static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
|
|
static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
|
|
|
|
-/* Not public in the least bit */
|
|
-static CGPathRef (*CGFontGetGlyphPathPtr) (CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph) = NULL;
|
|
-
|
|
/* CGFontGetHMetrics isn't public, but the other functions are public/present in 10.5 */
|
|
typedef struct {
|
|
int ascent;
|
|
@@ -127,7 +124,6 @@ quartz_font_ensure_symbols(void)
|
|
/* These have the same name in 10.4 and 10.5 */
|
|
CGFontGetUnitsPerEmPtr = dlsym(RTLD_DEFAULT, "CGFontGetUnitsPerEm");
|
|
CGFontGetGlyphAdvancesPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphAdvances");
|
|
- CGFontGetGlyphPathPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphPath");
|
|
|
|
CGFontGetHMetricsPtr = dlsym(RTLD_DEFAULT, "CGFontGetHMetrics");
|
|
CGFontGetAscentPtr = dlsym(RTLD_DEFAULT, "CGFontGetAscent");
|
|
@@ -144,7 +140,6 @@ quartz_font_ensure_symbols(void)
|
|
CGFontGetGlyphsForUnicharsPtr &&
|
|
CGFontGetUnitsPerEmPtr &&
|
|
CGFontGetGlyphAdvancesPtr &&
|
|
- CGFontGetGlyphPathPtr &&
|
|
(CGFontGetHMetricsPtr || (CGFontGetAscentPtr && CGFontGetDescentPtr && CGFontGetLeadingPtr)))
|
|
_cairo_quartz_font_symbols_present = TRUE;
|
|
|
|
@@ -550,6 +545,7 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
|
|
CGGlyph glyph = _cairo_quartz_scaled_glyph_index (scaled_glyph);
|
|
CGAffineTransform textMatrix;
|
|
CGPathRef glyphPath;
|
|
+ CTFontRef ctFont;
|
|
cairo_path_fixed_t *path;
|
|
|
|
if (glyph == INVALID_GLYPH) {
|
|
@@ -564,7 +560,9 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
|
|
-font->base.scale.yy,
|
|
0, 0);
|
|
|
|
- glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
|
|
+ ctFont = CTFontCreateWithGraphicsFont (font_face->cgFont, 1.0, NULL, NULL);
|
|
+ glyphPath = CTFontCreatePathForGlyph (ctFont, glyph, &textMatrix);
|
|
+ CFRelease (ctFont);
|
|
if (!glyphPath)
|
|
return CAIRO_INT_STATUS_UNSUPPORTED;
|
|
|
|
--
|
|
1.9.3 (Apple Git-50)
|