freetype
[Top][All Lists]
Advanced

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

Re: [ft] Glyph name questions


From: Werner LEMBERG
Subject: Re: [ft] Glyph name questions
Date: Sun, 10 Oct 2010 06:26:52 +0200 (CEST)

> - Is the name returned from FT_Get_GlyphName() suitable for use in
>   a PostScript file (ie: glyphshow)?  Including for Unicode glyphs
>   (eg: CJK)?
>
> - What's the difference between FT_HAS_GLYPH_NAMES and
>   FT_Has_PS_Glyph_Names()?  The docs suggest there may be a
>   difference (re: TTF), but its unclear which one is 'better'.  (eg:
>   I have a font that seems to return true for FT_HAS_GLYPH_NAMES,
>   and false for FT_Has_PS_Glyph_Names).

FT_Has_PS_Glyph_Names() indicates two things:

  (a) The font is a PS flavoured font.
  (b) It has glyph names.

For Type 1 and Type 42 fonts, this is always TRUE, and for CFF this is
TRUE if the font is not a CID-keyed font.

On the other hand, FT_HAS_GLYPH_NAMES just indicates that there *are*
glyph names.  However, especially for TTFs, the information is
unreliable since it is descriptive only: TrueType engines don't use
the `post' table but only the cmaps to access glyph indices.

Could you provide a documentation patch for FreeType which makes this
easier to understand?

> - If I'm using FT_Get_GlyphName() to write out a PS file, should I
>   be using FT_Has_PS_Glyph_Names() instead of FT_HAS_GLYPH_NAMES?
>   ie: Is the difference rooted in what you're using it for, or is
>   the difference rooted in the contents of the actual font?

As described above, the difference affects both the intended use and
the contents.

> - What's the difference between ".null" and ".notdef"?  Our code is
>   currently checking for ".notdef", but I seem to be getting mostly
>   ".null" for the glyphs, and I don't want to just naively change
>   the code...

Various PS specifications mandate that there is a fallback glyph to be
used if a glyph isn't contained in the font.  This is the `not
defined' glyph, `.notdef'.  For TTFs, the fallback glyph is the one
with glyph index 0, and it is recommended to name this glyph
`.notdef'.  For (old) Mac fonts, AFAIK, this is mandatory.

On Macs, the `.null' glyph has glyph index 1, it has no contours and
zero advance width.  Microsoft recommends to follow this convention.
Here is an explanation why you need such a glyph (from the MS TTF
specification):

  The mapping of the Carriage Return (CR, 13) depends on whether the
  font is designed to be used left-to-right or right-to-left.  For
  left-to-right (e.g., Roman), it must be mapped to a glyph with no
  contours and positive advance.  For right-to-left (e.g., Hebrew), it
  must be mapped to glyph 1 (null glyph).

> - [Somewhat offtopic] Since apparently it's possible for a TTF to
>   not have glyph names, how can I (and my users) tell whether a
>   given TTF has names or not?  Something in FontForge maybe?
>   ftinfo?  Some other tool?

A TTF has glyph names if the FT_HAS_GLYPH_NAMES flag is set.  However,
there is absolutely no guarantee that the glyph names are `correct' in
the sense that the corresponding character index is what Adobe
recommends or uses.


    Werner



reply via email to

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