Josef-Friedrich / nodetree

LuaTeX package to visualize node lists in a tree view.
https://www.ctan.org/pkg/nodetree
LaTeX Project Public License v1.3c
14 stars 2 forks source link

Incorrect visualization #9

Closed lemzwerg closed 1 year ago

lemzwerg commented 1 year ago

[nodetree 2.2] [LuaTeX, Version 1.15.0 (TeX Live 2022), Development id: 7509]

Consider this input code file foo.texi, to be processed with PDFTEX=luatex texi2pdf foo.texi

\input nodetree.tex

\input texinfo

@set txicodequoteundirected
@set txicodequotebacktick

@NodetreeRegisterCallback{postline}

@t{`foo'} -- @code{`foo'}

@bye

and which produces the following output.

image

On my (UTF-8) GNU/Linux console, I see the following, which doesn't look right partially.

image

lemzwerg commented 1 year ago

If I pipe the output into a file and view it with less, I get the following, which is better.

image

I think that using the term char within a GLYPH object is misleading. In reality, it is just a glyph index, which accidentally might have the same value as the corresponding input character. Not being yet acquainted with luatex internals I guess that char is the name of a field in the GLYPH structure. In that case I suggest that you show something like

GLYPH char: 102 (0x66, 'f')

to emphasize that this is not the input character code. Of course, non-printable ASCII characters must be printed in an alternative form.

Josef-Friedrich commented 1 year ago

Thank you for your excellent bug report.

From the LuaTeX reference manual (Version 1.15) page 133

char - number - the character index in the font

Josef-Friedrich commented 1 year ago

related issue #6

Josef-Friedrich commented 1 year ago

I could reproduce this bug. I had to install texinfo: sudo apt install texinfo

lemzwerg commented 1 year ago

Thanks for the quick fix!

char - number - the character index in the font

This is it exactly – everybody working with fonts (me included – I'm the maintainer of FreeType) except some parts of the TeX world doesn't call this a 'character index' but a 'glyph index'. But I admit that I don't know LuaTeX well enough yet to really comment on that because it seems that this value probably serves more than a single purpose depending on the subtype of the 'glyph' node. As far as I can see, it should be called 'character index' for subtype 'character' and 'glyph index' for all later stages (i.e., other subtypes)...