Font matching
Font matching
- Subject: Font matching
- From: Gideon King <email@hidden>
- Date: Sat, 4 Jul 2009 10:13:33 +1000
Hi, I have an application where I need to be able to find the closest
equivalent font should a font be missing. e.g. someone creates a file
and sends it to someone else, who doesn't have the font that was used
to create the original file installed on their system.
I thought that maybe saving the NSFontDescriptor in the file should be
able to allow me to find the best font using the
matchingFontDescriptorsWithMandatoryKeys method passing nil as the
mandatory keys, but I have no idea what it would do if the font was
either there or missing:
- if the font was there, would it return just one font descriptor, or
potentially multiple?
- if it was able to be exactly matched, is there some way of knowing
this (e.g. is isEqual: implemented on NSFontDescriptor?)
- if the font is not there, will it continue to fall back until it
finds a suitable font? If so, will it return only one item in the
array? What does it try to match in the algorithm?
- if it does return multiple descriptors, are they ordered so that I
know which one is considered the best match?
- if I pass in nil as the mandatory keys, will it *always* return at
least one descriptor?
Now sometimes my file is edited by someone using windoze, and the font
name doesn't exactly match what you see on the Mac even though it is
essentially the same font and usually the name of one is a substring
of the other. Is there an elegant way to handle this?
Thanks
Gideon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden