mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 18:08:03 +02:00
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:
parent
5584bf755c
commit
fcb0a8ef36
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue