[NTG-context] Addressing glyphs in Lua

Marco Patzer lists at homerow.info
Wed Oct 10 08:46:58 CEST 2018


On Tue, 9 Oct 2018 23:36:32 +0200
Hans Hagen <j.hagen at xs4all.nl> wrote:

> On 10/9/2018 10:40 PM, Marco Patzer wrote:
> > Hi!
> > 
> > I have two questions regarding addressing glyphs in Lua:
> > 
> > 1) How to address glyphs in slots as e.g. U+F0029?
> > 2) How to address glyphs by name?
> > 
> > Use:
> > 
> > \startluacode
> >    fonts.handlers.otf.addfeature {
> >      name = "foo",
> >      type = "substitution",
> >      data      = { [0xF0029] = 0xF0030 }, -- ← doesn't work
> >    }
> > \stopluacode  
> this is a mnwe .. make a mwe with at least a font

Sorry, here it is:

\startluacode
  fonts.handlers.otf.addfeature {
    name = "phone",
    type = "substitution",
    data      = { [0x260E] = 0xF003A }, --  doens't work
  }
\stopluacode

\definefontfeature [phone] [phone=yes]

\definefallbackfamily [mainface] [serif] [MarVoSym] [range=0x260E,
features=phone] \definefontfamily     [mainface] [serif] [TeX Gyre
Pagella] \setupbodyfont        [mainface]

\starttext
  substitution: \utfchar{"260E} %% black telephone
  \blank direct:
  \resolvedglyphdirect {name:marvosym}{n:Mobilefone} %% works
\stoptext

%% glyph name and slot taken from
%%
%% \usemodule [fnt-10]
%% \starttext
%%   \ShowCompleteFont{name:marvosym}{10pt}{1}
%% \stoptext

> ... anyway, glyph names should normally work (given that they are
> sane ones, because in context we strip some)

The question is how to input the name in the Lua code (here:
“Mobilefone”). And it seems like substitutions don't work beyond
0xFFFF.

Marco


More information about the ntg-context mailing list