[luatex] line break reassigns font id with expansion

Philipp Gesang Philipp.Gesang at alumni.uni-heidelberg.de
Tue May 14 14:16:54 CEST 2013


···<date: 2013-05-14, Tuesday>···<from: Hans Hagen>···

> On 5/5/2013 2:15 PM, Philipp Gesang wrote:
> >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?
> 
> As all my luatex mailing list mails get filtered through its own box
> (simply because most concerns latex issues) I never see such mails
> till I explicitly walk through that list. Anyhow, the answer to this
> is:
> 
> It's just the way it works, and we will not extend that interface.
> In fact, I've done experiments with this already years ago and
> already cooked up a more efficient and clean method which will get
> implemented after this tex live freeze. It also gives a better
> separation between front and backend. I actually patched the engine
> while testing but Hartmut will do the final cleanup so we have to be
> patient. There is no need to waste time on intermediate hacking.

Great news, looking forward to it!

> The current implementation is taken from pdftex and is also a
> research instrument and therefore inhits on-the-fly fontbuilding (as
> needed for bitmap fonts).

Makes sense. Thanks a lot for the detailed explanation. Maybe for
the time being this should be mentioned in luatexref-t because it
can be quite confusing.

Best
Philipp



-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
-------------- 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/20130514/ecd9fa92/attachment.bin>


More information about the luatex mailing list