I have tried out one of your methods ( to be specific , it is
choice (b) ).
Again I have tried it for the Korean language.
The result is still the same . I still get the names of fonts in
For example lets consider "Apple Gothic". The conversion here
This is correct; the "Korean" localized name of the font is
You can dump the 'name' table of the font using ftxdumperfuser (from
the Apple font tools suite, see http://developer.apple.com/fonts) to
see exactly what is there. Here's an excerpt from the 'name' table in
From this, it's clear that the only Family name you'll ever get is
"AppleGothic". The family name has not been translated; the string
tagged with script ID 3, language ID 23 [Korean] is still
"AppleGothic". The style name "Regular", on the other hand, has been
translated, so if you were fetching that name, you should see Korean
Another observation is that for some of the fonts, it returns an
stating that the output buffer is full. Though the length is
smaller than 2048 ( that I have allocated by default) , I still
You mean you get a buffer full error from ATSUGetIndFontName? I don't
know why this is. Can you give a specific example of a font and name
ID where this happens?
Any input on these issues?
The following code details my implementation of the solution.
// Get the count of names.
I am developing an application that supports East-Asian
There is a requirement that the font names should be displayed in
language of the current locale . That is if the system is currently
using the Korean locale , the names of fonts should be displayed in
Is this the right method to procure the localized name of the font?
what would be the prescribed method?
(a) Try a series of ATSUFindFontName calls, starting with the
platform/script/language codes that most closely match the locale you
want, and falling back to other options if the name is not found.
Take the first one that actually returns a result; and then if the
platform was Unicode, you can use kCFStringEncodingUnicode in the
CFStringCreateWithBytes call, but if it was a Mac OS encoding, you'll
need to create an appropriate TextEncoding (same as CFStringEncoding)
value to pass. You can use ATSUGetIndFontName with the fontNameIndex
from FindFont in order to retrieve the actual script and language
codes to use in making the TextEncoding, if you didn't find a name
with your preferred language and had to resort to kFontNoLanguage to
get a result.
(b) Alternatively, instead of calling ATSUFindFontName with various
parameters until it returns a name you can use, try iterating over
all the font names with ATSUGetIndFontName. Convert the non-Unicode
ones to Unicode (using TextEncoding values based on the platform/
script/language from ATSUGetIndFontName). Skip those that don't match
the name ID you want (kFontFamilyName, in this case). Of those that
do match, compare their language/script with the preferred locale to
choose the best match.
It's all a bit of a pain, to be honest. File a bug requesting
"ATSGetFontNameForCurrentLocale" or similar!
Robosoft Technologies - Partners in Product Development
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden