• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: コミット

ソースコードの管理場所


コミットメタ情報

リビジョンd63cda7a13521d938fd1e770fb2d45d06f85c8e3 (tree)
日時2019-07-24 23:40:47
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
コミッターHironori Kitagawa

ログメッセージ

support vertical origin (requires luaotfload 2019-07-24 or later)

変更サマリ

差分

--- a/src/jfm-ujisv.lua
+++ b/src/jfm-ujisv.lua
@@ -297,7 +297,6 @@ end
297297 t[200]=table.fastcopy(t[0])
298298 t[200].chars={'〱', '〲'}
299299 t[200].width = 2.0
300-t[200].left=-0.5
301300 for i,v in pairs(t) do
302301 if type(v)=='table' then
303302 if v.glue and v.glue[0] then v.glue[200] = v.glue[0] end
--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -809,18 +809,25 @@ local prepare_fl_data
809809 do
810810 local sort = table.sort
811811 prepare_fl_data = function (dest, id)
812- local t = {}
812+ local ascent = id.shared.rawdata.metadata.ascender
813+ local t_vorigin, t_ind_to_uni = {}, {}
813814 for i,v in pairs(id.shared.rawdata.descriptions) do
814- t[v.index] = i
815+ t_ind_to_uni[v.index] = i
816+ if v.tsb then
817+ local j = v.boundingbox[4] + v.tsb
818+ if j~=ascent then print(i,j);t_vorigin[i]=j end
819+ end
815820 end
816- dest = dest or {}; dest.ind_to_uni = t
821+ dest = dest or {}
822+ dest.ind_to_uni = t_ind_to_uni
823+ dest.vorigin = t_vorigin
817824 return dest
818825 end
819826 end
820827
821828 --
822829 do
823- local cache_ver = 18
830+ local cache_ver = 19
824831
825832 local function prepare_extra_data_base(id)
826833 if (not id) or (not id.filename) then return end
--- a/src/ltj-setwidth.lua
+++ b/src/ltj-setwidth.lua
@@ -14,6 +14,7 @@ local getfont = node.direct.getfont
1414 local getlist = node.direct.getlist
1515 local getchar = node.direct.getchar
1616 local getsubtype = node.direct.getsubtype
17+local getwidth = node.direct.getwidth or function(n) return getfield(n,'width') end
1718 local getdepth = node.direct.getdepth or function(n) return getfield(n,'depth') end
1819 local getwhd = node.direct.getwhd or function(n)
1920 return getfield(n,'width'), getfield(n,'height'),getfield(n,'depth') end
@@ -23,6 +24,7 @@ local setwhd = node.direct.setwhd or function(n,w,h,d)
2324 local setchar = node.direct.setchar or function(n,c) setfield(n,'char',c) end
2425 local setnext = node.direct.setnext or function(n,c) setfield(n,'next',c) end
2526 local setdir = node.direct.setdir or function(n,c) setfield(n,'dir',c) end
27+local setkern = node.direct.setkern or function(n,c) setfield(n,'kern',c) end
2628 local setoffsets = node.direct.setoffsets or function(n,x,y)
2729 setfield(n,'xoffset',x); setfield(n,'yoffset',y) end
2830 local getoffsets = node.direct.getoffsets or function(n)
@@ -81,7 +83,7 @@ luatexbase.create_callback("luatexja.set_width", "data",
8183 end)
8284 local call_callback = luatexbase.call_callback
8385
84-local fshift = { down = 0, left = 0}
86+local fshift = { down = 0, left = 0 }
8587
8688 local min, max = math.min, math.max
8789
@@ -187,9 +189,8 @@ local function capsule_glyph_tate(p, met, char_data, head, dir)
187189 pwidth = (ident.descriptions and ident.descriptions[pc]
188190 and ident.descriptions[pc].vheight
189191 and ident.descriptions[pc].vheight / ident.units * met.size)
190- or (ascent+descent)
191- pwidth = pwidth + (met.v_advance[pc] or 0)
192- ascent = met.v_origin[pc] and ascent - met.v_origin[pc] or ascent
192+ or (ident.metadata and ident.metadate.defaultvheight) or (ascent+descent)
193+ ascent = feir.vorigin[pc] and (feir.vorigin[pc] / ident.units * met.size) or ascent
193194 end
194195 fwidth = fwidth or pwidth
195196 fshift.down = char_data.down; fshift.left = char_data.left
@@ -210,9 +211,9 @@ local function capsule_glyph_tate(p, met, char_data, head, dir)
210211 local ws = node_new(id_whatsit, sid_save)
211212 local wm = node_new(id_whatsit, sid_matrix)
212213 setfield(wm, 'data', '0 1 -1 0')
213- local pwnh = -round(0.5*getfield(p, 'width'))
214- local k2 = node_new(id_kern, 1); setfield(k2, 'kern', pwnh)
215- local k3 = node_new(id_kern, 1); setfield(k3, 'kern', -getfield(p, 'width')-pwnh)
214+ local pwnh = -round(0.5*getwidth(p))
215+ local k2 = node_new(id_kern, 1); setkern(k2, pwnh)
216+ local k3 = node_new(id_kern, 1); setkern(k3, -getwidth(p)-pwnh)
216217 local wr = node_new(id_whatsit, sid_restore)
217218 setfield(box, 'head', ws)
218219 setnext(ws, wm); setnext(wm, k2);
@@ -228,7 +229,7 @@ luatexja.setwidth.capsule_glyph_tate = capsule_glyph_tate
228229
229230 local function capsule_glyph_math(p, met, char_data)
230231 if not char_data then return nil end
231- local fwidth, pwidth = char_data.width, getfield(p, 'width')
232+ local fwidth, pwidth = char_data.width, getwidth(p)
232233 fwidth = fwidth or pwidth
233234 fshift.down = char_data.down; fshift.left = char_data.left
234235 fshift = call_callback("luatexja.set_width", fshift, met, char_data)
旧リポジトリブラウザで表示