diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-xtx.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-xtx.lua | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-xtx.lua b/Master/texmf-dist/tex/context/base/font-xtx.lua index 7b3f1ec8196..eac75dd2901 100644 --- a/Master/texmf-dist/tex/context/base/font-xtx.lua +++ b/Master/texmf-dist/tex/context/base/font-xtx.lua @@ -1,6 +1,6 @@ if not modules then modules = { } end modules ['font-xtx'] = { version = 1.001, - comment = "companion to font-ini.tex", + comment = "companion to font-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['font-xtx'] = { local texsprint, count = tex.sprint, tex.count local format, concat, gmatch, match, find, lower = string.format, table.concat, string.gmatch, string.match, string.find, string.lower local tostring, next = tostring, next +local lpegmatch = lpeg.match local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) @@ -71,12 +72,15 @@ local function istrue (s) list[s] = 'yes' end local function isfalse(s) list[s] = 'no' end local function iskey (k,v) list[k] = v end +local function istrue (s) list[s] = true end +local function isfalse(s) list[s] = false end + local spaces = lpeg.P(" ")^0 local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0 local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/iscrap) * spaces local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]")) local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename) -local sometext = (lpeg.R("az") + lpeg.R("AZ") + lpeg.R("09"))^1 +local sometext = (lpeg.R("az","AZ","09") + lpeg.S("+-."))^1 local truevalue = lpeg.P("+") * spaces * (sometext/istrue) local falsevalue = lpeg.P("-") * spaces * (sometext/isfalse) local keyvalue = (lpeg.C(sometext) * spaces * lpeg.P("=") * spaces * lpeg.C(sometext))/iskey @@ -86,15 +90,17 @@ local option = spaces * (keyvalue + falsevalue + truevalue + somevalue) * sp local options = lpeg.P(":") * spaces * (lpeg.P(";")^0 * option)^0 local pattern = (filename + fontname) * subvalue^0 * crapspec^0 * options^0 +local normalize_meanings = fonts.otf.meanings.normalize + function fonts.define.specify.colonized(specification) -- xetex mode list = { } - pattern:match(specification.specification) - for k, v in next, list do - list[k] = v:is_boolean() - if type(list[a]) == "nil" then - list[k] = v - end - end + lpegmatch(pattern,specification.specification) +--~ for k, v in next, list do +--~ list[k] = v:is_boolean() +--~ if type(list[a]) == "nil" then +--~ list[k] = v +--~ end +--~ end list.crap = nil -- style not supported, maybe some day if list.name then specification.name = list.name @@ -108,7 +114,8 @@ function fonts.define.specify.colonized(specification) -- xetex mode specification.sub = list.sub list.sub = nil end - specification.features.normal = list +-- specification.features.normal = list + specification.features.normal = normalize_meanings(list) return specification end |