summaryrefslogtreecommitdiff
path: root/tex/context/base/font-enh.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-05-09 17:40:16 +0300
committerMarius <mariausol@gmail.com>2011-05-09 17:40:16 +0300
commitae6e6d9d13c2d7f452fdf2253ed1ab3002e15777 (patch)
treeaf18cedaeff40c7e309d30770949be295aad4590 /tex/context/base/font-enh.lua
parent08808c3c53f125871cf4fd17926e4417072264e6 (diff)
downloadcontext-ae6e6d9d13c2d7f452fdf2253ed1ab3002e15777.tar.gz
beta 2011.05.09 16:28
Diffstat (limited to 'tex/context/base/font-enh.lua')
-rw-r--r--tex/context/base/font-enh.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/tex/context/base/font-enh.lua b/tex/context/base/font-enh.lua
index d19424384..ca9893e3d 100644
--- a/tex/context/base/font-enh.lua
+++ b/tex/context/base/font-enh.lua
@@ -105,19 +105,29 @@ local registerotffeature = otffeatures.register
-- we could also add kerns but we asssume symbols
-- todo: complain if not basemode
+-- remapping = {
+-- tounicode = true,
+-- unicodes = {
+-- a1 = 0x2701,
+
+local tosixteen = fonts.mappings.tounicode16
+
local function initializeunicoding(tfmdata)
local goodies = tfmdata.goodies
local newcoding = nil
+ local tounicode = false
for i=1,#goodies do
local remapping = goodies[i].remapping
if remapping and remapping.unicodes then
newcoding = remapping.unicodes -- names to unicodes
+ tounicode = remapping.tounicode
end
end
if newcoding then
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local oldcoding = tfmdata.resources.unicodes
+ local tounicodes = tfmdata.resources.tounicode -- index to unicode
local originals = { }
for name, newcode in next, newcoding do
local oldcode = oldcoding[name]
@@ -135,6 +145,12 @@ local function initializeunicoding(tfmdata)
characters [newcode] = characters [oldcode]
descriptions[newcode] = descriptions[oldcode]
end
+ if tounicode then
+ local index = descriptions[newcode].index
+ if not tounicodes[index] then
+ tounicodes[index] = tosixteen(newcode) -- shared (we could have a metatable)
+ end
+ end
if trace_defining then
report_defining("aliasing glyph '%s' from U+%05X to U+%05X",name,oldcode,newcode)
end