• 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
Re: Changing font size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing font size


  • Subject: Re: Changing font size
  • From: Alastair Houghton <email@hidden>
  • Date: Thu, 11 Dec 2003 14:24:50 +0000

On 11 Dec 2003, at 13:21, John Timmer wrote:

> I'd like to have a single base font that's used to draw strings at
> different
> sizes, depending on context. As such, it seems simplest to save a
> single
> font in user defaults, and resize that according to where I need it.
>
> The problem is that there seems to be no straightforward way to go
> about
> doing this.

The usual method to do things like this is to archive the object into
an NSData (using NSArchiver or NSKeyedArchiver), then store that in
user defaults. When you want to retrieve it, get the NSData back from
user defaults and unarchive the object (using NSUnarchiver or
NSKeyedUnarchiver as appropriate).

This, of course, requires the object to support coding, so before doing
it with any given object you need to make sure that it has adopted the
NSCoding protocol. NSFont supports NSCoding, so this technique will
work just fine.

Kind regards,

Alastair.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: Changing font size
      • From: John Timmer <email@hidden>
References: 
 >Changing font size (From: John Timmer <email@hidden>)

  • Prev by Date: Re: Changing font size
  • Next by Date: Re: reading XML in Cocoa ?
  • Previous by thread: Re: Changing font size
  • Next by thread: Re: Changing font size
  • Index(es):
    • Date
    • Thread