Correction of '_cairo_quartz_ucs4_to_index'.

Clerk Ma <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAA+mJ_0nry3C7XGQRPykg3nfxBGVMBjzjvr48HeyMkc+7pyaVQ@mail.gmail.com>
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];
}
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.