local jf_field = C(jf_field_char^1)
local jf_assignment = jf_field * ws * equals * ws * jf_field
local jf_switch = P'-' * jf_field * Cc(false) + P'+'^-1 * jf_field * Cc(true)
- local jf_feature_expr = Cg(jf_assignment + jf_switch) * ws * comma^0 * ws
+ local jf_feature_expr =
+ P{
+ 'FE',
+ FE = Cg(V'AT'+ jf_assignment + jf_switch) * ws * comma^0 * ws,
+ AT = jf_field * ws * equals * ws * Cf(Ct'' * P'{' * ws * (V'FE')^0 * P'}', rawset),
+ }
local jf_feature_list = ws * ( P'{' * ws * jf_feature_expr^0 * P'}' + jf_feature_expr^0 )
local jf_list = C((1-slash)^1) * (slash * Cf(Ct'' * jf_feature_list, rawset))^-1
local jf_value = (1 - semicolon)^1
+ local norm
+ norm = function (t)
+ local flag
+ if type(t)=='table' then
+ for i,v in pairs(t) do
+ flag=true
+ if v=='true' then t[i]=true elseif v=='false' then t[i]=false
+ elseif type(v)=='table' then norm(v) end
+ end
+ return flag and t
+ end
+ end
local function rem(name,value)
if name=='jfm' then
- local flag, t; jfm_name, t = lpegmatch(jf_list, value)
- if type(t)=='table' then
- for i,v in pairs(t) do
- flag=true
- if v=='true' then t[i]=true elseif v=='false' then t[i]=false end
- end
- end
- luatexja.jfont.jfm_feature = flag and t
+ local t; jfm_name, t = lpegmatch(jf_list, value)
+ luatexja.jfont.jfm_feature = norm(t)
elseif name=='jfmvar' then jfm_var = value end
return ''
end
{\testOA \testF
A quick brown fox 跳』\inhibitglue (躍)(した:) over the のろ……まな 犬.
+
A quick fox 跳』\inhibitglue (躍)(した:) over the のろ……まな 犬.ああああああ
}
\def\printjfmfeat#1{%
\relax{\tentt\string#1}:
\directlua{%
- if myjfm then
- for i,v in pairs(myjfm) do
- tex.sprint('[{\string\\tentt ' .. i .. '}]${}={}$')
- if type(v)=='string' then
- tex.sprint('``{\string\\tentt ' .. tostring(v) .. "}'', ")
- else
- tex.sprint(tostring(v) ..', ')
+ local fn
+ fn = function (t)
+ for i,v in pairs(t) do
+ tex.sprint('[{\string\\tentt ' .. i .. '}]${}={}$')
+ if type(v)=='string' then
+ tex.sprint('``{\string\\tentt ' .. tostring(v) .. "}'', ")
+ elseif type(v)=='table' then
+ tex.sprint('$\string\\{$'); fn(v); tex.sprint('$\string\\}$, ')
+ else
+ tex.sprint(tostring(v) ..', ')
+ end
end
end
- else tex.sprint('(nil)')
- end
+ if myjfm then fn(myjfm) else tex.sprint('(nil)') end
}\par
}
-\jfont\testP="KozMinPr6N-Regular:jfm=ujis/h,-p,l=g,z=true;jfm=testf/ -so , lw = tr ,q,-d,-po, l=f,z=h,e, hwid;trad" at 9pt
+\jfont\testP=KozMinPr6N-Regular:jfm=ujis/h,-p,l=g,z=true;jfm=testf/q,-d,l=f,z=h,e,hwid;trad at 9pt
\printjfmfeat\testP
\testP イ医学
+\jfont\testQ=KozMinPr6N-Regular:jfm=testf/{+w,h={+a,-b,c=true,u=x,t={s,a}},-o,d={}};trad at 9pt
+\printjfmfeat\testQ
+
+\jfont\testR=KozMinPr6N-Regular:jfm=testf/{};trad at 9pt
+\printjfmfeat\testR
\bye