Check for conversion error in Core Text renderer

Original patch by Kazuki Sakamoto.
This commit is contained in:
Bjorn Winckler
2010-12-10 19:37:19 +01:00
parent 29697da99f
commit c42b133098
+4
View File
@@ -927,6 +927,10 @@ defaultAdvanceForFont(CTFontRef fontRef)
// Convert UTF-8 chars to UTF-16
CFStringRef sref = CFStringCreateWithBytesNoCopy(NULL, s, len,
kCFStringEncodingUTF8, false, kCFAllocatorNull);
if (sref == NULL) {
ASLogWarn(@"Conversion error: some text may not be rendered");
continue;
}
CFIndex unilength = CFStringGetLength(sref);
const UniChar *unichars = CFStringGetCharactersPtr(sref);
UniChar *buffer = NULL;