diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-05-18 10:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-05-18 10:57:00 +0200 |
commit | cf10a29d938a8fd2ad81f8034b53ee7409990169 (patch) | |
tree | 1c53e21b95e86196c426a4cdda48000c6174eb8e /tex/generic | |
parent | 89f1dbd1efbc71e5a74d798142ae5275e6f097ff (diff) | |
download | context-cf10a29d938a8fd2ad81f8034b53ee7409990169.tar.gz |
beta 2010.05.18 10:57
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index b765a7cf6..1bfc9979b 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/14/10 15:26:38 +-- merge date : 05/18/10 10:57:58 do -- begin closure to overcome local limits and interference @@ -11077,8 +11077,6 @@ if not modules then modules = { } end modules ['font-otc'] = { local format, insert = string.format, table.insert local type, next = type, next -local ctxcatcodes = tex.ctxcatcodes - -- we assume that the other otf stuff is loaded already local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) @@ -11282,33 +11280,6 @@ fonts.initializers.node.otf.lineheight = fonts.initializers.common.lineheight fonts.initializers.base.otf.compose = fonts.initializers.common.compose fonts.initializers.node.otf.compose = fonts.initializers.common.compose --- bonus function - -function otf.name_to_slot(name) -- todo: afm en tfm - local tfmdata = fonts.ids[font.current()] - if tfmdata and tfmdata.shared then - local otfdata = tfmdata.shared.otfdata - local unicode = otfdata.luatex.unicodes[name] - if not unicode then - return string.byte("?") -- nil - elseif type(unicode) == "number" then - return unicode - else - return unicode[1] - end - end - return nil -end - -function otf.char(n) -- todo: afm en tfm - if type(n) == "string" then - n = otf.name_to_slot(n) - end - if n then - tex.sprint(ctxcatcodes,format("\\char%s ",n)) - end -end - end -- closure do -- begin closure to overcome local limits and interference @@ -12356,4 +12327,24 @@ fonts.otf.meanings.normalize = fonts.otf.meanings.normalize or function(t) end end +-- bonus + +function fonts.otf.name_to_slot(name) + local tfmdata = fonts.ids[font.current()] + if tfmdata and tfmdata.shared then + local otfdata = tfmdata.shared.otfdata + local unicode = otfdata.luatex.unicodes[name] + return unicode and (type(unicode) == "number" and unicode or unicode[1]) + end +end + +function fonts.otf.char(n) + if type(n) == "string" then + n = fonts.otf.name_to_slot(n) + end + if type(n) == "number" then + tex.sprint("\\char" .. n) + end +end + end -- closure |