freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] glyph_names


From: David Turner
Subject: Re: [Devel] glyph_names
Date: Tue, 09 Oct 2001 23:12:48 +0200

Hi Wolfgang,

Wolfgang Domröse a écrit :
> 
> Hi,
> 
> until now I use standard_glyph_names-table to get glyph_names for several 
> encoding-tables as in:
> >
> >char* adobeSTD_GlyphName(charcode)
> >       unsigned short charcode;
> >{
> >return (char *) standard_glyph_names[t1_standard_encoding[charcode]+31 ];
> >}
> 
> and in a similar way:
> >char* appleEXP_GlyphName(unsigned short charcode);
> >char* appleROM_GlyphName(unsigned short charcode);
> >char* winANSI_GlyphName(unsigned short charcode);
> 
> Now you changed the table. It is now called ps_glyph_names and is looking 
> different. The only difference I see: in standard_glyph_names "space" had the 
> position 32, it now has the position 6. So I could easily change the formula 
> to ...+5 instead of ...+31. Is that correct?
>
Yes, but you'd better not use a hard-coded offset in your code.
Actually, you should use "sid_glyph_names" instead, as in:

  const char*  adobeSTD_GlyphName( unsigned short  charcode )
  {
    return  charcode >= 256 ? ".notdef"
                            : sid_glyph_names[ t1_standard_encoding[ charcode ] 
];
  }
 
  const char*  adobeEXP_GlyphName( unsigned short  charcode )
  {
    return  charcode >= 256 ? ".notdef"
                            : sid_glyph_names[ t1_expert_encoding[ charcode ] ];
  }

for the Apple encoding, you should use "ps_glyph_names" specifically

  const char*  appleROM_GlyphName( unsigned short  charcode )
  {
    return  charccode >= 256 ? ".notdef"
                             : ps_glyph_names[ mac_standard_names[ charcode ] ];
  }

note that I have no idea how you would implement winANSI_GlyphName correctly
with only the tables provided within pstables.h


Regards,

- David

PS:
  A more technical explanation:

    ps_glyph_names is a table containing _all_ glyph names used
    by the following "glyph lists":

         - the Macintosh standard Roman glyph names
         - the Adobe Standard Encoding
         - the Adobe Expert Encoding
         - the Adobe Glyph List

    however, glyph names in this table are ordered in a special
    way:

      - first, all glyphs from the Macintosh standard Roman
        glyph list that are _not_ in the Adobe Glyph List

      - then, all glyphs of the defined in Annex A of the CFF
        specification ("Standard String" ordered in SID sequence).
        Actually, you'll notice a few fake "glyph names" like
        "Regular" in there..

      - then, all other glyph names of the Adobe Glyph List that
        were not in the Mac or SID lists..

    there are 5 glyph names in the "Mac" section of "ps_glyph_names",
    which is why "sid_standard_names" is just a macro for "ps_glyph_names+5"


    the "t1_standard_encoding" and "t1_expert_encoding" tables map character
    codes to SID values, i.e. indices within "sid_standard_names".

    the "mac_standard_names" table maps character codes to indices
    within the "ps_glyph_names" table..



reply via email to

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