[latex3-commits] [l3svn] 02/05: Extend Lua \font callback parser

noreply at latex-project.org noreply at latex-project.org
Sun Feb 7 23:55:35 CET 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit bd01ca7791d21126affad0c18047321bb34dd6fe
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Feb 7 20:07:10 2016 +0000

    Extend Lua \font callback parser
    
    This should now be able to at least not choke with a range of XeTeX
    syntax and also pass properties through as part of the 'properties
    table'. Exactly whether this works or not is still not entirely clear!
---
 l3kernel/l3luatex.dtx |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/l3kernel/l3luatex.dtx b/l3kernel/l3luatex.dtx
index a2f8fbe..0f9b913 100644
--- a/l3kernel/l3luatex.dtx
+++ b/l3kernel/l3luatex.dtx
@@ -350,10 +350,30 @@ local fontloader = require("fontloader.lua")
 %    \begin{macrocode}
 callback.register("define_font", 
   function (name, size, id)
+    local opts, opttab, otfeatures = "", { }, { }
     if string.match(name, "^%[") then
-      name = string.match(name, "^%[([^%]]*)%]")
+      name, opts = string.match(name, "^%[([^%]]*)%][^:]*:?(.*)")
     end
-    return select(2, fontloader.define_font(name, size))
+    if opts ~= "" then
+      for _,kv in ipairs(string.explode(opts,";")) do
+        if string.match(kv, "=") then
+          local k, v = string.match(kv, "([^=]*)=?(.*)")
+          opttab[k] = v
+        else
+          if string.match(kv, "^+") then
+            otfeatures[string.sub(kv,2,-1)] = "true"
+          elseif string.match(kv, "^-") then
+            otfeatures[string.sub(kv,2,-1)] = "false"
+          else
+            otfeatures[kv] = "true"
+          end
+        end
+      end
+    end
+    if next(otfeatures) then
+      opttab["otfeatures"] = otfeatures
+    end
+    return select(2, fontloader.define_font(name, size, opttab))
   end
 )
 %    \end{macrocode}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list