local f = ltjs.get_stack_table(MJT + 0x100 * sty + fam, -1, getcount(cnt_stack))
if f ~= -1 then
local q = node_new(id_sub_box)
- local r = node_new(id_glyph, 256); setnext(r, nil)
- setfont(r, f, pc)
- local ks = (get_attr(r,attr_ykblshift) or 0) -- - (get_attr(r, attr_yablshift) or 0)
- set_attr(r, attr_ykblshift, 0); --set_attr(r, attr_yablshift, 0)
+ local r = node_new(id_glyph, 256); setnext(r, nil); setfont(r, f, pc)
local met = ltjf_font_metric_table[f]
- r = capsule_glyph_math(r, met, met.char_type[ltjf_find_char_class(pc, met)]);
- setlist(q, r); node_free(p); p=q; setshift(r, ks);
+ r = capsule_glyph_math(
+ r, met, met.char_type[ltjf_find_char_class(pc, met)], sty)
+ setlist(q, r); node_free(p); p=q;
end
end
elseif pid == id_sub_box and getlist(p) then
local sid_matrix = node.subtype 'pdf_setmatrix'
local dir_tate = luatexja.dir_table.dir_tate
+local attr_yablshift = luatexbase.attributes['ltj@yablshift']
local attr_ykblshift = luatexbase.attributes['ltj@ykblshift']
local attr_tkblshift = luatexbase.attributes['ltj@tkblshift']
local attr_icflag = luatexbase.attributes['ltj@icflag']
end
luatexja.setwidth.capsule_glyph_tate = capsule_glyph_tate
-local function capsule_glyph_math(p, met, char_data)
+do
+ local cap_math_aux = {[0]=1, [1]=0 }
+ setmetatable(cap_math_aux, {__index=function() return 0.5 end})
+local function capsule_glyph_math(p, met, char_data, sty)
if not char_data then return nil end
local fwidth, pwidth = char_data.width, getwidth(p)
fwidth = fwidth or pwidth
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
local fheight, fdepth = char_data.height, char_data.depth
- local y_shift
- = - getfield(p, 'yoffset') + (get_attr(p,attr_ykblshift) or 0)
+ print(utf.char(getchar(p)), get_attr(p,attr_ykblshift) or 0, get_attr(p,attr_yablshift) or 0, sty)
+ local y_shift = - getfield(p, 'yoffset')
+ + cap_math_aux[sty]*((get_attr(p,attr_ykblshift) or 0) - (get_attr(p,attr_yablshift) or 0))
setfield(p, 'yoffset', -fshift.down)
setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth) - fshift.left)
local box = node_new(id_hlist, nil, p);
return box
end
luatexja.setwidth.capsule_glyph_math = capsule_glyph_math
+end
-- 数式の位置補正
function luatexja.setwidth.apply_ashift_math(head, last, attr_ablshift)
mathgt: $\mathgt{あいうえおabcde}$
-\ltjsetparameter{yalbaselineshift=4pt}
+\ltjsetparameter{yalbaselineshift=2pt,yjabaselineshift=10pt}
+\leavevmode
+\vrule height 0.1pt width 200pt depth 0pt\kern-200pt%
あs$t漢\hbox{dき}\underline{aイ\hbox{bあ}}\overline{Aく\hbox{cう}}$
+\leavevmode
+\vrule height 0.1pt width 200pt depth 0pt\kern-200pt%
+あs${\scriptstyle 漢X}{漢Y^{うE}_{えO}}A^E_O12=a\pi \dfrac{aあ}{iい}$
+
\end{document}