[NTG-context] Dubious "checksum mismatch" message on log file

luigi scarso luigi.scarso at gmail.com
Thu Feb 2 15:47:43 CET 2012


Basically it seems coherent with the luatex manual (ch.  7 Font structure):

luatex read the txr.tfm file and  set the checksum to the unsigned int 0
(luafont.w ,int font_from_lua(lua_State * L, int f)) (but see Note below)
Then read the vf
(dofont.w, do_vf(f) inside static int do_define_font(int f, const char
*cnom, scaled s, int natural_dir))
do_vf(f) calculate the checksum of the vf file vua test_checksum() macro,
and find that the vf file has checksum
 210 43 124 230 =>(210*2^24)+(43*2^16)+(124*2^8)+230=3526065382= oct 32212676346
vs
128 0 0 0
and hence the warning of mismatch.


Note:
The last sequence 128 0 0 0  (i.e. 0) it is due to

i = numeric_field(L, "checksum", 0);
set_font_checksum(f, (unsigned) i);

where
static int numeric_field(lua_State * L, const char *name, int dflt)
{
    int i = dflt;
    lua_pushstring(L, name);
    lua_rawget(L, -2);
    if (lua_isnumber(L, -1)) {
        i = lua_roundnumber(L, -1);
    }
    lua_pop(L, 1);
    return i;
}
and
#define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5)

I think one can avoid the warning if set the checksum field to the
correct value by the define_font callback on the lua side.

-- 
luigi


More information about the ntg-context mailing list