Re: determining japanese-capable fonts
Re: determining japanese-capable fonts
- Subject: Re: determining japanese-capable fonts
- From: Douglas Davidson <email@hidden>
- Date: Wed, 30 Jan 2002 09:56:26 -0800
On Wednesday, January 30, 2002, at 03:03 AM, Jody Fairchild wrote:
does anyone know a good way to determine whether a given font can
support
the display of japanese characters without substitution?
This question is not entirely well-formed. There are many fonts that
can display some subset of the CJK Unified Han characters; these fonts
may be intended for different purposes. Some of these fonts may be
intended for the display of Japanese-language material, and these fonts
are likely to include characters commonly used in Japan. Some of these
fonts may be intended for the display of Chinese-language material;
either simplified, or traditional, or both. There will probably be a
great deal of overlap, but not complete overlap. There may not
necessarily be any automated means of determining which is which, but
the "most compatible encoding" is a reasonable place to start.
NSString.h has only a partial list of encodings; a much fuller list is
included in CoreFoundation, and all of these encodings are in fact
available to NSString, although they are numbered differently. You can
use the CoreFoundation functions
CFStringConvertNSStringEncodingToEncoding and
CFStringConvertEncodingToNSStringEncoding to convert the NSString
numbering to and from the CFString numbering. If you apply
CFStringConvertNSStringEncodingToEncoding to the examples you give, I
believe you will end up with MacJapanese for Osaka. This makes sense,
because this is a font designed for the display of Japanese-language
material on the Macintosh. However, there are many different encodings
in use in East Asia.
Alternatively, you could take some of the material you are interested in
displaying, place it in an NSTextStorage with the font you are
interested in, and see what fonts it actually ends up with after font
fixing. I believe someone posted some code along these lines recently.
Which way is best depends somewhat on what your purpose is in trying to
determine this.
Douglas Davidson