-#if USE_CT_GLYPH_INFO
- return mac_ctfont_get_glyph_for_cid ((CTFontRef) font, collection, cid);
-#else
- {
- CGGlyph result = kCGFontIndexInvalid;
- NSFont *nsFont = (NSFont *) font;
- unichar characters[] = {0xfffd};
- NSString *string =
- [NSString stringWithCharacters:characters
- length:ARRAYELTS (characters)];
- NSGlyphInfo *glyphInfo =
- [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid
- collection:collection
- baseString:string];
- NSDictionary *attributes =
- [NSDictionary dictionaryWithObjectsAndKeys:nsFont,NSFontAttributeName,
- glyphInfo,NSGlyphInfoAttributeName,nil];
- NSTextStorage *textStorage =
- [[NSTextStorage alloc] initWithString:string
- attributes:attributes];
- NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
- NSTextContainer *textContainer = [[NSTextContainer alloc] init];
- NSFont *fontInTextStorage;
-
- [layoutManager addTextContainer:textContainer];
- [textContainer release];
- [textStorage addLayoutManager:layoutManager];
- [layoutManager release];
-
- /* Force layout. */
- (void) [layoutManager glyphRangeForTextContainer:textContainer];
-
- fontInTextStorage = [textStorage attribute:NSFontAttributeName atIndex:0
- effectiveRange:NULL];
- if (fontInTextStorage == nsFont
- || [[fontInTextStorage fontName] isEqualToString:[nsFont fontName]])
- {
- NSGlyph glyph = [layoutManager glyphAtIndex:0];
+ CGGlyph result = kCGFontIndexInvalid;
+ NSFont *nsFont = (NSFont *) font;
+ unichar characters[] = {0xfffd};
+ NSString *string =
+ [NSString stringWithCharacters:characters
+ length:ARRAYELTS (characters)];
+ NSGlyphInfo *glyphInfo =
+ [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid
+ collection:collection
+ baseString:string];
+ NSDictionary *attributes =
+ [NSDictionary dictionaryWithObjectsAndKeys:nsFont,NSFontAttributeName,
+ glyphInfo,NSGlyphInfoAttributeName,nil];
+ NSTextStorage *textStorage =
+ [[NSTextStorage alloc] initWithString:string
+ attributes:attributes];
+ NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
+ NSTextContainer *textContainer = [[NSTextContainer alloc] init];
+ NSFont *fontInTextStorage;