diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/s-math-coverage.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/s-math-coverage.lua | 158 |
1 files changed, 63 insertions, 95 deletions
diff --git a/Master/texmf-dist/tex/context/base/s-math-coverage.lua b/Master/texmf-dist/tex/context/base/s-math-coverage.lua index 5f1c7cc5a17..56880f76db0 100644 --- a/Master/texmf-dist/tex/context/base/s-math-coverage.lua +++ b/Master/texmf-dist/tex/context/base/s-math-coverage.lua @@ -6,76 +6,37 @@ if not modules then modules = { } end modules ['s-math-coverage'] = { license = "see context related readme files" } -moduledata.math = moduledata.math or { } -moduledata.math.coverage = moduledata.math.coverage or { } - local utfchar, utfbyte = utf.char, utf.byte local formatters, lower = string.formatters, string.lower local concat = table.concat -local context = context -local NC, NR, HL = context.NC, context.NR, context.HL -local char, getglyph, bold = context.char, context.getglyph, context.bold +moduledata.math = moduledata.math or { } +moduledata.math.coverage = moduledata.math.coverage or { } -local ucgreek = { - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, - 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, - 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, - 0x03A6, 0x03A7, 0x03A8, 0x03A9 -} +local context = context -local lcgreek = { - 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, - 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, - 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, - 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, - 0x03D1, 0x03D5, 0x03D6, 0x03F0, 0x03F1, - 0x03F4, 0x03F5 -} +local ctx_NC = context.NC +local ctx_NR = context.NR +local ctx_HL = context.HL -local ucletters = { - 0x00041, 0x00042, 0x00043, 0x00044, 0x00045, - 0x00046, 0x00047, 0x00048, 0x00049, 0x0004A, - 0x0004B, 0x0004C, 0x0004D, 0x0004E, 0x0004F, - 0x00050, 0x00051, 0x00052, 0x00053, 0x00054, - 0x00055, 0x00056, 0x00057, 0x00058, 0x00059, - 0x0005A, -} +local ctx_rawmathematics = context.formatted.rawmathematics +local ctx_mathematics = context.formatted.mathematics +local ctx_startimath = context.startimath +local ctx_stopimath = context.stopimath +local ctx_setmathattribute = context.setmathattribute +local ctx_underbar = context.underbar +local ctx_getglyph = context.getglyph -local lcletters = { - 0x00061, 0x00062, 0x00063, 0x00064, 0x00065, - 0x00066, 0x00067, 0x00068, 0x00069, 0x0006A, - 0x0006B, 0x0006C, 0x0006D, 0x0006E, 0x0006F, - 0x00070, 0x00071, 0x00072, 0x00073, 0x00074, - 0x00075, 0x00076, 0x00077, 0x00078, 0x00079, - 0x0007A, -} +local styles = mathematics.styles +local alternatives = mathematics.alternatives +local charactersets = mathematics.charactersets -local digits = { - 0x00030, 0x00031, 0x00032, 0x00033, 0x00034, - 0x00035, 0x00036, 0x00037, 0x00038, 0x00039, -} - -local styles = { - "regular", "sansserif", "monospaced", "fraktur", "script", "blackboard" -} +local getboth = mathematics.getboth +local remapalphabets = mathematics.remapalphabets -local alternatives = { - "normal", "bold", "italic", "bolditalic" -} - -local alphabets = { - ucletters, lcletters, ucgreek, lcgreek, digits, -} - -local getboth = mathematics.getboth -local remapalphabets = mathematics.remapalphabets - -local chardata = characters.data -local superscripts = characters.superscripts -local subscripts = characters.subscripts +local chardata = characters.data +local superscripts = characters.superscripts +local subscripts = characters.subscripts context.writestatus("math coverage","underline: not remapped") @@ -85,37 +46,37 @@ function moduledata.math.coverage.showalphabets() local style = styles[i] for i=1,#alternatives do local alternative = alternatives[i] - for i=1,#alphabets do - local alphabet = alphabets[i] - NC() + for i=1,#charactersets do + local alphabet = charactersets[i] + ctx_NC() if i == 1 then context("%s %s",style,alternative) end - NC() - context.startimath() - context.setmathattribute(style,alternative) + ctx_NC() + ctx_startimath() + ctx_setmathattribute(style,alternative) for i=1,#alphabet do local letter = alphabet[i] local id = getboth(style,alternative) local unicode = remapalphabets(letter,id) if not unicode then - context.underbar(utfchar(letter)) + ctx_underbar(utfchar(letter)) elseif unicode == letter then context(utfchar(unicode)) else context(utfchar(unicode)) end end - context.stopimath() - NC() + ctx_stopimath() + ctx_NC() local first = alphabet[1] local last = alphabet[#alphabet] local id = getboth(style,alternative) local f_unicode = remapalphabets(first,id) or utfbyte(first) local l_unicode = remapalphabets(last,id) or utfbyte(last) context("%05X - %05X",f_unicode,l_unicode) - NC() - NR() + ctx_NC() + ctx_NR() end end end @@ -126,15 +87,15 @@ function moduledata.math.coverage.showcharacters() context.startmixedcolumns() context.setupalign { "nothyphenated" } context.starttabulate { "|T|i2|Tpl|" } - for u, d in table.sortedpairs(chardata) do + for u, d in table.sortedhash(chardata) do local mathclass = d.mathclass local mathspec = d.mathspec if mathclass or mathspec then - NC() + ctx_NC() context("%05X",u) - NC() - getglyph("MathRoman",u) - NC() + ctx_NC() + ctx_getglyph("MathRoman",u) + ctx_NC() if mathspec then local t = { } for i=1,#mathspec do @@ -145,8 +106,8 @@ function moduledata.math.coverage.showcharacters() else context(mathclass) end - NC() - NR() + ctx_NC() + ctx_NR() end end context.stoptabulate() @@ -157,26 +118,33 @@ end function moduledata.math.coverage.showscripts() context.starttabulate { "|cT|c|cT|c|c|c|l|" } - for k, v in table.sortedpairs(table.merged(superscripts,subscripts)) do + for k, v in table.sortedhash(table.merged(superscripts,subscripts)) do local ck = utfchar(k) local cv = utfchar(v) local ss = superscripts[k] and "^" or "_" - NC() - context("%05X",k) - NC() - context(ck) - NC() - context("%05X",v) - NC() - context(cv) - NC() - context.formatted.rawmathematics("x%s = x%s%s",ck,ss,cv) - NC() - context.formatted.mathematics("x%s = x%s%s",ck,ss,cv) - NC() - context(lower(chardata[k].description)) - NC() - NR() + ctx_NC() context("%05X",k) + ctx_NC() context(ck) + ctx_NC() context("%05X",v) + ctx_NC() context(cv) + ctx_NC() ctx_rawmathematics("x%s = x%s%s",ck,ss,cv) + ctx_NC() ctx_mathematics("x%s = x%s%s",ck,ss,cv) + ctx_NC() context(lower(chardata[k].description)) + ctx_NC() ctx_NR() + end + context.stoptabulate() +end + +-- Handy too. + +function moduledata.math.coverage.showbold() + context.starttabulate { "|lT|cm|lT|cm|lT|" } + for k, v in table.sortedhash(mathematics.boldmap) do + ctx_NC() context("%U",k) + ctx_NC() context("%c",k) + ctx_NC() context("%U",v) + ctx_NC() context("%c",v) + ctx_NC() context(chardata[k].description) + ctx_NC() ctx_NR() end context.stoptabulate() end |