diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua index f21c0059c86..964d49e0635 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua @@ -87,7 +87,7 @@ local call_callback = luatexbase.call_callback local fshift = { down = 0, left = 0 } -local min, max = math.min, math.max +local min, max, floor, abs = math.min, math.max, math.floor, math.abs local rule_subtype = (status.luatex_version>=85) and 3 or 0 @@ -129,6 +129,13 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir) local q head, q = node_remove(head, p) + if pwidth > fwidth then + if char_data.round_threshold then + local frac = pwidth / fwidth + local quot = floor(frac+0.5) + if abs(frac-quot) <char_data.round_threshold then fwidth = fwidth * quot end + end + end local xo, yo = getoffsets(p) setoffsets(p, xo + char_data.align*(fwidth-pwidth) - fshift.left, yo - fshift.down); @@ -191,6 +198,11 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) pwidth, ascender = feir.vheight[pc]*met.size, feir.vorigin[pc]*met.size end fwidth = fwidth or pwidth + if pwidth>fwidth and char_data.round_threshold then + local frac = pwidth / fwidth + local quot = floor(frac+0.5) + if abs(frac-quot) <char_data.round_threshold then fwidth = fwidth * quot end + end fshift.down = char_data.down; fshift.left = char_data.left fshift = call_callback("luatexja.set_width", fshift, met, char_data) local fheight = char_data.height or 0 |