Thanks.  That did it.  I just needed a display name.  I used the following
when loading the picker view:

- (NSString*)styleNameForIndex:(NSUInteger)index
inFontFamily:(NSString*)famName {
    NSString* fontName = [[UIFont fontNamesForFamilyName:famName]
objectAtIndex:index];
    CTFontRef fontRef = CTFontCreateWithName((CFStringRef)fontName, 0.0,
NULL);
    CFStringRef style = CTFontCopyName(fontRef, kCTFontStyleNameKey);
    CFRelease(fontRef);
    return [(NSString*)style autorelease];
}

My first shot at a FontPicker subclass of UIPickerView was almost as wide as
the iPad.  After moving to a two-line UILabel and using the short style
names, I've got it slimmed down to being usable on an iPhone.

BTW, general info in case anybody is interested -- If you are going to use
dependent columns in a UIPickerView, the only way I could figure out to do
it is to use a timer to poll it for changes in the primary column so you can
reload the dependent column.


On 4/12/10 5:15 PM, "Kyle Sluder" <kyle.slu...@gmail.com> wrote:

> On Mon, Apr 12, 2010 at 3:08 PM, Gordon Apple <g...@ed4u.com> wrote:
>> Thanks for the response, but that is what I have now and am trying to get
>> away from.  I want ³normal², ³bold² and ³Italic²,  not ³Veranda²,
>> ³Veranda-Bold² and ³Veranda-Italic² for the secondary list.  In many cases
>> it might be possible to strip the font Family name, but the font naming
>> convention is not consistent.  Some even use contractions.  If you look at
>> the font list in Pages on the iPad, it does what I want.
> 
> Ah, in that case you're going to need to do a little bit more work.
> But CTFont does everything you need. Take a look at
> kCTFontStyleNameKey and friends.
> 
> --Kyle Sluder



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to