diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-04-13 15:51:39 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-04-13 15:51:39 +0200 |
commit | 25fcad7435f56cdce2658336909f4da6a65589c0 (patch) | |
tree | c23d5d04a7e86c7ddc2ebeca06d3de63ebdc806e /tex/context/base/mkiv/font-vfc.lua | |
parent | 1e5d7f41ddede5e6400a2a7762032823d3545df4 (diff) | |
download | context-25fcad7435f56cdce2658336909f4da6a65589c0.tar.gz |
2018-04-13 15:02:00
Diffstat (limited to 'tex/context/base/mkiv/font-vfc.lua')
-rw-r--r-- | tex/context/base/mkiv/font-vfc.lua | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/font-vfc.lua b/tex/context/base/mkiv/font-vfc.lua new file mode 100644 index 000000000..cac225de6 --- /dev/null +++ b/tex/context/base/mkiv/font-vfc.lua @@ -0,0 +1,98 @@ +if not modules then modules = { } end modules ['font-vfc'] = { + version = 1.001, + comment = "companion to font-ini.mkiv and hand-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local select = select +local insert = table.insert + +local fonts = fonts +local helpers = fonts.helpers + +local setmetatableindex = table.setmetatableindex +local makeweak = table.makeweak + +-- Helpers dealing with virtual fonts: beware, these are final values so +-- don't change the content of tables gotten this way! + +local push = { "push" } +local pop = { "pop" } +local dummy = { "comment" } + +function helpers.prependcommands(commands,...) + insert(commands,1,push) + for i=select("#",...),1,-1 do + local s = select(i,...) + if s then + insert(commands,1,s) + end + end + insert(commands,pop) + return commands +end + +function helpers.appendcommands(commands,...) + insert(commands,1,push) + insert(commands,pop) + for i=1,select("#",...) do + local s = select(i,...) + if s then + insert(commands,s) + end + end + return commands +end + +-- todo: maybe weak +-- todo: maybe indirect so that we can't change them + +local char = setmetatableindex(function(t,k) + local v = { "char", k } + t[k] = v + return v +end) + +local right = setmetatableindex(function(t,k) + local v = { "right", k } + t[k] = v + return v +end) + +local left = setmetatableindex(function(t,k) + local v = { "right", -k } + t[k] = v + return v +end) + +local down = setmetatableindex(function(t,k) + local v = { "down", k } + t[k] = v + return v +end) + +local up = setmetatableindex(function(t,k) + local v = { "down", -k } + t[k] = v + return v +end) + +-- makeweak(char) +-- makeweak(right) +-- makeweak(left) +-- makeweak(up) +-- makeweak(down) + +helpers.commands = utilities.storage.allocate { + char = char, + right = right, + left = left, + down = down, + up = up, + push = push, + pop = pop, + dummy = dummy, +} + |