From 51c9015e14c58f4044076578de6d3871bf0b6031 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Wed, 22 Apr 2020 15:36:22 +0900 Subject: [PATCH] round_threshold in vertical fonts --- src/jfm-ujisv.lua | 1 + src/ltj-setwidth.lua | 5 +++++ test/test59-round_threshold.tex | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 test/test59-round_threshold.tex diff --git a/src/jfm-ujisv.lua b/src/jfm-ujisv.lua index ccae212..b2044bd 100644 --- a/src/jfm-ujisv.lua +++ b/src/jfm-ujisv.lua @@ -28,6 +28,7 @@ local t = { [8] = { 0, 0, 0, kanjiskip_shrink=1 }, }, kern = { [307] = 0 }, + round_threshold = 0.01, }, [1] = { -- 開き括弧類 diff --git a/src/ltj-setwidth.lua b/src/ltj-setwidth.lua index 0d684ef..c6fa235 100644 --- a/src/ltj-setwidth.lua +++ b/src/ltj-setwidth.lua @@ -196,6 +196,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 fwidth~=pwidth and char_data.round_threshold then + local frac = abs(pwidth / fwidth); + local quot = floor(frac) + if frac-quot ', tex.print) +}\par} + +\newpage +\setbox0=\hbox{\yoko あ〳〵あ〱あ――あ}\par +\hrule +\copy0 +\hrule +{\ttfamily\tiny\directlua{% + luatexja.ext_show_node(tex.getbox(0), '\string\\par> ', tex.print) +}\par} + +\end{document} +\bye -- 2.11.0