| | 312 | ATSUFontID fontIDs[fontCount]; |
|---|
| | 313 | ItemCount arraySize = fontCount; |
|---|
| | 314 | ATSUGetFontIDs(fontIDs, arraySize, &fontCount); |
|---|
| | 315 | |
|---|
| | 316 | // I do not want to call ATSUFindFontName twice |
|---|
| | 317 | // so I make the buffer large enough. |
|---|
| | 318 | ByteCount len; |
|---|
| | 319 | ItemCount x, index; |
|---|
| | 320 | const ByteCount kBufLength = 1024; |
|---|
| | 321 | char buf[kBufLength]; |
|---|
| | 322 | |
|---|
| | 323 | for (x = 0; x < fontCount; x++) { |
|---|
| | 324 | |
|---|
| | 325 | ATSUFindFontName(fontIDs[x], kFontFamilyName, kFontMicrosoftPlatform, kFontNoScript, kFontNoLanguage, kBufLength, buf, &len, &index); |
|---|
| | 326 | |
|---|
| | 327 | CFStringRef fname = CFStringCreateWithBytes(NULL,(UInt8 *) buf, len, kCFStringEncodingUnicode, false); |
|---|
| | 328 | if ([name caseInsensitiveCompare:(NSString *) fname] == NSOrderedSame) { |
|---|
| | 329 | font = fontIDs[x]; |
|---|
| | 330 | break; |
|---|
| | 331 | } |
|---|
| | 332 | |
|---|
| | 333 | } |
|---|