OSDN Git Service

jfm feature: support jfm=hoge/{...}
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 20 Aug 2020 12:03:13 +0000 (21:03 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Thu, 20 Aug 2020 12:03:17 +0000 (21:03 +0900)
src/ltj-jfont.lua
test/test33-jfm_feature.pdf
test/test33-jfm_feature.tex

index bffd7c0..842713b 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2020-07-30',
+  date = '2020-08-20',
   description = 'Loader for Japanese fonts',
 })
 
@@ -379,14 +379,14 @@ do
     local semicolon         = P';'
     local comma             = P','
     local equals            = P'='
-    local featuresep        = comma + semicolon
-    local jf_field_char     = 1 - slash - featuresep
+    local jf_field_char     = 1 - S'/{};,'
     local jf_field          = C(jf_field_char^1)
     local jf_assignment     = jf_field * equals * 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) * comma^0
-    local jf_list           = C((1-slash)^1) * (slash^1 * (Cf(Ct'' * jf_feature_expr^0, rawset)))^-1
-    local jf_value          = (1 - S'{}' - semicolon)^1
+    local jf_feature_list   = P'{' * 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 function rem(name,value,sep)
       if name=='jfm' then
         local flag, t; jfm_name, t = lpegmatch(jf_list, value)
@@ -402,7 +402,7 @@ do
     end
     local jf_remainder      = Cs( ( ( B(S':;') *
       C(P'jfm' * P'var'^-1) * ws * equals * ws * C(jf_value) * C(semicolon^-1) ) / rem +1 )^0 )
-    
+
    local parser=luaotfload.parsers.font_request
    function is_feature_specified(s,fname)
      local t = lpegmatch(parser,s); return t and t.features and t.features[fname]
@@ -426,7 +426,7 @@ do
             end
             table.sort(t2); jfm_spec = jfm_name .. '/{' .. table.concat(t2, ',') .. '}'
          else
-            jfm_spec = jfm_name       
+            jfm_spec = jfm_name
          end
          l = name:sub(-1)
          name = name .. ((l==':' or l==';') and '' or ';') .. 'jfm=' .. jfm_spec
index 7b90862..c2f963d 100644 (file)
Binary files a/test/test33-jfm_feature.pdf and b/test/test33-jfm_feature.pdf differ
index d79c43b..d226760 100644 (file)
@@ -2,7 +2,7 @@
 \input luatexja.sty
 \catcode`\@=11
 \jfont \testA=\ltj@stdmcfont:jfm=ujis/hoge,piyo at 9.62216pt
-\jfont \testB=\ltj@stdmcfont:jfm=ujis/piyo,,,,,+hoge,,,,;jp90 at 9.62216pt
+\jfont \testB=\ltj@stdmcfont:jfm=ujis/{piyo,,,,,+hoge,,,,};jp90 at 9.62216pt
 \jfont \testC=\ltj@stdgtfont:jfm=ujis/,,,,;+jp90 at 9.62216pt
 %\jfont \testD=\ltj@stdgtfont:jfm=/abcd;+trad at 9.62216pt % error
 \jfont \testE=\ltj@stdmcfont:jfm=ujis/piyo,hoge=2,+foo,-bar,mog=6,,l=true,g=false;jp90 at 9.62216pt