2009/6/18 Hans Hagen
Yanrui Li wrote:
the cache option mentioned there is not meant for using, just for debugging (i.e. for myself)
I have printed the the shared descriptions with the following code fragment:
function f4zhcn.pre_linebreak_filter (head, groupcode) for t in node.traverse(head) do if is_cjk_ideo (t) then texio.write_nl ('*** CJK Ideo ***') elseif is_cjk_puncts (t) then texio.write_nl ('*** CJK Punct ***') for k in pairs(font.fonts[t.font]) do texio.write_nl (k) end end end return true end
With "fontdata.cache = 'no'", I just got:
as we cache fonts at the lua end we don't want interference at the tex end (not duplicate table creation); the no tells luatex not to manage a cache at the tex end (i.e. no free not creation)
the "no" tells luatex not to keep a reference to the table it gets passed and when you then use font.fonts it will recreate a table from the data at the tex end and descriptions (and of course all other extra that i create and manage at the lua end is not available)
at the lua end you can use fonts.ids[id] instead and then you will get a descriptions (and leave the fontdata.cache key untouched unless you want to waste memory and runtime)
Ok, I see. many thanks!
Hans
ps. i will look into this bbox based compensation once we have a proper set of guaranteed correct standard cjk fonts in tex live and i've figured out a robust way to deal with it; i had code for it but threw it away out when i ran into conflicts with opentype features that do similar things and fonts that were inconsistent
I am just playing with luatex and learning it. Then I want to do something for Chinese temporarily with Wolfgang's simplefonts module because I need it for some documents of mine now. -- Best regards, Li Yanrui