freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Mac language ID


From: Masatake YAMATO
Subject: Re: [Devel] Mac language ID
Date: Sun, 14 Dec 2003 17:16:15 +0900 (JST)

> Hello!
> 
> If I understand the OpenType specs correct, my application needs to know
> the mac language ID of a given cmap to be able to display the exact type
> of encoding. The charset_id and encoding_id are all the same (mac roman)
> for many cmaps of an existing font from a MacOS8.1 install CD I have here.
> 
> It seems there exists no API to query the mac language ID, can that be
> added?

I'm very interested in this issue.

As you wrote there is no language ID field in FT_CharMapRec.

  typedef struct  FT_CharMapRec_
  {
    FT_Face      face;
    FT_Encoding  encoding;
    FT_UShort    platform_id;
    FT_UShort    encoding_id;

  } FT_CharMapRec;

However, language IDs are defined in freetype/ttnameid.h:

    #define TT_MAC_LANGID_ENGLISH                       0
    #define TT_MAC_LANGID_FRENCH                        1
    #define TT_MAC_LANGID_GERMAN                        2
    ...


If we are permited to add language_id field to FT_CharMapRec_,
src/sfnt/ttcmap0.c::tt_cmap_init is the good place to add language_id
loader.

  FT_CALLBACK_DEF( FT_Error )
  tt_cmap_init( TT_CMap   cmap,
                FT_Byte*  table )
  {
    cmap->data = table;
    /* Here */
    return 0;
  }

If we are not permited to add language_id field to FT_CharMapRec_ because
the addtion breaks binary compatibility(or something other reason), we have 
to add the language_id to TT_CMap.

  typedef struct  TT_CMapRec_
  {
    FT_CMapRec  cmap;
    /* here */
    FT_Byte*    data;           /* pointer to in-memory cmap table */
  } TT_CMapRec, *TT_CMap;

In this case we have to consider about the filed accessor because the
TT_CMapRec is sfnt private.

If FreeType maintainers show us a direction, I would like to implement.

Masatake YAMATO



reply via email to

[Prev in Thread] Current Thread [Next in Thread]