[luatex] luaotfload: identifying a glyph if names not available

Alexey Kryukov anagnost at yandex.ru
Thu May 31 16:27:19 CEST 2018


Hi,

a few years ago I wrote a lua script to fix a few problems with
Times New Roman, namely the handling of f-ligatures and the
Unicode mappings for small caps. The script itself is rather small and I
place it in the attachment: as one can see, I used glyph names (not
available in the font itself, but generated by a FontForge algorithm)
to obtain the proper glyphs and correct their properties.

Now, however, FontForge seems to be no longer used, so there are no
glyph names for Times New Roman any more. Basically this means I have
to do all the dirty work myself: for example, if I want to map the small
cap glyph for "A" to lowercase "a", I have to identify the lookups
associated with a 'smcp'/'c2sc' feature, find the mapping for "A" or "a"
and thus get the GID of the small cap glyph. Basically that's exactly
what FontForge does.

However the problem is that I don't understand how I can obtain the
necessary info from the data provided by luaotfload. If I have a look
at times.[lua|tma], I see a list of lookups which look nearly as
follows:

   {
    ["features"]=2070,
    ["flags"]=702,
    ["index"]=27,
    ["name"]="s_s_26",
    ["nofsteps"]=1,
    ["order"]=750,
    ["steps"]={
     {
      ["coverage"]={
       [38]=983999,
       ...
       [7922]=983892,
      },
     },
    },
    ["type"]="gsub_single",
   },

However, how can I determine programmatically this is the 'c2sc' lookup?
There is a "features" key, but I don't understand what does it point
to. On the other hand, there is a "features" dictionary, which maps
feature tags to some numerical values, but, again, I don't understand
their meaning (they even aren't unique for each feature).

So, in general, is there currently a way to find the proper GID for a
substitution glyph which is not mapped to a Unicode value, if glyph
names aren't available too?

-- 
Regards,
Alexey Kryukov <anagnost at yandex dot ru>

Moscow State University
Faculty of History
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tnr.lua
Type: application/octet-stream
Size: 1453 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20180531/9ffa9cf4/attachment.obj>


More information about the luatex mailing list