summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ott.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-08-14 15:56:20 +0300
committerMarius <mariausol@gmail.com>2010-08-14 15:56:20 +0300
commitb469b8ec1b494ab72cd462bfc539ce01440e6aaf (patch)
tree3a9c3fb8433c5f75020fef1d531bedb7c948f66c /tex/context/base/font-ott.lua
parent39e30629c15ae4a899532d84c4abea127f2847a6 (diff)
downloadcontext-b469b8ec1b494ab72cd462bfc539ce01440e6aaf.tar.gz
beta 2010.08.10 17:14
Diffstat (limited to 'tex/context/base/font-ott.lua')
-rw-r--r--tex/context/base/font-ott.lua56
1 files changed, 29 insertions, 27 deletions
diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua
index c56e98498..638fd8efc 100644
--- a/tex/context/base/font-ott.lua
+++ b/tex/context/base/font-ott.lua
@@ -691,38 +691,40 @@ otf.meanings.checkers = {
local checkers = otf.meanings.checkers
function otf.meanings.normalize(features)
- local h = { }
- for k,v in next, features do
- k = lower(k)
- if k == "language" or k == "lang" then
- v = gsub(lower(v),"[^a-z0-9%-]","")
- if not languages[v] then
- h.language = to_languages[v] or "dflt"
- else
- h.language = v
- end
- elseif k == "script" then
- v = gsub(lower(v),"[^a-z0-9%-]","")
- if not scripts[v] then
- h.script = to_scripts[v] or "dflt"
- else
- h.script = v
- end
- else
- if type(v) == "string" then
- local b = v:is_boolean()
- if type(b) == "nil" then
- v = tonumber(v) or lower(v)
+ if features then
+ local h = { }
+ for k,v in next, features do
+ k = lower(k)
+ if k == "language" or k == "lang" then
+ v = gsub(lower(v),"[^a-z0-9%-]","")
+ if not languages[v] then
+ h.language = to_languages[v] or "dflt"
else
- v = b
+ h.language = v
+ end
+ elseif k == "script" then
+ v = gsub(lower(v),"[^a-z0-9%-]","")
+ if not scripts[v] then
+ h.script = to_scripts[v] or "dflt"
+ else
+ h.script = v
+ end
+ else
+ if type(v) == "string" then
+ local b = v:is_boolean()
+ if type(b) == "nil" then
+ v = tonumber(v) or lower(v)
+ else
+ v = b
+ end
end
+ k = to_features[k] or k
+ local c = checkers[k]
+ h[k] = c and c(v) or v
end
- k = to_features[k] or k
- local c = checkers[k]
- h[k] = c and c(v) or v
end
+ return h
end
- return h
end
-- When I feel the need ...