diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-14 19:58:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-14 19:58:50 +0200 |
commit | fd0c4577a4b6e85ca2db664906e1a03807ce133f (patch) | |
tree | fa23fcc04248d03ff82e34634b8ef1bb9cf28acb /tex/context/base/mkiv/font-enc.lua | |
parent | db581096187dc2d3cbdbe4cdc39d247c168b1607 (diff) | |
download | context-fd0c4577a4b6e85ca2db664906e1a03807ce133f.tar.gz |
2017-05-14 19:15:00
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 |