[cairo] [PATCH] Re: cairo-quartz-font.c: Non-public CGFontGetGlyphPath now deprecated

Simon Cozens simon at simon-cozens.org
Fri Jul 11 07:50:07 PDT 2014

On 11/07/2014 08:16, Andrea Canciani wrote:
> Is this also going to work on 10.4?
> IIRC the CoreText API has been introduced in 10.5, so we should avoid linking it.
>         else
>           quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
>         fi

If you want to remain compatible with 10.4 (about 2% of installs) then yes, we 
should do a separate test for CoreText; my configure-fu is not strong enough 
to separate them.

> An alternative which should also work on 10.4 looks like this: ...
> Assuming the new check in the ensure function, you could do:
> if (CTFontCreateWithGraphicsFontPtr && CTFontCreatePathForGlyphPtr) {
>    CTFontRef ctFont = CTFontCreateWithGraphicsFontPtr (font_face->cgFont);
>    glyphPath = CTFontCreatePathForGlyphPtr (ctFont, glyph, &textMatrix);
>    CFRelease(ctFont);
> } else {
>    glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
> }

Yes, that looks tidier.

> I added CFRelease() because all of the examples of use of CTFont seem to
> release it in this way.

Good catch.

I feel my patch is a bit of a half-way house, though; if we're going to go 
with CT, we should probably be constructing CTFontRefs directly instead of 
going through CoreGraphics. Again it depends how important it is to maintain 
compatibility for older versions.

More information about the cairo mailing list