summaryrefslogtreecommitdiff
path: root/tex/context/base/font-map.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-05-27 10:20:22 +0300
committerMarius <mariausol@gmail.com>2013-05-27 10:20:22 +0300
commit6b2f7c5fd7a3e465f4e2662b1e5bd2c9d5cce8f8 (patch)
treeea2c6131288b8e0f494e6cc695ec6a3f6733a07f /tex/context/base/font-map.lua
parenta61813ccdd4b7bcc81932317e1360fda6c79962d (diff)
downloadcontext-6b2f7c5fd7a3e465f4e2662b1e5bd2c9d5cce8f8.tar.gz
stable 2013.05.27 09:10
Diffstat (limited to 'tex/context/base/font-map.lua')
-rw-r--r--tex/context/base/font-map.lua32
1 files changed, 19 insertions, 13 deletions
diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua
index 6988b9b9e..b3c8da0f6 100644
--- a/tex/context/base/font-map.lua
+++ b/tex/context/base/font-map.lua
@@ -155,15 +155,21 @@ mappings.tounicode16 = tounicode16
mappings.tounicode16sequence = tounicode16sequence
mappings.fromunicode16 = fromunicode16
-local separator = S("_.")
-local other = C((1 - separator)^1)
-local ligsplitter = Ct(other * (separator * other)^0)
+local ligseparator = P("_")
+local varseparator = P(".")
+local namesplitter = Ct(C((1 - ligseparator - varseparator)^1) * (ligseparator * C((1 - ligseparator - varseparator)^1))^0)
---~ print(table.serialize(lpegmatch(ligsplitter,"this")))
---~ print(table.serialize(lpegmatch(ligsplitter,"this.that")))
---~ print(table.serialize(lpegmatch(ligsplitter,"japan1.123")))
---~ print(table.serialize(lpegmatch(ligsplitter,"such_so_more")))
---~ print(table.serialize(lpegmatch(ligsplitter,"such_so_more.that")))
+-- local function test(name)
+-- local split = lpegmatch(namesplitter,name)
+-- print(string.formatters["%s: [% t]"](name,split))
+-- end
+
+-- test("i.f_")
+-- test("this")
+-- test("this.that")
+-- test("japan1.123")
+-- test("such_so_more")
+-- test("such_so_more.that")
function mappings.addtounicode(data,filename)
local resources = data.resources
@@ -254,13 +260,13 @@ function mappings.addtounicode(data,filename)
end
end
end
- -- a.whatever or a_b_c.whatever or a_b_c (no numbers)
+ -- a.whatever or a_b_c.whatever or a_b_c (no numbers) a.b_
if not unicode or unicode == "" then
- local split = lpegmatch(ligsplitter,name)
- local nplit = split and #split or 0
- if nplit >= 2 then
+ local split = lpegmatch(namesplitter,name)
+ local nsplit = split and #split or 0
+ if nsplit >= 2 then
local t, n = { }, 0
- for l=1,nplit do
+ for l=1,nsplit do
local base = split[l]
local u = unicodes[base] or unicodevector[base]
if not u then