From fdf6650bc19c97b288d2a85e3419064608544594 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 16 May 2013 23:48:00 +0200 Subject: beta 2013.05.16 23:48 --- tex/context/base/cldf-bas.lua | 23 ++- tex/context/base/colo-ini.lua | 4 +- tex/context/base/cont-fil.mkiv | 4 + tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4133 -> 4133 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/file-mod.mkvi | 38 +++-- tex/context/base/font-ini.mkvi | 14 ++ tex/context/base/math-ini.lua | 42 +++-- tex/context/base/math-ini.mkiv | 20 +++ tex/context/base/mult-low.lua | 2 + tex/context/base/phys-dim.mkiv | 8 +- tex/context/base/s-fnt-11.mkiv | 10 +- tex/context/base/s-fnt-23.mkiv | 2 - tex/context/base/s-fnt-26.mkiv | 82 ---------- tex/context/base/s-fnt-28.mkiv | 46 ------ tex/context/base/s-fnt-29.mkiv | 71 -------- tex/context/base/s-fnt-31.mkiv | 180 --------------------- tex/context/base/s-fnt-32.mkiv | 60 ------- tex/context/base/s-fonts-goodies.lua | 117 ++++++++++++++ tex/context/base/s-fonts-goodies.mkiv | 37 +++++ tex/context/base/s-fonts-missing.lua | 4 +- tex/context/base/s-fonts-missing.mkiv | 4 +- tex/context/base/s-fonts-shapes.lua | 62 +++++++ tex/context/base/s-fonts-shapes.mkiv | 44 +++++ tex/context/base/s-fonts-tables.lua | 18 +-- tex/context/base/s-fonts-tables.mkiv | 10 +- tex/context/base/s-math-coverage.lua | 167 ++++++++++++++++--- tex/context/base/s-math-coverage.mkiv | 121 ++++++++++++-- tex/context/base/status-files.pdf | Bin 24746 -> 24727 bytes tex/context/base/status-lua.pdf | Bin 211639 -> 211857 bytes tex/context/base/status-mkiv.lua | 37 ++--- tex/context/base/util-prs.lua | 41 ++++- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 34 files changed, 717 insertions(+), 557 deletions(-) delete mode 100644 tex/context/base/s-fnt-26.mkiv delete mode 100644 tex/context/base/s-fnt-28.mkiv delete mode 100644 tex/context/base/s-fnt-29.mkiv delete mode 100644 tex/context/base/s-fnt-31.mkiv delete mode 100644 tex/context/base/s-fnt-32.mkiv create mode 100644 tex/context/base/s-fonts-goodies.lua create mode 100644 tex/context/base/s-fonts-goodies.mkiv create mode 100644 tex/context/base/s-fonts-shapes.lua create mode 100644 tex/context/base/s-fonts-shapes.mkiv (limited to 'tex') diff --git a/tex/context/base/cldf-bas.lua b/tex/context/base/cldf-bas.lua index 08d881271..6adeb2272 100644 --- a/tex/context/base/cldf-bas.lua +++ b/tex/context/base/cldf-bas.lua @@ -29,12 +29,16 @@ local format = string.format local utfchar = utf.char local concat = table.concat -local context = context -local generics = context.generics -local variables = interfaces.variables +local context = context +local generics = context.generics +local variables = interfaces.variables -local new_rule = nodes.pool.rule -local texcount = tex.count +local nodepool = nodes.pool +local new_rule = nodepool.rule +local new_glyph = nodepool.glyph + +local current_font = font.current +local texcount = tex.count function context.char(k) -- used as escape too, so don't change to utf if type(k) == "table" then @@ -83,6 +87,15 @@ function context.hrule(w,h,d,dir) end end +function context.glyph(id,k) + if id then + if not k then + id, k = current_font(), id + end + context(new_glyph(id,k)) + end +end + context.vrule = context.hrule --~ local hbox, bgroup, egroup = context.hbox, context.bgroup, context.egroup diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 148733932..b9e8eb203 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -39,8 +39,6 @@ local attributes_list = attributes.list local colorvalues = colors.values local transparencyvalues = transparencies.values -local texattribute = tex.attribute - colors.sets = colors.sets or { } -- sets are mostly used for local colorsets = colors.sets -- showing lists of defined local colorset = { } -- colors @@ -500,7 +498,7 @@ local function mpcolor(model,ca,ta,default) end local function mpnamedcolor(name) - return mpcolor(texattribute[a_colorspace],l_color[name] or l_color.black) + return mpcolor(gettexattribute(a_colorspace),l_color[name] or l_color.black) end local function mpoptions(model,ca,ta,default) -- will move to mlib-col diff --git a/tex/context/base/cont-fil.mkiv b/tex/context/base/cont-fil.mkiv index 42d333992..93a135170 100644 --- a/tex/context/base/cont-fil.mkiv +++ b/tex/context/base/cont-fil.mkiv @@ -105,8 +105,12 @@ % downward compatible mapping: \definefilesynonym [pre-41] [present-tiles] +\definefilesynonym [fnt-29] [fonts-shapes] \definefilesynonym [fnt-33] [math-coverage] +\definefilesynonym [mat-12] [math-parameters] \definefilesynonym [mat-20] [math-parameters] +\definefilesynonym [fnt-25] [math-characters] +\definefilesynonym [fnt-28] [fonts-goodies] \definefilesynonym [mat-10] [math-characters] \definefilesynonym [mat-11] [math-characters] diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 56058a1bd..8574253c9 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.05.16 13:51} +\newcontextversion{2013.05.16 23:48} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 899723dde..aea5cbfaa 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8d68cc543..93569d55d 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.05.16 13:51} +\edef\contextversion{2013.05.16 23:48} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/file-mod.mkvi b/tex/context/base/file-mod.mkvi index 3140b35de..cd7970292 100644 --- a/tex/context/base/file-mod.mkvi +++ b/tex/context/base/file-mod.mkvi @@ -240,26 +240,36 @@ %D Relatively new: -\unexpanded\def\syst_modules_direct_lua#1% - {\ctxlua{#1()}} - -\unexpanded\def\syst_modules_single_lua#1% - {\edef\m_module_command_function{#1}% +\unexpanded\def\syst_modules_direct_lua#1#2% + {\edef\m_module_command_command {#1}% + \edef\m_module_command_function{#2}% + \directsetup{module:\m_module_command_command:start}% + \ctxlua{\m_module_command_function()}% + \directsetup{module:\m_module_command_command:stop}} + +\unexpanded\def\syst_modules_single_lua#1#2% + {\edef\m_module_command_command {#1}% + \edef\m_module_command_function{#2}% \dosingleempty\syst_modules_single_lua_indeed} -\def\syst_modules_single_lua_indeed[#1]% - {\ctxlua{\m_module_command_function(\!!bs#1\!!es)}} +\unexpanded\def\syst_modules_single_lua_indeed[#1]% + {\directsetup{module:\m_module_command_command:start}% + \ctxlua{\m_module_command_function(\!!bs#1\!!es)}% + \directsetup{module:\m_module_command_command:stop}} -\unexpanded\def\syst_modules_double_lua#1% - {\edef\m_module_command_function{#1}% +\unexpanded\def\syst_modules_double_lua#1#2% + {\edef\m_module_command_command {#1}% + \edef\m_module_command_function{#2}% \dodoubleempty\syst_modules_double_lua_indeed} -\def\syst_modules_double_lua_indeed[#1][#2]% - {\ctxlua{\m_module_command_function(\!!bs#1\!!es,\!!bs#2\!!es)}} +\unexpanded\def\syst_modules_double_lua_indeed[#1][#2]% + {\directsetup{module:\m_module_command_command:start}% + \ctxlua{\m_module_command_function(\!!bs#1\!!es,\!!bs#2\!!es)}% + \directsetup{module:\m_module_command_command:stop}} -\def\installmodulecommandlua #1#2{\unexpanded\def#1{\syst_modules_direct_lua{#2}}} -\def\installmodulecommandluasingle#1#2{\unexpanded\def#1{\syst_modules_single_lua{#2}}} -\def\installmodulecommandluadouble#1#2{\unexpanded\def#1{\syst_modules_double_lua{#2}}} +\def\installmodulecommandlua #1#2{\unexpanded\def#1{\normalexpanded{\syst_modules_direct_lua{\strippedcsname#1}{#2}}}} +\def\installmodulecommandluasingle#1#2{\unexpanded\def#1{\normalexpanded{\syst_modules_single_lua{\strippedcsname#1}{#2}}}} +\def\installmodulecommandluadouble#1#2{\unexpanded\def#1{\normalexpanded{\syst_modules_double_lua{\strippedcsname#1}{#2}}}} % obsolete % diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index 63b7863c8..5f7aaa92f 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -2297,4 +2297,18 @@ \unexpanded\def\font_basics_predefined#1% {\font_basics_predefine{\??predefinedfont#1}{#1}} +%D Handy helper: + +\unexpanded\def\savedefinedfont[#1]% + {\bgroup + \definedfont[#1]% + \xdef\saveddefinedfontid {\number\fontid\font}% + \xdef\saveddefinedfontname{\fontname\font}% + \egroup} + +\def\saveddefinedfontid {\number\fontid\font} +\def\saveddefinedfontname{\fontname\font} + + + \protect \endinput diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index 20c98afbe..7ba1d4514 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -15,10 +15,10 @@ if not modules then modules = { } end modules ['math-ini'] = { -- to the fam when set ... we use other means .. ok, we could use it for spacing but -- then we also have to set the other characters (only a subset done now) -local formatters = string.formatters +local formatters, find = string.formatters, string.find local utfchar, utfbyte = utf.char, utf.byte local setmathcode, setdelcode = tex.setmathcode, tex.setdelcode -local texattribute = tex.attribute +local settexattribute = tex.setattribute local floor = math.floor local context = context @@ -26,19 +26,19 @@ local context = context local contextsprint = context.sprint local contextfprint = context.fprint -- a bit inefficient -local allocate = utilities.storage.allocate - local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) local report_math = logs.reporter("mathematics","initializing") -mathematics = mathematics or { } -local mathematics = mathematics +mathematics = mathematics or { } +local mathematics = mathematics mathematics.extrabase = 0xFE000 -- here we push some virtuals mathematics.privatebase = 0xFF000 -- here we push the ex -local chardata = characters.data +local unsetvalue = attributes.unsetvalue +local allocate = utilities.storage.allocate +local chardata = characters.data local families = allocate { mr = 0, @@ -491,10 +491,10 @@ end -- -- function commands.taggedmathfunction(tag,label) -- if label then --- texattribute[a_mathcategory] = registercategory(1,tag,tag) +-- settexattribute(a_mathcategory,registercategory(1,tag,tag)) -- context.mathlabeltext(tag) -- else --- texattribute[a_mathcategory] = 1 +-- settexattribute(a_mathcategory,1) -- context(tag) -- end -- end @@ -517,13 +517,31 @@ function commands.taggedmathfunction(tag,label,apply) noffunctions = noffunctions + 1 functions[noffunctions] = tag functions[tag] = noffunctions - texattribute[a_mathcategory] = noffunctions + delta + settexattribute(a_mathcategory,noffunctions + delta) else - texattribute[a_mathcategory] = n + delta + settexattribute(a_mathcategory,n + delta) end context.mathlabeltext(tag) else - texattribute[a_mathcategory] = 1000 + delta + settexattribute(a_mathcategory,1000 + delta) context(tag) end end + +-- + +local list + +function commands.resetmathattributes() + if not list then + list = { } + for k, v in next, attributes.numbers do + if find(k,"^math") then + list[#list+1] = v + end + end + end + for i=1,#list do + settexattribute(list[i],unsetvalue) + end +end diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 72daa8341..c19e24365 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -71,6 +71,26 @@ \setnewconstant\defaultmathfamily \zerocount % 255 +\unexpanded\def\resetmathattributes{\ctxcommand{resetmathattributes()}} + +% \unexpanded\def\rawmathcharacter#1% slow but only for tracing +% {\begingroup +% \ifmmode +% \resetmathattributes\Uchar#1% +% \else +% \startimath\resetmathattributes\Uchar#1\stopimath +% \fi +% \endgroup} + +\unexpanded\def\rawmathematics#1% slow but only for tracing + {\begingroup + \ifmmode + \resetmathattributes#1% + \else + \startimath\resetmathattributes#1\stopimath + \fi + \endgroup} + %D Some measures (maybe spac-mth): % \def\mathskipsmall {\mskip\thinmuskip} diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 2e960114e..867235b33 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -142,6 +142,8 @@ return { "then", "begcsname", -- + "strippedcsname", + -- "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index 4efaa65a8..73cc2ea25 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -519,13 +519,13 @@ \fi} \unexpanded\def\checkedtextcelsius - {\iffontchar\font"2103\relax\iffontchar\font"2109\relax - ℉\else\phys_units_text_celsius\fi\else\phys_units_text_celsius + {\iffontchar\font"2103\relax + ℃\else\phys_units_text_celsius \fi} \unexpanded\def\checkedtextfahrenheit - {\iffontchar\font"2109\relax\iffontchar\font"2103\relax - ℉\else\phys_units_text_fahrenheit\fi\else\phys_units_text_fahrenheit + {\iffontchar\font"2109\relax + ℉\else\phys_units_text_fahrenheit \fi} \setelementnature[unit] [mixed] diff --git a/tex/context/base/s-fnt-11.mkiv b/tex/context/base/s-fnt-11.mkiv index a91e069ea..db803eefc 100644 --- a/tex/context/base/s-fnt-11.mkiv +++ b/tex/context/base/s-fnt-11.mkiv @@ -70,4 +70,12 @@ end \ctxlua{fonts.names.table("#1",\reload,\all)}% \egroup} -\protect \endinput +\protect + +\continueifinputfile{s-fnt-11.mkiv} + +\starttext + +\showinstalledfonts + +\stoptext diff --git a/tex/context/base/s-fnt-23.mkiv b/tex/context/base/s-fnt-23.mkiv index 17fc5463d..283f751ea 100644 --- a/tex/context/base/s-fnt-23.mkiv +++ b/tex/context/base/s-fnt-23.mkiv @@ -237,7 +237,6 @@ \def\StartShowGlyphShape#1% {\startTEXpage - \nonknuthmode % default anyway \def\GlyphUnicode{#1}} \def\StopShowGlyphShape @@ -254,7 +253,6 @@ \def\ShowAllGlyphShapes#1#2% name size {\begingroup - \nonknuthmode % default anyway \definedfont[#1 at #2]% \ctxlua{moduledata.fonts.show_all_shapes()}% \endgroup} diff --git a/tex/context/base/s-fnt-26.mkiv b/tex/context/base/s-fnt-26.mkiv deleted file mode 100644 index 904091f06..000000000 --- a/tex/context/base/s-fnt-26.mkiv +++ /dev/null @@ -1,82 +0,0 @@ -%D \module -%D [ file=s-fnt-26, -%D version=2009.10.26, -%D title=\CONTEXT\ Style File, -%D subtitle=Goodies Tables, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode - - function document.show_goodies_stylistics(name) - local goodies = fonts.goodies.load(name) - local stylistics = goodies and goodies.stylistics - if stylistics then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("feature") col() context("meaning") col() row() - for feature, meaning in table.sortedpairs(stylistics) do - col() type(feature) col() type(meaning) col() row() - end - context.stoptabulate() - end - end - - function document.show_goodies_featuresets(name) - local goodies = fonts.goodies.load(name) - local featuresets = goodies and goodies.featuresets - if featuresets then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("featureset") col() context("definitions") col() row() - for featureset, definitions in table.sortedpairs(featuresets) do - col() type(featureset) col() - for k, v in table.sortedpairs(definitions) do - type(string.format("%s=%s",k,tostring(v))) - context.quad() - end - col() row() - end - context.stoptabulate() - end - end - - function document.show_goodies_colorschemes(name) - local goodies = fonts.goodies.load(name) - local colorschemes = goodies and goodies.colorschemes - if colorschemes then - local col, row, type = context.NC, context.NR, context.type - context.starttabulate { "|l|pl|" } - col() context("colorscheme") col() context("numbers") col() row() - for colorscheme, numbers in table.sortedpairs(colorschemes) do - col() type(colorscheme) col() - for i=1,#numbers do - type(i) - context.quad() - end - col() row() - end - context.stoptabulate() - end - end - -\stopluacode - -\def\showgoodiesstylistics #1{\ctxlua{document.show_goodies_stylistics ("#1")}} -\def\showgoodiesfeaturesets #1{\ctxlua{document.show_goodies_featuresets ("#1")}} -\def\showgoodiescolorschemes#1{\ctxlua{document.show_goodies_colorschemes("#1")}} - -\continueifinputfile{s-fnt-26.mkiv} - -\starttext - - \showgoodiesstylistics {husayni} - \showgoodiesfeaturesets {husayni} - \showgoodiescolorschemes{husayni} - -\stoptext diff --git a/tex/context/base/s-fnt-28.mkiv b/tex/context/base/s-fnt-28.mkiv deleted file mode 100644 index 778a4c390..000000000 --- a/tex/context/base/s-fnt-28.mkiv +++ /dev/null @@ -1,46 +0,0 @@ -%D \module -%D [ file=s-fnt-28, -%D version=2010.09.22, -%D title=\CONTEXT\ Style File, -%D subtitle=Tracing Names, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode - function fonts.tracers.files(goodyfile) - local goodies = fonts.goodies.load(goodyfile) - if goodies then - local files = goodies.files - if files and files.list then - for filename, specification in table.sortedpairs(files.list) do - context.start() - context.dontleavehmode() - context.definedfont{ filename .. "*default" } - context("%s-%s-%s-%s-%s", - specification.name or files.name, - specification.weight or "normal", - specification.style or "normal", - specification.width or "normal", - specification.variant or "normal") - context.par() - context.stop() - end - end - end - end -\stopluacode - -\continueifinputfile{s-fnt-28.mkiv} - -\starttext - - \loadfontgoodies[antykwapoltawskiego] - - \ctxlua{fonts.tracers.files("antykwapoltawskiego")} - -\stoptext diff --git a/tex/context/base/s-fnt-29.mkiv b/tex/context/base/s-fnt-29.mkiv deleted file mode 100644 index f9e0a1658..000000000 --- a/tex/context/base/s-fnt-29.mkiv +++ /dev/null @@ -1,71 +0,0 @@ -%D \module -%D [ file=s-fnt-29, -%D version=2010.09.27, -%D title=\CONTEXT\ Style File, -%D subtitle=Tracing Shapes, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode - - local fontdata = fonts.hashes.identifiers - - function fonts.tracers.shapes() -- todo: ranges - local NC, NR = context.NC, context.NR - local char = context.char - local chrs = fontdata[font.current()].characters - -- local desc = fontdata[font.current()].descriptions - context.starttabulate { "|l|c|c|c|c|l|" } - context.FL() - NC() context("unicode") - NC() context("glyph") - NC() context("shape") - NC() context("lower") - NC() context("upper") - -- NC() context("name") - NC() context("description") - NC() NR() - context.TL() - for k, v in next, characters.data do - if chrs[k] then - NC() context("0x%05X",k) - NC() char(k) - NC() char(v.shcode) - NC() char(v.lccode or k) - NC() char(v.uccode or k) - -- NC() context(desc[k].name) - NC() context(v.description) - NC() NR() - end - end - context.stoptabulate() - end - -\stopluacode - -\continueifinputfile{s-fnt-29.mkiv} - -\setupbodyfont[dejavu,tt,9pt] - -\setuplayout - [backspace=1cm, - topspace=1cm, - footer=1cm, - header=0cm, - height=middle, - width=middle] - -\setupfootertexts - [] - [\fontname\font\quad\pagenumber] - -\starttext - - \ctxlua{fonts.tracers.shapes()} - -\stoptext diff --git a/tex/context/base/s-fnt-31.mkiv b/tex/context/base/s-fnt-31.mkiv deleted file mode 100644 index 24f7f2d7e..000000000 --- a/tex/context/base/s-fnt-31.mkiv +++ /dev/null @@ -1,180 +0,0 @@ -%D \module -%D [ file=s-fnt-31, -%D version=2011.01.02, % about -%D title=\CONTEXT\ Style File, -%D subtitle=Comparing Fonts, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -% begin info -% -% title : compare glyphs in fonts -% -% comment : show glyphs in several fonts alongside in order to to compare coverage -% status : experimental, used for luatex testing -% -% end info - -\startluacode - -local format, upper, find = string.format, string.upper, string.find -local chardata = characters.data - -function fonts.tracers.coverage(fontfiles,pattern) -- todo: patterns - - local present, names = { }, { } - local pattern = pattern and upper(pattern) - - for i=1,#fontfiles do - local fontname = format("testfont-%s",i) - local fontfile = fontfiles[i] - local fontsize = tex.dimen.bodyfontsize - local id, fontdata = fonts.definers.define { - name = fontfile, - size = fontsize, - cs = fontname, - } - for k, v in next, fontdata.characters do - present[k] = true - end - names[i] = fontname - end - - local t = { } - - context.starttabulate {"|Tr" .. string.rep("|l",#names) .. "|" } - for i=1,#fontfiles do - local file = fontfiles[i] - t[#t+1] = i .. "=" .. file - context.NC() - context(i) - context.NC() - context.type(file) - context.NC() - context.NR() - end - context.stoptabulate() - - context.setupfootertexts { - table.concat(t," ") - } - - context.starttabulate {"|Tl" .. string.rep("|c",#names) .. "|Tl|" } - context.NC() - context.type("unicode") - context.NC() - for i=1,#names do - context.type(i) - context.NC() - end - context.type("description") - context.NC() - context.NR() - context.HL() - for k, v in table.sortedpairs(present) do - local description = chardata[k].description - if not pattern or (pattern == k) or (description and find(description,pattern)) then - context.NC() - context(format("%05X",k)) - context.NC() - for i=1,#names do - context.getvalue(names[i]) - context.char(k) - context.NC() - end - context(description) - context.NC() - context.NR() - end - end - context.stoptabulate() - -end - -\stopluacode - -\continueifinputfile{s-fnt-31.mkiv} - -\setupbodyfont[10pt] - -\setupfootertexts - [style=\ttx] - -\setuplayout - [backspace=1cm, - topspace=1cm, - footer=1cm, - header=0cm, - height=middle, - width=middle] - -\starttext - -% \startluacode -% fonts.tracers.coverage { -% "pirat.ttf", -% } -% \stopluacode - -% \startluacode -% fonts.tracers.coverage { -% -- "cambria.ttf", -% "lbr.afm", -% "LucidaBrightRegular.ttf", -% "lbi.afm", -% "LucidaBrightItalic.ttf", -% "lbd.afm", -% "LucidaBrightDemiBold.ttf", -% "lbdi.afm", -% "LucidaBrightDemiItalic.ttf", -% } -% \stopluacode - -% \startluacode -% fonts.tracers.coverage ( { -% "LucidaBrightRegular.ttf", -% "cambria.ttf", -% "iwona-regular.otf", -% "texgyrepagella-regular.otf", -% "texgyretermes-regular.otf", -% "texgyrebonum-regular.otf", -% "antpolt-regular.otf", -% }, "OGONEK") -% \stopluacode - -% \loadfontgoodies[lucida-math] -% \loadfontgoodies[lm-math] - -% \startluacode -% fonts.tracers.coverage { -% "LucidaBrightRegular.ttf", -% "LucidaBrightOne@lucida-math", -% "cambria.ttc(Cambria Math)", -% "xits-math.otf", -% "LMMath10-Regular@lmroman10-math", -% } -% \stopluacode - -% \loadfontgoodies[px-math] -% \loadfontgoodies[lm-math] - -\startluacode - fonts.tracers.coverage { - "cambria.ttc(Cambria Math)", - "xits-math.otf", - "stixmath-regular.otf", - -- "lmmath-regular", - -- "LMMath10-Regular@lmroman10-math", - -- "pxmath@px-math", - -- "lucida-math.otf", - -- "lucida-math-demi.otf", - -- "LinLibertine_Re-4.7.5.otf", - } -\stopluacode - -\stoptext diff --git a/tex/context/base/s-fnt-32.mkiv b/tex/context/base/s-fnt-32.mkiv deleted file mode 100644 index 20a939a97..000000000 --- a/tex/context/base/s-fnt-32.mkiv +++ /dev/null @@ -1,60 +0,0 @@ -%D \module -%D [ file=s-fnt-31, -%D version=2011.05.12, -%D title=\CONTEXT\ Style File, -%D subtitle=Unicode Math Scripts, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startluacode - function fonts.tracers.mathscripts() - context.starttabulate { "|cT|c|cT|c|c|l|" } - for k, v in table.sortedpairs(table.merged(characters.superscripts,characters.subscripts)) do - local ck = utf.char(k) - local cv = utf.char(v) - local ss = characters.superscripts[k] and "^" or "_" - context.NC() context("U+%05X",k) - context.NC() context(ck) - context.NC() context("U+%05X",v) - context.NC() context(cv) - context.NC() context("$x%s = x%s%s$",ck,ss,cv) - context.NC() context(string.lower(characters.data[k].description)) - context.NC() context.NR() - end - context.stoptabulate() - end -\stopluacode - -\continueifinputfile{s-fnt-32.mkiv} - -\setupbodyfont[dejavu,10pt] - -% \enabletrackers[math.normalizing] -% \setupbackend[export=yes] - -\setuplayout - [backspace=1cm, - topspace=1cm, - footer=1cm, - header=0cm, - height=middle, - width=middle] - -\starttext - -\startbuffer -$e=mc²$ ${}²$ $²$ $x²ᶞ$ $x⁽²⁺²⁼²⁺²⁾$ $x²⁺²⁼²⁺²$ $x₅²$ $x²₅²$ -\stopbuffer - -\typebuffer \getbuffer - -\startluacode - fonts.tracers.mathscripts() -\stopluacode - -\stoptext diff --git a/tex/context/base/s-fonts-goodies.lua b/tex/context/base/s-fonts-goodies.lua new file mode 100644 index 000000000..381fc45ea --- /dev/null +++ b/tex/context/base/s-fonts-goodies.lua @@ -0,0 +1,117 @@ +if not modules then modules = { } end modules['s-fonts-goodies'] = { + version = 1.001, + comment = "companion to s-fonts-goodies.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.fonts = moduledata.fonts or { } +moduledata.fonts.goodies = moduledata.fonts.goodies or { } + +local NC, NR, HL = context.NC, context.NR, context.HL + +local function initialized(specification) + specification = interfaces.checkedspecification(specification) + local name = specification.name + if name then + local goodies = fonts.goodies.load(name) + if goodies then + return specification, goodies + end + end +end + +function moduledata.fonts.goodies.showstylistics(specification) + local specification, goodies = initialized(specification) + if goodies then + local stylistics = goodies.stylistics + if stylistics then + context.starttabulate { "|Tl|Tpl|" } + HL() + NC() context.bold("feature") + NC() context.bold("meaning") + NC() NR() + HL() + for feature, meaning in table.sortedpairs(stylistics) do + NC() context(feature) + NC() context(string.lower(meaning)) + NC() NR() + end + HL() + context.stoptabulate() + end + end +end + +function moduledata.fonts.goodies.showfeaturesets(specification) + local specification, goodies = initialized(specification) + if goodies then + local featuresets = goodies.featuresets + if featuresets then + context.starttabulate { "|Tl|Tpl|" } + HL() + NC() context.bold("featureset") + NC() context.bold("definitions") + NC() NR() + HL() + for featureset, definitions in table.sortedpairs(featuresets) do + NC() context.type(featureset) NC() + for k, v in table.sortedpairs(definitions) do + context("%s=%S",k,v) + context.quad() + end + NC() NR() + end + HL() + context.stoptabulate() + end + end +end + +function moduledata.fonts.goodies.showcolorschemes(specification) + local specification, goodies = initialized(specification) + if goodies then + local colorschemes = goodies.colorschemes + if colorschemes then + context.starttabulate { "|Tl|Tpl|" } + HL() + NC() context.bold("colorscheme") + NC() context.bold("numbers") + NC() NR() + HL() + for colorscheme, numbers in table.sortedpairs(colorschemes) do + NC() context.type(colorscheme) NC() + for i=1,#numbers do + context(i) + context.quad() + end + NC() NR() + end + HL() + context.stoptabulate() + end + end +end + +function moduledata.fonts.goodies.showfiles(specification) + local specification, goodies = initialized(specification) + if goodies then + local files = goodies.files + if files and files.list then + for filename, specification in table.sortedpairs(files.list) do + context.start() + context.dontleavehmode() + context.definedfont{ filename .. "*default" } + context("%s-%s-%s-%s-%s", + specification.name or files.name, + specification.weight or "normal", + specification.style or "normal", + specification.width or "normal", + specification.variant or "normal") + context.par() + context.stop() + end + end + end +end diff --git a/tex/context/base/s-fonts-goodies.mkiv b/tex/context/base/s-fonts-goodies.mkiv new file mode 100644 index 000000000..f07081825 --- /dev/null +++ b/tex/context/base/s-fonts-goodies.mkiv @@ -0,0 +1,37 @@ +%D \module +%D [ file=s-fonts-goodies, % s-fnt-26, s-fnt-28 +%D version=2009.10.26, +%D title=\CONTEXT\ Style File, +%D subtitle=Goodies Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D More tables will follow here as we have many more goodies by now. + +\startmodule[s-fonts-goodies] + +\registerctxluafile{s-fonts-goodies}{} + +\installmodulecommandluasingle \showfontgoodiesstylistics {moduledata.fonts.goodies.showstylistics} +\installmodulecommandluasingle \showfontgoodiesfeaturesets {moduledata.fonts.goodies.showfeaturesets} +\installmodulecommandluasingle \showfontgoodiescolorschemes {moduledata.fonts.goodies.showcolorschemes} +\installmodulecommandluasingle \showfontgoodiesfiles {moduledata.fonts.goodies.showfiles} + +\stopmodule + +\continueifinputfile{s-fonts-goodies.mkiv} + +\starttext + + \showfontgoodiesstylistics [name=husayni] \page + \showfontgoodiesfeaturesets [name=husayni] \page + \showfontgoodiescolorschemes[name=husayni] \page + + \showfontgoodiesfiles [name=antykwapoltawskiego] \page + +\stoptext diff --git a/tex/context/base/s-fonts-missing.lua b/tex/context/base/s-fonts-missing.lua index 0d409c3a6..829fed45f 100644 --- a/tex/context/base/s-fonts-missing.lua +++ b/tex/context/base/s-fonts-missing.lua @@ -50,7 +50,7 @@ local function legend(id) end end -function moduledata.fonts.missing.legend(specification) +function moduledata.fonts.missing.showlegend(specification) specification = interfaces.checkedspecification(specification) context.begingroup() context.definedfont { "Mono*missing" } -- otherwise no privates added @@ -93,7 +93,7 @@ local function missings() end end -function moduledata.fonts.missing.characters(specification) +function moduledata.fonts.missing.showcharacters(specification) context.begingroup() context.definedfont { "Mono*missing" } -- otherwise no privates added context(function() missings() end) diff --git a/tex/context/base/s-fonts-missing.mkiv b/tex/context/base/s-fonts-missing.mkiv index 4215d2d88..6acef819e 100644 --- a/tex/context/base/s-fonts-missing.mkiv +++ b/tex/context/base/s-fonts-missing.mkiv @@ -15,8 +15,8 @@ \registerctxluafile{s-fonts-missing}{} -\installmodulecommandluasingle \showmissingcharacterslegend {moduledata.fonts.missing.legend} -\installmodulecommandluasingle \showmissingcharacters {moduledata.fonts.missing.characters} +\installmodulecommandluasingle \showmissingcharacterslegend {moduledata.fonts.missing.showlegend} +\installmodulecommandluasingle \showmissingcharacters {moduledata.fonts.missing.showcharacters} \stopmodule diff --git a/tex/context/base/s-fonts-shapes.lua b/tex/context/base/s-fonts-shapes.lua new file mode 100644 index 000000000..e0c1262c5 --- /dev/null +++ b/tex/context/base/s-fonts-shapes.lua @@ -0,0 +1,62 @@ +if not modules then modules = { } end modules['s-fonts-shapes'] = { + version = 1.001, + comment = "companion to s-fonts-shapes.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.fonts = moduledata.fonts or { } +moduledata.fonts.shapes = moduledata.fonts.shapes or { } + +local fontdata = fonts.hashes.identifiers + +local NC, NR = context.NC, context.NR +local space, dontleavehmode, glyph = context.space, context.dontleavehmode, context.glyph + +function moduledata.fonts.shapes.showlist(specification) -- todo: ranges + specification = interfaces.checkedspecification(specification) + local id = tonumber(specification.number) or font.current() + local chrs = fontdata[id].characters + function char(k) + dontleavehmode() + glyph(id,k) + end + local function special(v) + local specials = v.specials + if specials and #specials > 1 then + context("%s:",specials[1]) + for i=2,#specials do + space() + char(specials[i]) + end + end + end + context.begingroup() + context.tt() + context.starttabulate { "|l|c|c|c|c|l|l|" } + context.FL() + NC() context.bold("unicode") + NC() context.bold("glyph") + NC() context.bold("shape") + NC() context.bold("lower") + NC() context.bold("upper") + NC() context.bold("specials") + NC() context.bold("description") + NC() NR() + context.TL() + for k, v in next, characters.data do + if chrs[k] then + NC() context("0x%05X",k) + NC() char(k) + NC() char(v.shcode) + NC() char(v.lccode or k) + NC() char(v.uccode or k) + NC() special(v) + NC() context.tx(v.description) + NC() NR() + end + end + context.stoptabulate() + context.endgroup() +end diff --git a/tex/context/base/s-fonts-shapes.mkiv b/tex/context/base/s-fonts-shapes.mkiv new file mode 100644 index 000000000..257a18fba --- /dev/null +++ b/tex/context/base/s-fonts-shapes.mkiv @@ -0,0 +1,44 @@ +%D \module +%D [ file=s-fonts-shapes, % s-fnt-29, +%D version=2010.09.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Tracing Shapes, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[s-fonts-shapes] + +\registerctxluafile{s-fonts-shapes}{} + +\installmodulecommandluasingle \showfontshapes {moduledata.fonts.shapes.showlist} + +\stopmodule + +\continueifinputfile{s-fonts-shapes.mkiv} + +\setupbodyfont[dejavu,9pt] + +\setuplayout + [backspace=1cm, + topspace=1cm, + footer=1cm, + header=0cm, + height=middle, + width=middle] + +\setupfootertexts + [] + [\saveddefinedfontname\quad\pagenumber] + +\starttext + + \savedefinedfont[Bold*default] + + \showfontshapes[number=\saveddefinedfontid] + +\stoptext diff --git a/tex/context/base/s-fonts-tables.lua b/tex/context/base/s-fonts-tables.lua index 2849c0540..5c91d5ee7 100644 --- a/tex/context/base/s-fonts-tables.lua +++ b/tex/context/base/s-fonts-tables.lua @@ -164,17 +164,17 @@ end tabletracers.typeset = typeset -function tabletracers.properties(nesting) +function tabletracers.showproperties(nesting) local tfmdata = fonts.hashes.identifiers[font.current()] typeset(tfmdata.properties,fonts.constructors.keys.properties,nesting) end -function tabletracers.parameters(nesting) +function tabletracers.showparameters(nesting) local tfmdata = fonts.hashes.identifiers[font.current()] typeset(tfmdata.parameters,fonts.constructors.keys.parameters,nesting) end -function tabletracers.positionings() +function tabletracers.showpositionings() local tfmdata = fonts.hashes.identifiers[font.current()] local resources = tfmdata.resources if resources then @@ -206,7 +206,7 @@ end local dynamics = true -function tabletracers.substitutions() +function tabletracers.showsubstitutions() local tfmdata = fonts.hashes.identifiers[font.current()] local resources = tfmdata.resources if resources then @@ -281,7 +281,7 @@ function tabletracers.substitutions() end end -function tabletracers.all(specification) -- not interfaced +function tabletracers.showall(specification) -- not interfaced specification = interfaces.checkedspecification(specification) @@ -290,19 +290,19 @@ function tabletracers.all(specification) -- not interfaced end context.startsubject { title = "Properties" } - tabletracers.properties() + tabletracers.showproperties() context.stopsubject() context.startsubject { title = "Parameters" } - tabletracers.parameters() + tabletracers.showparameters() context.stopsubject() context.startsubject { title = "Positioning features" } - tabletracers.positionings() + tabletracers.showpositionings() context.stopsubject() context.startsubject { title = "Substitution features" } - tabletracers.substitutions() + tabletracers.showsubstitutions() context.stopsubject() if title then diff --git a/tex/context/base/s-fonts-tables.mkiv b/tex/context/base/s-fonts-tables.mkiv index d991d7d81..98f9052ca 100644 --- a/tex/context/base/s-fonts-tables.mkiv +++ b/tex/context/base/s-fonts-tables.mkiv @@ -17,11 +17,11 @@ \registerctxluafile{s-fonts-tables}{} -\installmodulecommandluasingle \showfonttables {moduledata.fonts.tables.all} -\installmodulecommandluasingle \showfontproperties {moduledata.fonts.tables.properties} -\installmodulecommandluasingle \showfontparameters {moduledata.fonts.tables.parameters} -\installmodulecommandluasingle \showfontpositionings {moduledata.fonts.tables.positionings} -\installmodulecommandluasingle \showfontsubstitutions {moduledata.fonts.tables.substitutions} +\installmodulecommandluasingle \showfonttables {moduledata.fonts.tables.showall} +\installmodulecommandluasingle \showfontproperties {moduledata.fonts.tables.showproperties} +\installmodulecommandluasingle \showfontparameters {moduledata.fonts.tables.showparameters} +\installmodulecommandluasingle \showfontpositionings {moduledata.fonts.tables.showpositionings} +\installmodulecommandluasingle \showfontsubstitutions {moduledata.fonts.tables.showsubstitutions} \stopmodule diff --git a/tex/context/base/s-math-coverage.lua b/tex/context/base/s-math-coverage.lua index 05a311ee6..c06f14b11 100644 --- a/tex/context/base/s-math-coverage.lua +++ b/tex/context/base/s-math-coverage.lua @@ -10,6 +10,13 @@ moduledata.math = moduledata.math or { } moduledata.math.coverage = moduledata.math.coverage or { } local utfchar, utfbyte = utf.char, utf.byte +local formatters, lower, upper, find, format = string.formatters, string.lower, string.upper, string.find, string.format +local lpegmatch = lpeg.match +local concat = table.concat + +local context = context +local NC, NR, HL = context.NC, context.NR, context.HL +local char, getglyph, bold, getvalue = context.char, context.getglyph, context.bold, context.getvalue local ucgreek = { 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, @@ -67,6 +74,10 @@ local alphabets = { local getboth = mathematics.getboth local remapalphabets = mathematics.remapalphabets +local chardata = characters.data +local superscripts = characters.superscripts +local subscripts = characters.subscripts + function moduledata.math.coverage.showalphabets() context.starttabulate { "|lT|l|Tl|" } for i=1,#styles do @@ -75,11 +86,11 @@ function moduledata.math.coverage.showalphabets() local alternative = alternatives[i] for i=1,#alphabets do local alphabet = alphabets[i] - context.NC() + NC() if i == 1 then context("%s %s",style,alternative) end - context.NC() + NC() context.startimath() context.setmathattribute(style,alternative) for i=1,#alphabet do @@ -95,15 +106,15 @@ function moduledata.math.coverage.showalphabets() end end context.stopimath() - context.NC() + 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) - context.NC() - context.NR() + NC() + NR() end end end @@ -111,29 +122,28 @@ function moduledata.math.coverage.showalphabets() end function moduledata.math.coverage.showcharacters() - local NC, NR, getglyph, concat = context.NC, context.NR, context.getglyph, table.concat context.startcolumns() context.setupalign { "nothyphenated" } context.starttabulate { "|T|i2|Tpl|" } - for u, d in table.sortedpairs(characters.data) do + for u, d in table.sortedpairs(chardata) do local mathclass = d.mathclass local mathspec = d.mathspec if mathclass or mathspec then NC() - context("%05X",u) + context("%05X",u) NC() - getglyph("MathRoman",u) + getglyph("MathRoman",u) NC() - if mathspec then - local t = { } - for i=1,#mathspec do - t[mathspec[i].class] = true + if mathspec then + local t = { } + for i=1,#mathspec do + t[mathspec[i].class] = true + end + t = table.sortedkeys(t) + context("% t",t) + else + context(mathclass) end - t = table.sortedkeys(t) - context(concat(t," ")) - else - context(mathclass) - end NC() NR() end @@ -141,3 +151,124 @@ function moduledata.math.coverage.showcharacters() context.stoptabulate() context.stopcolumns() end + +-- This is a somewhat tricky table as we need to bypass the math machinery. + +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 + 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() + end + context.stoptabulate() +end + +function moduledata.math.coverage.showcomparison(specification) + + specification = interfaces.checkedspecification(specification) + + local fontfiles = utilities.parsers.settings_to_array(specification.list or "") + local pattern = upper(specification.pattern or "") + + local present = { } + local names = { } + local files = { } + + if not pattern then + -- skip + elseif pattern == "" then + pattern = nil + elseif tonumber(pattern) then + pattern = tonumber(pattern) + else + pattern = lpeg.oneof(utilities.parsers.settings_to_array(pattern)) + pattern = (1-pattern)^0 * pattern + end + + for i=1,#fontfiles do + local fontname = format("testfont-%s",i) + local fontfile = fontfiles[i] + local fontsize = tex.dimen.bodyfontsize + local id, fontdata = fonts.definers.define { + name = fontfile, + size = fontsize, + cs = fontname, + } + if id and fontdata then + for k, v in next, fontdata.characters do + present[k] = true + end + names[#names+1] = fontname + files[#files+1] = fontfile + end + end + + local t = { } + + context.starttabulate { "|Tr" .. string.rep("|l",#names) .. "|" } + for i=1,#files do + local file = files[i] + t[#t+1] = i .. "=" .. file + NC() + context(i) + NC() + context(file) + NC() + NR() + end + context.stoptabulate() + + context.setupfootertexts { + table.concat(t," ") + } + + context.starttabulate { "|Tl" .. string.rep("|c",#names) .. "|Tl|" } + NC() + bold("unicode") + NC() + for i=1,#names do + bold(i) + NC() + end + bold("description") + NC() + NR() + HL() + for k, v in table.sortedpairs(present) do + if k > 0 then + local description = chardata[k].description + if not pattern or (pattern == k) or (description and lpegmatch(pattern,description)) then + NC() + context("%05X",k) + NC() + for i=1,#names do + getvalue(names[i]) + char(k) + NC() + end + context(description) + NC() + NR() + end + end + end + context.stoptabulate() + +end diff --git a/tex/context/base/s-math-coverage.mkiv b/tex/context/base/s-math-coverage.mkiv index fd7498d2e..185c382d6 100644 --- a/tex/context/base/s-math-coverage.mkiv +++ b/tex/context/base/s-math-coverage.mkiv @@ -1,6 +1,6 @@ %D \module -%D [ file=s-math-coverage, % s-fnt-33, -%D version=2011.05.10, % about then +%D [ file=s-math-coverage, % s-fnt-33, s-fnt-32, s-fnt-31 +%D version=2011.05.10, % and older %D title=\CONTEXT\ Style File, %D subtitle=Show Math Coverage, %D author=Hans Hagen, @@ -11,31 +11,128 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% begin info +% +% title : compare glyphs in fonts +% +% comment : show glyphs in several fonts alongside in order to to compare coverage +% status : experimental, used for luatex testing +% +% end info + \startmodule[math-coverage] \registerctxluafile{s-math-coverage}{} \installmodulecommandluasingle \showmathalphabets {moduledata.math.coverage.showalphabets} \installmodulecommandluasingle \showmathcharacters {moduledata.math.coverage.showcharacters} +\installmodulecommandluasingle \showmathscripts {moduledata.math.coverage.showscripts} +\installmodulecommandluasingle \showmathcomparison {moduledata.math.coverage.showcomparison} \stopmodule \continueifinputfile{s-math-coverage.mkiv} -\setupbodyfont - [modern] - -\setuplayout - [backspace=1cm, - topspace=1cm, - header=1cm, - footer=1cm, - width=middle, - height=middle] +\usemodule[art-01] \starttext \showmathalphabets \page \showmathcharacters \page + \showmathscripts \page + + \showmathcomparison + [list={texgyrepagella-regular.otf,texgyretermes-regular.otf,texgyrebonum-regular.otf}, + pattern=ogonek] + + \page + + % $e=mc²$ ${}²$ $²$ $x²ᶞ$ $x⁽²⁺²⁼²⁺²⁾$ $x²⁺²⁼²⁺²$ $x₅²$ $x²₅²$ + + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = { + % "texgyrepagella-math.otf", + % "texgyretermes-math.otf", + % "texgyrebonum-math.otf", + % } + % } + % \stopluacode + + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = "pirat.ttf", + % } + % \stopluacode + + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = { + % "lucidabrightot.otf", + % "cambria.ttf", + % "iwona-regular.otf", + % "texgyrepagella-regular.otf", + % "texgyretermes-regular.otf", + % "texgyrebonum-regular.otf", + % "antpolt-regular.otf", + % }, + % pattern = "OGONEK" + % } + % \stopluacode + + % \loadfontgoodies[lucida-math] + % \loadfontgoodies[lm-math] + % + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = { + % "LucidaBrightRegular.ttf", + % "LucidaBrightOne@lucida-math", + % "cambria.ttc(Cambria Math)", + % "xits-math.otf", + % "LMMath10-Regular@lmroman10-math", + % }, + % } + % \stopluacode + + % \loadfontgoodies[px-math] + % \loadfontgoodies[lm-math] + % + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = { + % "cambria.ttc(Cambria Math)", + % "xits-math.otf", + % -- "stixmath-regular.otf", + % "latinmodern-math.otf", + % -- "lucidabrightmathot.otf", + % -- "lucidabrightmathot-demi.otf", + % "texgyrepagella-math.otf", + % "texgyretermes-math.otf", + % "texgyrebonum-math.otf", + % -- "LMMath10-Regular@lmroman10-math", + % -- "pxmath@px-math", + % -- "txmath@tx-math", + % }, + % } + % \stopluacode + + % \startluacode + % moduledata.math.coverage.showcomparison { + % list = { + % "dejavuserif.ttf", + % "dejavusans.ttf", + % "dejavusansmono.ttf", + % "lucidabrightot.otf", + % "cambria.ttf", + % "iwona-regular.otf", + % "texgyrepagella-regular.otf", + % "texgyretermes-regular.otf", + % "texgyrebonum-regular.otf", + % "antpolt-regular.otf", + % }, + % pattern = "CELSIUS,FAHRENHEIT" + % } + % \stopluacode \stoptext diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index cf8a52e83..6266ba72d 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 8e05e1f2b..90f5b1bd4 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 6ee7c8da8..75db1b910 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4275,6 +4275,11 @@ return { filename = "s-fonts-missing", status = "okay", }, + { + category = "lua", + filename = "s-fonts-shapes", + status = "okay", + }, { category = "lua", filename = "s-fonts-tables", @@ -4300,6 +4305,11 @@ return { filename = "s-math-extensibles", status = "okay", }, + { + category = "lua", + filename = "s-fonts-goodies", + status = "okay", + }, { category = "lua", filename = "s-math-parameters", @@ -5314,21 +5324,6 @@ return { filename = "s-fnt-24", status = "todo", }, - { - category = "mkiv", - filename = "s-fnt-26", - status = "todo", - }, - { - category = "mkiv", - filename = "s-fnt-28", - status = "todo", - }, - { - category = "mkiv", - filename = "s-fnt-29", - status = "todo", - }, { category = "mkiv", filename = "s-fnt-30", @@ -5336,22 +5331,22 @@ return { }, { category = "mkiv", - filename = "s-fnt-31", - status = "todo", + filename = "s-fonts-features", + status = "okay", }, { category = "mkiv", - filename = "s-fnt-32", - status = "todo", + filename = "s-fonts-goodies", + status = "okay", }, { category = "mkiv", - filename = "s-fonts-features", + filename = "s-fonts-missing", status = "okay", }, { category = "mkiv", - filename = "s-fonts-missing", + filename = "s-fonts-shapes", status = "okay", }, { diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua index 31e7ffa53..cdf497588 100644 --- a/tex/context/base/util-prs.lua +++ b/tex/context/base/util-prs.lua @@ -93,7 +93,9 @@ patterns.settings_to_hash_b = pattern_b_s patterns.settings_to_hash_c = pattern_c_s function parsers.make_settings_to_hash_pattern(set,how) - if how == "strict" then + if type(str) == "table" then + return set + elseif how == "strict" then return (pattern_c/set)^1 elseif how == "tolerant" then return (pattern_b/set)^1 @@ -103,7 +105,16 @@ function parsers.make_settings_to_hash_pattern(set,how) end function parsers.settings_to_hash(str,existing) - if str and str ~= "" then + if type(str) == "table" then + if existing then + for k, v in next, str do + existing[k] = v + end + return exiting + else + return str + end + elseif str and str ~= "" then hash = existing or { } lpegmatch(pattern_a_s,str) return hash @@ -113,7 +124,16 @@ function parsers.settings_to_hash(str,existing) end function parsers.settings_to_hash_tolerant(str,existing) - if str and str ~= "" then + if type(str) == "table" then + if existing then + for k, v in next, str do + existing[k] = v + end + return exiting + else + return str + end + elseif str and str ~= "" then hash = existing or { } lpegmatch(pattern_b_s,str) return hash @@ -123,7 +143,16 @@ function parsers.settings_to_hash_tolerant(str,existing) end function parsers.settings_to_hash_strict(str,existing) - if str and str ~= "" then + if type(str) == "table" then + if existing then + for k, v in next, str do + existing[k] = v + end + return exiting + else + return str + end + elseif str and str ~= "" then hash = existing or { } lpegmatch(pattern_c_s,str) return next(hash) and hash @@ -144,7 +173,9 @@ patterns.settings_to_array = pattern -- we could use a weak table as cache function parsers.settings_to_array(str,strict) - if not str or str == "" then + if type(str) == "table" then + return str + elseif not str or str == "" then return { } elseif strict then if find(str,"{") then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index fae9586a9..e4e1e1e5d 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/16/13 13:51:17 +-- merge date : 05/16/13 23:48:12 do -- begin closure to overcome local limits and interference -- cgit v1.2.3