- local ft = luatexja.jfont.font_metric_table[
- tex.getattribute('ltj@curtfnt')] or {}
- ft = ft and ft.char_type
- ft = ft and ft[0]
- local fm = font.getfont(font.current()).characters[77] or {} %% 'M'
- print('M', fm.height, fm.depth)
- print('漢', ft.height, ft.depth)
- tex.setattribute('ltj@tablshift',
- 0.5*(fm.height - fm.depth - ft.height+ ft.depth))
- print('tab', tex.getattribute('ltj@tablshift'))
+ local ft = fmt[get_attr('ltj@curtfnt')] or nulltable
+ ft = ft and ft.char_type or nulltable
+ local fk = ft and ft[0] or nulltable
+ local ht, dp, wd = fk.height or 0, fk.depth or 0,
+ fk.width or ft.zw or 0
+ local fm
+ = ((getfont(font.current()) or nulltable)
+ .characters or nulltable)[77] or nulltable %% 'M'
+ set_attr('ltj@tablshift',
+ 0.5*((fm.height or 0)- (fm.depth or 0) - ht+ dp))
+ if dir() ~= dir_tate then
+ ft = fmt[get_attr('ltj@curjfnt')] or nulltable
+ ft = ft and ft.char_type or nulltable
+ fk = ft and ft[0] or nulltable
+ ht, dp, wd = fk.height or 0, fk.depth or 0,
+ fk.width or ft.zw or 0
+ end
+ setdimen('cht', ht); setdimen('cdp', dp)
+ setdimen('cwd', wd); setdimen('chs', wd)
+ setdimen('cHT', ht+dp)