Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Diff by mike ( 18 years ago )
Index: Subtitles/SubATSUIRenderer.m
===================================================================
--- Subtitles/SubATSUIRenderer.m (revision 866)
+++ Subtitles/SubATSUIRenderer.m (working copy)
@@ -320,21 +320,19 @@
ItemCount arraySize = fontCount;
ATSUGetFontIDs(fontIDs, arraySize, &fontCount);
- // I do not want to call ATSUFindFontName twice
- // so I make the buffer large enough.
- ByteCount len;
- ItemCount x, index;
- const ByteCount kBufLength = 1024/sizeof(unichar);
- unichar buf[kBufLength];
-
+ ItemCount x;
+ CFStringRef fname;
+
for (x = 0; x < fontCount; x++) {
- ATSUFindFontName(fontIDs[x], kFontFamilyName, kFontMicrosoftPlatform, kFontNoScript, kFontNoLanguage, kBufLength, (Ptr)buf, &len, &index);
- NSString *fname = [NSString stringWithCharacters:buf length:len/sizeof(unichar)];
- if ([name caseInsensitiveCompare:fname] == NSOrderedSame) {
+ ATSFontGetName(fontIDs[x], kATSOptionFlagsDefault, &fname);
+
+ if ([name caseInsensitiveCompare:(NSString *)fname] == NSOrderedSame) {
font = fontIDs[x];
break;
}
+
+ CFRelease(fname);
}
if (font == kATSUInvalidFontID) font = ATSFontFindFromName((CFStringRef)@"Helvetica",kATSOptionFlagsDefault); // final fallback
Revise this Paste