diff options
Diffstat (limited to 'tex/context/base/mkiv/font-enc.lua')
-rw-r--r-- | tex/context/base/mkiv/font-enc.lua | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/tex/context/base/mkiv/font-enc.lua b/tex/context/base/mkiv/font-enc.lua index 2e8b722de..1470f3b8d 100644 --- a/tex/context/base/mkiv/font-enc.lua +++ b/tex/context/base/mkiv/font-enc.lua @@ -20,7 +20,7 @@ them in tables. But we may do so some day, for consistency.</p> local report_encoding = logs.reporter("fonts","encoding") -local encodings = { } +local encodings = fonts.encodings or { } fonts.encodings = encodings encodings.version = 1.03 @@ -78,22 +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 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 - if enccodes[ch] then - unicodes[enccodes[ch]] = 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 |