[NTG-context] Selecting character by glyph index

Hans Hagen pragma at wxs.nl
Mon Aug 18 11:07:52 CEST 2014

On 8/18/2014 7:48 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
> Dear consortium,
>
> Is there a command analogous to \char or \fontchar which allows me to
> select a glyph by its index in the font? In most font editors you can
> choose "Index Mode" which shows the "physical" ordering of the glyphs
> independent of encoding etc.
>
> I thought that \charNN (where 'NN' is a decimal integer) did this, but
> it does not seem to select the correct indexed glyph for a \definefont,
> making me wonder in MkIV has changed its behavior. For example,
> choosing  \char35 gives me glyph index 223, not glyph 35.
>
> In any case, for the current (already tedious) project this is a feature
> that is sorely needed; if there is a way to hack a quick lua-based
> command to do it, I would appreciate any help I can get. Perhaps a
> future version of \fontchar can add this as an option... Thanks in

you cannot trust an index ... use names as these are more stable

\setupbodyfont[dejavu]

\starttext

\fontchar{a}
\fontchar{alpha}
\fontchar{three}
\fontchar{uni1ECB.dotless}
\fontchar{delta}
\fontchar{delta.smcp}

\stoptext

-----------------------------------------------------------------