summaryrefslogtreecommitdiff
path: root/otfl-font-dum.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2011-03-02 20:10:46 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2011-03-02 20:57:11 +0200
commit654f5f46c8c7bc43b73ce46035f3f6c1d5e9bbe5 (patch)
tree3df613c3e05ca044d521bfc872f0d28028cb15f8 /otfl-font-dum.lua
parenta0e1a5594231d9f3789c51f04fdfb24680ca2516 (diff)
downloadluaotfload-654f5f46c8c7bc43b73ce46035f3f6c1d5e9bbe5.tar.gz
Sync with ConTeXt 2011.02.25 22:03
This commit overrides all our local modification to ConTeXt file and is not tested at all.
Diffstat (limited to 'otfl-font-dum.lua')
-rw-r--r--otfl-font-dum.lua48
1 files changed, 45 insertions, 3 deletions
diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua
index 14d155a..54b631d 100644
--- a/otfl-font-dum.lua
+++ b/otfl-font-dum.lua
@@ -11,13 +11,13 @@ fonts = fonts or { }
-- general
fonts.otf.pack = false -- only makes sense in context
-fonts.tfm.resolvevirtualtoo = false -- context specific (du eto resolver)
+fonts.tfm.resolvevirtualtoo = false -- context specific (due to resolver)
fonts.tfm.fontnamemode = "specification" -- somehow latex needs this (changed name!)
-- readers
fonts.tfm.readers = fonts.tfm.readers or { }
-fonts.tfm.readers.sequence = { 'otf', 'ttf', 'tfm' }
+fonts.tfm.readers.sequence = { 'otf', 'ttf', 'tfm', 'lua' }
fonts.tfm.readers.afm = nil
-- define
@@ -275,7 +275,7 @@ end
-- bonus
function fonts.otf.nametoslot(name)
- local tfmdata = fonts.ids[font.current()]
+ local tfmdata = fonts.identifiers[font.current()]
if tfmdata and tfmdata.shared then
local otfdata = tfmdata.shared.otfdata
local unicode = otfdata.luatex.unicodes[name]
@@ -310,3 +310,45 @@ fonts.strippables = table.tohash {
0xE0077, 0xE0078, 0xE0079, 0xE007A, 0xE007B, 0xE007C, 0xE007D, 0xE007E, 0xE007F,
}
+-- \font\test=file:somefont:reencode=mymessup
+--
+-- fonts.enc.reencodings.mymessup = {
+-- [109] = 110, -- m
+-- [110] = 109, -- n
+-- }
+
+fonts.enc = fonts.enc or {}
+local reencodings = { }
+fonts.enc.reencodings = reencodings
+
+local function specialreencode(tfmdata,value)
+ -- we forget about kerns as we assume symbols and we
+ -- could issue a message if ther are kerns but it's
+ -- a hack anyway so we odn't care too much here
+ local encoding = value and reencodings[value]
+ if encoding then
+ local temp = { }
+ local char = tfmdata.characters
+ for k, v in next, encoding do
+ temp[k] = char[v]
+ end
+ for k, v in next, temp do
+ char[k] = temp[k]
+ end
+ -- if we use the font otherwise luatex gets confused so
+ -- we return an additional hash component for fullname
+ return string.format("reencoded:%s",value)
+ end
+end
+
+local function reencode(tfmdata,value)
+ tfmdata.postprocessors = tfmdata.postprocessors or { }
+ table.insert(tfmdata.postprocessors,
+ function(tfmdata)
+ return specialreencode(tfmdata,value)
+ end
+ )
+end
+
+table.insert(fonts.manipulators,"reencode")
+fonts.initializers.base.otf.reencode = reencode