• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to get NSFont instance from classic Font ID?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: How to get NSFont instance from classic Font ID?
      • From: Andrew Thompson <email@hidden>
  • Prev by Date: Re: Newbie question: forcing data format during saveDocumentTo:
  • Next by Date: NSFileManager and directories
  • Previous by thread: Undoing in an NSTextView
  • Next by thread: Re: How to get NSFont instance from classic Font ID?
  • Index(es):
    • Date
    • Thread