#ifdef __APPLE__ #include #else #include #include #if 0 NSRange CFRangeMake(NSUInteger loc, NSUInteger len) { return NSMakeRange(loc, len); } #endif #endif #import void dumpFontDescriptorInfo(CTFontDescriptorRef descriptor) { printf("Dumping font descriptor info for %p\n", descriptor); NSLog(@"Attribute dictionary: %@", [CTFontDescriptorCopyAttributes(descriptor) autorelease]); NSArray *allAttributes = [NSArray arrayWithObjects: kCTFontURLAttribute, kCTFontNameAttribute, kCTFontDisplayNameAttribute, kCTFontFamilyNameAttribute, kCTFontStyleNameAttribute, kCTFontTraitsAttribute, kCTFontVariationAttribute, kCTFontSizeAttribute, kCTFontMatrixAttribute, kCTFontCascadeListAttribute, kCTFontCharacterSetAttribute, kCTFontLanguagesAttribute, kCTFontBaselineAdjustAttribute, kCTFontMacintoshEncodingsAttribute, kCTFontFeaturesAttribute, kCTFontFeatureSettingsAttribute, kCTFontFixedAdvanceAttribute, kCTFontOrientationAttribute, kCTFontEnabledAttribute, kCTFontFormatAttribute, kCTFontRegistrationScopeAttribute, kCTFontPriorityAttribute, nil]; NSLog(@"Attributes fetched via CTFontDescriptorCopyAttribute:"); NSEnumerator *attribEnumerator = [allAttributes objectEnumerator]; NSString *attrib; while (attrib = [attribEnumerator nextObject]) { NSLog(@"Value for '%@': %@", attrib, [CTFontDescriptorCopyAttribute(descriptor, (CFStringRef)attrib) autorelease]); } } void dumpFontInfo(CTFontRef font) { printf("Dumping font info for %p\n", font); /* Glyphs */ CFIndex glyphs = CTFontGetGlyphCount(font); for (CGGlyph i=0; i