# [luatex] glyph_nodes / character id instead of unicode value

Hans Hagen j.hagen at xs4all.nl
Wed Feb 5 14:40:07 CET 2020

```On 2/4/2020 4:18 PM, Patrick Gundlach wrote:

> so far (at least if I understand my own code correctly), I create glyph nodes and insert unicode values into the char field to get the desired output. Can I put glyph ids there instead? Do I need to specify something somewhere else?
In e.g. pdftex (8 bit font engine) the char index actually is the index
in a font, although you can cheat a bit by using an encoding vector in
the backend. This is why in the 8 bit engines one speaks of font
encoding, etc. The char field is then also related to the hyphenation
mechanism (patterns).

In luatex it is entirely up to you what use the field for. If you use 8
bit fonts, then they can be indexed (as in pdftex), but normally you
will consider them unicode slots. They are just numbers. When using the
built in font handler, they can be indices or whetever goes into the
font's character table, where each entry can also have an index field
that then maps into the glyph indices vector of a font. Of course when
you replace some character (maybe using lua) then the reference can be
something else than unicode.

So, for the frontend it's just numbers, for the backend end it depends
on the presence of an index field or when you use t1 fonts the mapping
in the encoding vector. The backend also looks at an optional tounicode
field.

So, one answer can be: it's anything you like it to be.

In traditional tex there was a distinction between chartacter and glyphs
nodes, in luatex it's all glyphs. The subtype can be (and used when you
leave all to tex) used to flag such a node as being processed (by the
lig / kern handlers), for instance in order to prevent duplicate
processing.

Hans

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