1 Reply Latest reply on Nov 23, 2009 4:43 PM by [Jongware]

    Smallcap appear in Glyphs

    Shonkyin Level 3

      Hi All,


      Can i know that font have smallcap in glyphs or not with script.


      Please suggest code if possible in javascript.




        • 1. Re: Smallcap appear in Glyphs
          [Jongware] Most Valuable Participant

          Javascript doesn't have that kind of access to fonts. To get to a font's internal representation, you need to read individual bytes from the font, and parse them yourself (as I showed on InDesignSecrets to get the number of characters in a font, much to the bewilderment of David Blatner).


          However, to get the actual glyph indexes used by small caps, you have to parse a lot -- from the top of my head, find the GSUB table for the current language; find out if it has a smcp entry; locate the entry; parse individual substitutions until you either find the character code you wanted [*], or reach the end of the table. You might want to start by reading up on the internal representation of OTF fonts, elsewhere on the Adobe site (and some info scattered about on Microsoft/Typography).


          [*] There is actually another layer of abstraction. Character codes -- such as 'lowercase a' -- are mapped separately into glyphs, in the cmap section of OpenType fonts. GSUB tables work exclusively with glyph-to-glyph translations. So the correct order would be: (1) find the glyph index representing your current character; (2) find that glyph in the GSUB smcp table; (3) check what glyph it translates to.

          1 person found this helpful