quartz-font: Correct handling of SMP Unicode characters

Truncating the UCS4 representation to 16 bits only works for the Basic
Multilingual Plane, the other characters must be translated to a
surrogate pair.

Fixes smp-glyph.

Reported-by: Clerk Ma <clerkma@gmail.com>
This commit is contained in:
Andrea Canciani 2017-03-18 10:20:07 +01:00
parent 5584bf755c
commit fcb0a8ef36

View file

@ -766,12 +766,13 @@ _cairo_quartz_ucs4_to_index (void *abstract_font,
{
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);
UniChar u = (UniChar) ucs4;
CGGlyph glyph;
CGGlyph glyph[2];
UniChar utf16[2];
CGFontGetGlyphsForUnicharsPtr (ffont->cgFont, &u, &glyph, 1);
int len = _cairo_ucs4_to_utf16 (ucs4, utf16);
CGFontGetGlyphsForUnicharsPtr (ffont->cgFont, utf16, glyph, len);
return glyph;
return glyph[0];
}
static cairo_int_status_t