summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/char-ini.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-02-17 12:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-02-17 12:15:07 +0100
commitb13dd166ce8563c60c10affc97ab28940d6a7776 (patch)
tree6b15f0462d36ae916875ce1fbcdd990660d3f410 /tex/context/base/mkiv/char-ini.lua
parenta036ac2dd19b592316e1b479360e9e6c6700e935 (diff)
downloadcontext-b13dd166ce8563c60c10affc97ab28940d6a7776.tar.gz
2016-02-17 11:13:00
Diffstat (limited to 'tex/context/base/mkiv/char-ini.lua')
-rw-r--r--tex/context/base/mkiv/char-ini.lua43
1 files changed, 41 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index b59c9db6d..ad53cae8f 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -12,7 +12,7 @@ if not modules then modules = { } end modules ['char-ini'] = {
-- we can remove the tag range starting at 0xE0000 (special applications)
local utfchar, utfbyte, utfvalues, ustring, utotable = utf.char, utf.byte, utf.values, utf.ustring, utf.totable
-local concat, unpack, tohash = table.concat, table.unpack, table.tohash
+local concat, unpack, tohash, insert = table.concat, table.unpack, table.tohash, table.insert
local next, tonumber, type, rawget, rawset = next, tonumber, type, rawget, rawset
local format, lower, gsub = string.format, string.lower, string.gsub
local P, R, S, Cs = lpeg.P, lpeg.R, lpeg.S, lpeg.Cs
@@ -128,7 +128,7 @@ setmetatableindex(data, function(t,k)
if k >= rr.first and k <= rr.last then
local extender = rr.extender
if extender then
- local v = extender(k,v)
+ local v = extender(k)
t[k] = v
return v
end
@@ -138,6 +138,45 @@ setmetatableindex(data, function(t,k)
return private -- handy for when we loop over characters in fonts and check for a property
end)
+local variant_selector_metatable = {
+ category = "mn",
+ cjkwd = "a",
+ direction = "nsm",
+ linebreak = "cm",
+}
+
+-- This saves a bit of memory and also serves as example.
+
+local f_variant = string.formatters["VARIATION SELECTOR-0x%04X"]
+
+insert(characters.ranges,{
+ first = 0xFE00,
+ last = 0xFE0F,
+ name = "variant selector",
+ extender = function(k)
+ local t = {
+ description = f_variant(k - 0xFE00 + 0x0001),
+ unicodeslot = k,
+ }
+ setmetatable(t,variant_selector_metatable)
+ return t
+ end,
+})
+
+insert(characters.ranges,{
+ first = 0xE0100,
+ last = 0xE01EF,
+ name = "variant selector extension",
+ extender = function(k)
+ local t = {
+ description = f_variant(k - 0xE0100 + 0x0011),
+ unicodeslot = k,
+ }
+ setmetatable(t,variant_selector_metatable)
+ return t
+ end,
+})
+
local blocks = allocate {
["aegeannumbers"] = { first = 0x10100, last = 0x1013F, description = "Aegean Numbers" },
["ahom"] = { first = 0x11700, last = 0x1173F, description = "Ahom" },