From e1026a2252151d5a0c9b14f961a9d80859e4d52a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 15 Oct 2024 14:05:39 -0600 Subject: [PATCH] [coretext-font] Implement get_variation_glyph() Not sure if I got it right, but *seems* to work. --- src/hb-coretext-font.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/hb-coretext-font.cc b/src/hb-coretext-font.cc index e367300ad..d6a0dd737 100644 --- a/src/hb-coretext-font.cc +++ b/src/hb-coretext-font.cc @@ -107,8 +107,18 @@ hb_coretext_get_variation_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - // TODO. How? - return false; + CTFontRef ct_font = (CTFontRef) font_data; + + UniChar ch[2] = { unicode, variation_selector }; + CGGlyph cg_glyph[2]; + + CTFontGetGlyphsForCharacters (ct_font, ch, cg_glyph, 2); + + if (cg_glyph[1]) + return false; + + *glyph = cg_glyph[0]; + return true; } static void