[luatex] line break reassigns font id with expansion

Philipp Gesang philipp.gesang at alumni.uni-heidelberg.de
Sun May 5 14:15:41 CEST 2013


Hi all,

with expansion enabled, line breaking assigns new font ids to
glyph nodes. Example for luatex-plain:

·································································
%\font\somefont=file:Iwona-Regular.otf
\font\somefont=file:Iwona-Regular.otf:expansion=default;
\somefont
\pdfadjustspacing=2
\catcode`\%=11

\directlua{
  local glyph_t    = node.id"glyph"
  local hlist_t    = node.id"hlist"
  local vlist_t    = node.id"vlist"
  local sub_box_t  = node.id"sub_box"

  local show_font_id
  show_font_id = function (hd, when, nested)
    for n in node.traverse(hd) do
      local n_id = n.id
      if n_id == glyph_t then
        local n_font = n.font
        local tfmdata = font.getfont(n_font)
        print(string.format(
              "(%s (rec %s) (byte %d) (chr %s) (font %s) (tfmdata %s))",
              when,
              nested,
              n.char,
              unicode.utf8.char(n.char),
              n_font,
              tfmdata))
      elseif n_id == hlist_t or n_id == vlist_t or n_id == sub_box_t then
        show_font_id(n.list, when, true)
      end
    end
    return hd
  end
  callback.register(
    "pre_linebreak_filter",
    function (hd) return show_font_id(hd, "pre_line") end)
  callback.register(
    "post_linebreak_filter",
    function (hd) return show_font_id(hd, "post_line") end)
  callback.register(
    "pre_output_filter",
    function (hd) return show_font_id(hd, "pre_out") end)
}

\hsize 1cm

foo bar

\bye
·································································

On my machine (version beta-0.76.0-2013040516), all glyphs have
font 51 initially. During line breaking, those glyphs that are
subject to expansion get reassigned font 53 or 54. I’m not sure
whether this is caused by the font loader or the engine itself.
Anyways, the font loader doesn’t create entries for font ids 53
and 54 in fonts.hashes.identifiers.

My question is thus: is there a way to get the original font id
of an expanded glyph after line breaking, or at least to get the
corresponding tfmdata?

Thanks
Philipp



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20130505/10f5c792/attachment.bin>


More information about the luatex mailing list