summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-enc.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-07-02 12:19:51 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-07-02 12:19:51 +0200
commitda9149010f4d34eef23a504682d82cdcf4fac8f5 (patch)
treea213e0a93e1e4ac2b8a6a724e32db3e8d6dc1fc5 /tex/context/base/mkiv/font-enc.lua
parentc6fcaaa08d694397e9db4d1f9497926c193a5d95 (diff)
downloadcontext-da9149010f4d34eef23a504682d82cdcf4fac8f5.tar.gz
2016-07-01 16:31:00
Diffstat (limited to 'tex/context/base/mkiv/font-enc.lua')
-rw-r--r--tex/context/base/mkiv/font-enc.lua40
1 files changed, 24 insertions, 16 deletions
diff --git a/tex/context/base/mkiv/font-enc.lua b/tex/context/base/mkiv/font-enc.lua
index ba957bdf2..1470f3b8d 100644
--- a/tex/context/base/mkiv/font-enc.lua
+++ b/tex/context/base/mkiv/font-enc.lua
@@ -78,24 +78,32 @@ function encodings.load(filename)
if foundname and foundname ~= "" then
local ok, encoding, size = resolvers.loadbinfile(foundname)
if ok and encoding then
- encoding = gsub(encoding,"%%(.-)\n","")
- local unicoding = fonts.encodings.agl.unicodes
- local tag, vec = match(encoding,"/(%w+)%s*%[(.*)%]%s*def")
- local i = 0
- for ch in gmatch(vec,"/([%a%d%.]+)") do
- if ch ~= ".notdef" then
- vector[i] = ch
- if not hash[ch] then
- hash[ch] = i
- else
- -- duplicate, play safe for tex ligs and take first
- end
- local u = unicoding[ch] or enccodes[ch] -- enccodes have also context names
- if u then
- unicodes[u] = i
+ encoding = gsub(encoding,"%%(.-)[\n\r]+","")
+ if encoding then
+ local unicoding = fonts.encodings.agl.unicodes
+ local tag, vec = match(encoding,"[/]*(%w+)%s*%[(.*)%]%s*def")
+ if vec then
+ local i = 0
+ for ch in gmatch(vec,"/([%a%d%.]+)") do
+ if ch ~= ".notdef" then
+ vector[i] = ch
+ if not hash[ch] then
+ hash[ch] = i
+ else
+ -- duplicate, play safe for tex ligs and take first
+ end
+ local u = unicoding[ch] or enccodes[ch] -- enccodes have also context names
+ if u then
+ unicodes[u] = i
+ end
+ end
+ i = i + 1
end
+ else
+ report_encoding("reading vector in encoding file %a fails",filename)
end
- i = i + 1
+ else
+ report_encoding("reading encoding file %a fails",filename)
end
end
end