From ae6e6d9d13c2d7f452fdf2253ed1ab3002e15777 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 9 May 2011 17:40:16 +0300 Subject: beta 2011.05.09 16:28 --- tex/context/base/font-enh.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tex/context/base/font-enh.lua') 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 -- cgit v1.2.3