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

The `subtype` field of a `glyph` node is a bit field #11

Closed lemzwerg closed 1 year ago

lemzwerg commented 1 year ago

For the input

\input nodetree.tex
\NodetreeSetOption[verbosity]{2}

\NodetreeRegisterCallback{preline}

office

\bye

before:

image

after:

image

Josef-Friedrich commented 1 year ago

Thank you for your pull request ... I had to resolve a merge conflict ... now all glyph subtypes are gone ... Can you please look at the current main branch

lemzwerg commented 1 year ago

This works for me.

diff --git a/nodetree.lua b/nodetree.lua
index 6b907b8..35d1ada 100644
--- a/nodetree.lua
+++ b/nodetree.lua
@@ -948,6 +948,10 @@ function node_extended.subtype(n)
       -- only handle the lowest five bits
       local mask = 1
       local need_space = false
+      if n.subtype & mask == 0 then
+        output = output .. 'glyph'
+        need_space = true
+      end
       for i = 0,4,1 do
         if n.subtype & mask ~= 0 then
           if need_space == true then
Josef-Friedrich commented 1 year ago

With your patch all the subtypes of the glyphs are “glyphs”. I had to revert your pull request. Sorry.

lemzwerg commented 1 year ago

This is fully correct, see the LuaTeX manual, section 5.2, 'Characters, glyphs and discretionaries'! At the 'preline' stage, all input characters are already converted to glyphs (see the 'hyphenate' state to see characters); only in ligatures you can find retained references to input characters.

Anyway, I've opened #15 for a better patch.