[cairo] Correction of '_cairo_quartz_ucs4_to_index'.

Clerk Ma clerkma at gmail.com
Wed Mar 15 11:14:37 UTC 2017


I found that '_cairo_quartz_ucs4_to_index' in cairo-quartz-font.c was broken
(ucs4 was cast to uint16_t/UniChar). A workable patch is here:

static unsigned long
_cairo_quartz_ucs4_to_index (void *abstract_font,
                 uint32_t ucs4)
{
    cairo_quartz_scaled_font_t *font = (cairo_quartz_scaled_font_t*)
abstract_font;
    cairo_quartz_font_face_t *ffont = _cairo_quartz_scaled_to_face(font);
    CGGlyph glyph[2];
    UniChar utf16[2];

    size_t len = CFStringGetSurrogatePairForLongCharacter (ucs4, utf16) ? 2 : 1;
    CGFontGetGlyphsForUnicharsPtr (ffont->cgFont, utf16, glyph, len);

    return glyph[0];
}


More information about the cairo mailing list