summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-ctx.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-11 14:46:40 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-11 14:46:40 +0200
commit01440ae8999ee20351f0538792e415ade8cd3d5c (patch)
treec584f971a45a08be431ec25a61417beaf088fcc5 /tex/context/base/mkiv/font-ctx.lua
parentbfc7bd2349855039534e8854a97c47864b1eba09 (diff)
downloadcontext-01440ae8999ee20351f0538792e415ade8cd3d5c.tar.gz
2016-08-11 14:00:00
Diffstat (limited to 'tex/context/base/mkiv/font-ctx.lua')
-rw-r--r--tex/context/base/mkiv/font-ctx.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 33945083e..2f51f5129 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -978,6 +978,8 @@ local getspecification = definers.getspecification
-- we can make helper macros which saves parsing (but normaly not
-- that many calls, e.g. in mk a couple of 100 and in metafun 3500)
+local specifiers = { }
+
do -- else too many locals
----- ctx_setdefaultfontname = context.fntsetdefname
@@ -992,6 +994,7 @@ do -- else too many locals
local scanners = tokens.scanners
local scanstring = scanners.string
local scaninteger = scanners.integer
+ local scannumber = scanners.number
local scanboolean = scanners.boolean
local setmacro = tokens.setters.macro
@@ -1225,6 +1228,7 @@ do -- else too many locals
end
--
texsetcount("global","lastfontid",lastfontid)
+ specifiers[lastfontid] = { str, size }
if not mathsize then
-- forget about it
elseif mathsize == 0 then
@@ -1236,6 +1240,26 @@ do -- else too many locals
stoptiming(fonts)
end
+ function scanners.specifiedfontspec()
+ local f = specifiers[scaninteger()]
+ if f then
+ context(f[1])
+ end
+ end
+ function scanners.specifiedfontsize()
+ local f = specifiers[scaninteger()]
+ if f then
+ context(f[2])
+ end
+ end
+ function scanners.specifiedfont()
+ local f = specifiers[scaninteger()]
+ local s = scannumber()
+ if f and s then
+ context("%s at %0.2p",f[1],s * f[2]) -- we round to 2 decimals (as at the tex end)
+ end
+ end
+
--
function definers.define(specification)