How to get NSFont instance from classic Font ID?
How to get NSFont instance from classic Font ID?
- Subject: How to get NSFont instance from classic Font ID?
- From: Satoshi Matsumoto <email@hidden>
- Date: Thu, 04 Sep 2003 16:09:47 +0900
Hi, all
I need to convert old Classic documents to Cocoa documents. In Classic
documents, the font informantion are recorded in the font ID and character
size.
I tried to convert classic Font ID to NSFont instance as following...
1) get the family name of oldFontID
FMGetFontFamilyName (oldFontID, str255Name );
2) convert it into unicode nsFontName
nsFontName =[[NSString alloc]
initWithData: [NSData dataWithBytes:&str255Name[0]+1
length:str255Name[0]]
encoding:<default encoding>];
3) get nsFont instance using following NSFontManager method.
nsFont = [[NSFontManager sharedFontManager]
fontWithFamily:nsFontName
traits:0 weight:5
size:charcterSize ];
Above method works for some fonts, but not for every font.
Does anyone know more perfect solution for the classic Font ID conversion?
Satoshi Matsumoto
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.