diff options
Diffstat (limited to 'tex/context/base/font-map.lua')
-rw-r--r-- | tex/context/base/font-map.lua | 32 |
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 |