Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the correct way to Embed Fonts with Unicode names?




On Oct 30, 2007, at 6:31 AM, Sam <email@hidden> wrote:

Actually I wanted to give the user option of selecting a name for this font.
So the user may choose a name which is a mixture of Japanese/ Chinese/English
letters, say. But now, from your these words I infer that such a feature is
impossible with FOND resources. Am I right? I can only give a name of
specific Mac encoding only.


If you need
to deal with Unicode fonts and font names, I suggest you move away
from Quickdraw, and I would suggest you use the Font panel instead of
CreateStandardFontMenu.

Sorry, at least for this version I have to deal with Quickdraw only :-(.

I have to agree with Sam on this one. The font panel is an attempt to have a "be-all do-all" for fonts in the system. It works for a small number of applications, but there are quite a few that need capabilities that are beyond what the font panel offers. The case in point of an asian system is perhaps the best example. The eastern asian languages require the use of both latin and local fonts (Japanese, Korean, etc), and the fonts should be displayed in their own language at the same time. We see applications such as Word doing this with a pair of font menus, one in latin, the other the local language(s).


This is actually not very difficult to do once you understand the nature of the font files and how to access the info. As they say the devil is in the details. Fonts have name strings that contain all sorts of information, including the various names given to the font in whatever language the font creator wanted to use. The names are encoded in one of about three ways: Mac, Microsoft, Unicode. Mac encoding is almost always in 8 bit Mac Roman, while the other two use Unicode strings. The trick is to figure out which string to use and to get it into a form where it can be displayed. Once this is done you can display the font any way you wish, including using itself as the display font. It is _far_ easier to display the font name using Unicode (ATSUI is amazingly easy to use once you figure it out). You really don't want to use Quickdraw for displaying the font name, it's just too much of a pain to back-convert the font to something Quickdraw can use.




I can see TextEncoding information available in the FontFamilyRef
(FMGetFontFamilyTextEncoding). But I may be embedding any of the
available fonts with a Unicode name. Thank you for any help.

This is the encoding of the font based on the FOND resource ID and generally has nothing to do with names that may come from the font name table. However, it does provide the system with the encoding of the family name (from FOND resource ID) which is used with the font menu. If this is not correct, then the encoding in the menu will likely be wrong.

The script code is encoded in the FOND resource ID via the follow:

scriptCode = ((resourceID - 16384) / 512) + 1;

Please refer to Inside Mac: Text page B-6 as a reference.


Forget about using the FOND information. It simply is not available in many fonts, especially asian ones. This is a problem that will take a lot of digging, and more than a bit of work, but it is readily solvable. The ATSUI Font guide/reference is definitely your friend on this one...


- Jack Brindle
------------------------------------------------------------------------ ---------------------



_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.