diff options
author | Andrea Canciani <ranma42@gmail.com> | 2017-03-18 10:20:07 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2017-04-25 18:06:14 +0200 |
commit | fcb0a8ef36c9a84f586d38bd409d6a0e881890a7 (patch) | |
tree | 10c9d89a46d0a851d4bd58c5be72ceb5c4789d96 /src/cairo-quartz-font.c | |
parent | 5584bf755c98703653eef06670abaeb4873f9ee5 (diff) | |
download | cairo-fcb0a8ef36c9a84f586d38bd409d6a0e881890a7.tar.gz |
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>
Diffstat (limited to 'src/cairo-quartz-font.c')
-rw-r--r-- | src/cairo-quartz-font.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c index 897b2d01a..34ae87e7c 100644 --- a/src/cairo-quartz-font.c +++ b/src/cairo-quartz-font.c @@ -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 |