From 1b3011c27df531875d432e909ae6b77f115c5017 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 12 Aug 2014 19:17:19 -0400 Subject: [PATCH] [coretext] Pass buffer language to CoreText --- src/hb-coretext.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 53adc815e..06e001ce3 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -698,6 +698,18 @@ retry: CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), kCTVerticalFormsAttributeName, kCFBooleanTrue); } + if (buffer->props.language) + { + CFStringRef lang = CFStringCreateWithCStringNoCopy (kCFAllocatorDefault, + hb_language_to_string (buffer->props.language), + kCFStringEncodingUTF8, + kCFAllocatorNull); + if (unlikely (!lang)) + FAIL ("CFStringCreateWithCStringNoCopy failed"); + CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), + kCTLanguageAttributeName, lang); + CFRelease (lang); + } CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), kCTFontAttributeName, font_data->ct_font);