[luatex] an issue with \rpcode
luigi scarso
luigi.scarso at gmail.com
Sun Oct 12 13:49:53 CEST 2014
On Sun, Oct 12, 2014 at 1:38 PM, Hans Hagen <pragma at wxs.nl> wrote:
> 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
>
>
with luatex-plain from contexst mkiv
%%
%% test-hans-1
\directlua{
function fonts.constructors.aftercopyingcharacters(target,original)
target.cache = "renew"
end
}
\pdfprotrudechars=1
\font\foo = file:lmroman12-regular
\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
\bye
$ luatex --fmt=luatex-plain test-hans-1.tex
This is LuaTeX, Version beta-0.79.1
\write18 enabled.
(./test-hans-1.tex
(/opt/luatex/standalone-mkiv-new/tex/texmf-context/tex/generic/context/luatex/l
uatex-basics.tex)
(/opt/luatex/standalone-mkiv-new/tex/texmf-context/tex/generic/context/luatex/l
uatex-fonts.tex <push namespace>
</opt/luatex/standalone-mkiv-new/tex/texmf-cont
ext/tex/generic/context/luatex/luatex-fonts-merged.lua>(using cache:
/opt/luatex
/standalone-mkiv-new/tex/texmf-cache/luatex-cache/generic)
<luatex-fonts.lua loa
ded in 0.051 seconds> <pop namespace>)
(/opt/luatex/standalone-mkiv-new/tex/texmf-context/tex/generic/context/luatex/l
uatex-math.tex(load luc:
/opt/luatex/standalone-mkiv-new/tex/texmf-cache/luatex-
cache/generic/fonts/otf/lmroman10-regular.luc)(load luc:
/opt/luatex/standalone-
mkiv-new/tex/texmf-cache/luatex-cache/generic/fonts/otf/lmroman7-regular.luc)(lo
ad luc:
/opt/luatex/standalone-mkiv-new/tex/texmf-cache/luatex-cache/generic/fon
ts/otf/lmroman5-regular.luc)(load luc:
/opt/luatex/standalone-mkiv-new/tex/texmf
-cache/luatex-cache/generic/fonts/otf/lmmono10-regular.luc)(load luc:
/opt/luate
x/standalone-mkiv-new/tex/texmf-cache/luatex-cache/generic/fonts/otf/lmromanslan
t10-regular.luc)(load luc:
/opt/luatex/standalone-mkiv-new/tex/texmf-cache/luate
x-cache/generic/fonts/otf/lmroman10-italic.luc)(load luc:
/opt/luatex/standalone
-mkiv-new/tex/texmf-cache/luatex-cache/generic/fonts/otf/lmroman10-bold.luc)(loa
d luc:
/opt/luatex/standalone-mkiv-new/tex/texmf-cache/luatex-cache/generic/font
s/otf/lmroman10-bolditalic.luc)(load luc:
/opt/luatex/standalone-mkiv-new/tex/te
xmf-cache/luatex-cache/generic/fonts/otf/latinmodern-math.luc))
(/opt/luatex/standalone-mkiv-new/tex/texmf-context/tex/generic/context/luatex/l
uatex-languages.tex)
(/opt/luatex/standalone-mkiv-new/tex/texmf-context/tex/generic/context/luatex/l
uatex-mplib.tex)(load luc:
/opt/luatex/standalone-mkiv-new/tex/texmf-cache/luate
x-cache/generic/fonts/otf/lmroman12-regular.luc)data at tex end
table={
["bot_accent"]=0,
["depth"]=0,
["expansion_factor"]=4000,
["height"]=191103,
["index"]=64,
["italic"]=0,
["left_protruding"]=2000,
["right_protruding"]=2000,
["top_accent"]=0,
["used"]=false,
["width"]=256377,
}
original passed data
table={
["height"]=191102.976,
["index"]=64,
["width"]=256376.832,
}
[1{/opt/luatex/standalone-mkiv-
new/tex/texmf/fonts/map/pdftex/plain/pdftex.map}])</opt/luatex/standalone-mkiv-n
ew/tex/texmf/fonts/opentype/public/lm/lmroman10-regular.otf></opt/luatex/standal
one-mkiv-new/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf>
Output written on test-hans-1.pdf (1 page, 5021 bytes).
Transcript written on test-hans-1.log.
--
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20141012/6a387e29/attachment.html>
More information about the luatex
mailing list