[luatex] an issue with \rpcode
Hans Hagen
pragma at wxs.nl
Sun Oct 12 13:38:47 CEST 2014
On 10/11/2014 5:07 PM, Mittelbach, Frank wrote:
> while trying to make Taco's linebreaker code I came across some behavior
> that I found rather weird
>
> in essense it looks as if \rpcode is not ending up in the char table
> unless \lpcode for the same char is set first (and non-zero)
>
> \pdfprotrudechars=1
>
> %\lpcode\font 50 = 1
> \rpcode\font 50 = 200
> \efcode\font 50 = 333
>
> \directlua{
> local function FMItable (name,t)
> print ("---- looking at table ", name, tostring(t))
> for k, v in pairs(t) do
> print(" ", k,"=", tostring(v))
> end
> print("----------------")
> end
> FMItable("char 50",font.fonts[font.current()].characters[50])
> }
>
> \bye
>
> --------------------
>
> if you uncomment the lpcode line then both values show up. But what is
> puzzling me even more is that if I change the values and then run this
> directlua bit again, nothing changes (could of course be that I should
> define FMItable differently but ...
>
> anybody any clue?
sure .. the table that you see is a cached one and if you change a rp
value after the font definition it is not reflected in there
see page 158 of luatex manual : cache field in passed tfm data tbale
keep in mind that normally one will only set the protrusion values when
a font is loaded because once a font is used they are frozen
(currently these values are em related but at some point they might
become glyph width related)
\starttext
\directlua{
function fonts.constructors.aftercopyingcharacters(target,original)
target.cache = "renew"
end
}
\pdfprotrudechars=1
\font\foo = LMRoman10-Regular*default,quality at 12.3pt
\foo
\lpcode\foo 45 = 2000\relax
\rpcode\foo 45 = 2000\relax
\efcode\foo 45 = 4000\relax
\directlua{
print("data at tex end")
inspect(font.fonts [font.current()].characters[45])
print("original passed data")
inspect(fonts.hashes.identifiers[font.current()].characters[45])
}
test
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the luatex
mailing list