summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-09-05 22:04:44 +0000
committerKarl Berry <karl@freefriends.org>2016-09-05 22:04:44 +0000
commit230fe59e35208b77a89adf5a05e0b133bd1703a3 (patch)
treeb1ab2292699fd15074c7b3b58907dfc1532a8797 /Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
parenta167d28bf628bbe45e8e8114c34cff3f6e67cca4 (diff)
luatexja (5sep16)
git-svn-id: svn://tug.org/texlive/trunk@41995 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua43
1 files changed, 40 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
index 81fa6be78d5..7355c9eaa6a 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
@@ -61,6 +61,7 @@ function define_jfm(t)
elseif type(t.zw)~='number' or type(t.zh)~='number' then
defjfm_res= nil; return
end
+ t.version = (type(t.version)=='number') and t.version or 1
t.char_type = {}; t.chars = {}
for i,v in pairs(t) do
if type(i) == 'number' then -- char_type
@@ -103,11 +104,49 @@ function define_jfm(t)
if type(v.down)~='number' then
v.down = 0.0
end
+ if t.version>=2 then
+ if v.end_stretch then defjfm_res= nil; return end
+ if v.end_shrink then defjfm_res= nil; return end
+ if v.end_adjust then
+ if type(v.end_adjust)~='table' then
+ v.end_adjust = nil
+ elseif #(v.end_adjust)==0 then
+ v.end_adjust = nil
+ else
+ table.sort(v.end_adjust)
+ end
+ end
+ else
+ v.end_adjust = nil
+ if v.end_stretch and v.end_stretch~=0.0 then
+ v.end_adjust = (v.end_adjust or {})
+ v.end_adjust[#(v.end_adjust)+1] = v.end_stretch
+ end
+ if v.end_shrink and v.end_ahrink~=0.0 then
+ v.end_adjust = (v.end_adjust or {})
+ v.end_adjust[#(v.end_adjust)+1] = -v.end_shrink
+ end
+ if v.end_adjust then v.end_adjust[#(v.end_adjust)+1] = 0.0 end
+ end
v.kern = v.kern or {}; v.glue = v.glue or {}
for j,x in pairs(v.glue) do
if v.kern[j] then defjfm_res= nil; return end
x.ratio, x[5] = (x.ratio or (x[5] and 0.5*(1+x[5]) or 0.5)), nil
- x.priority, x[4] = (x.priority or x[4] or 0), nil
+ do
+ local xp
+ xp, x[4] = (x.priority or x[4]), nil
+ if type(xp)=='table' and t.version>=2 then
+ if type(xp[1])~='number' or xp[1]<-4 or xp[1]>3 then defjfm_res=nil end -- stretch
+ if type(xp[2])~='number' or xp[2]<-4 or xp[2]>3 then defjfm_res=nil end -- shrink
+ xp = (xp[1]+4)*8+(xp[2]+4)
+ elseif xp and type(xp)~='number' then
+ defjfm_res = nil
+ else
+ xp = (xp or 0)*9+36
+ if xp<0 or xp>=64 then defjfm_res=nil end
+ end
+ x.priority = xp
+ end
x.kanjiskip_natural = norm_val(x.kanjiskip_natural)
x.kanjiskip_stretch = norm_val(x.kanjiskip_stretch)
x.kanjiskip_shrink = norm_val(x.kanjiskip_shrink)
@@ -147,7 +186,6 @@ do
end
update_jfm_cache = function (j,sz)
if metrics[j].size_cache[sz] then return end
- --local TEMP = node_new(id_kern)
local t = {}
metrics[j].size_cache[sz] = t
t.chars = metrics[j].chars
@@ -181,7 +219,6 @@ do
t.zw = round(metrics[j].zw*sz)
t.zh = round(metrics[j].zh*sz)
t.size = sz
- --node_free(TEMP)
end
end