diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-07-06 22:05:18 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-07-06 22:05:18 +0200 |
commit | 82c674fdcf5bcff4ad0dc0936d638fc729145616 (patch) | |
tree | 6ab4ee4417aa22180cd5b3c50ede6a031f8ce3f9 /tex/context/modules/mkiv | |
parent | 3a55e11c7295abf8f2dfe5e9d1c8b153f4518824 (diff) | |
download | context-82c674fdcf5bcff4ad0dc0936d638fc729145616.tar.gz |
2022-07-06 21:35:00
Diffstat (limited to 'tex/context/modules/mkiv')
-rw-r--r-- | tex/context/modules/mkiv/m-simulate.mkiv | 2 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-zint.mkiv | 4 | ||||
-rw-r--r-- | tex/context/modules/mkiv/s-math-characters.lua | 73 | ||||
-rw-r--r-- | tex/context/modules/mkiv/s-math-repertoire.mkiv | 135 |
4 files changed, 159 insertions, 55 deletions
diff --git a/tex/context/modules/mkiv/m-simulate.mkiv b/tex/context/modules/mkiv/m-simulate.mkiv index dc4448903..c4817b95e 100644 --- a/tex/context/modules/mkiv/m-simulate.mkiv +++ b/tex/context/modules/mkiv/m-simulate.mkiv @@ -109,7 +109,7 @@ \else \discretionary{\p_hyphen}{}{\kern\scratchdimenthree}% \fi\fi\fi\fi\fi\fi}% - \edef\truncated##1##2\relax{##1}% + \def\truncated##1##2\relax{##1}% % trialtypesetting: tricky \ifx\p_random\empty \else \pushrandomseed diff --git a/tex/context/modules/mkiv/m-zint.mkiv b/tex/context/modules/mkiv/m-zint.mkiv index 87e0d382c..4880aa39b 100644 --- a/tex/context/modules/mkiv/m-zint.mkiv +++ b/tex/context/modules/mkiv/m-zint.mkiv @@ -108,8 +108,8 @@ end % \blank % \barcode[alternative=isbn,text=9789490688011,width=3cm] % \blank - \barcode[alternative=datamatrix,text=whatever,width=3cm,option=--square] - +% \barcode[alternative=datamatrix,text=whatever,width=3cm,option=--square,suffix=png] + \barcode[alternative=maxicode,text=whatever,width=3cm,suffix=png] \stoptext diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua index aed3258d2..b634a203f 100644 --- a/tex/context/modules/mkiv/s-math-characters.lua +++ b/tex/context/modules/mkiv/s-math-characters.lua @@ -113,36 +113,38 @@ function moduledata.math.characters.showlist(specification) end else -local function collectalllookups(tfmdata,script,language) - local all = setmetatableindex(function(t,k) local v = setmetatableindex("table") t[k] = v return v end) - local shared = tfmdata.shared - local rawdata = shared and shared.rawdata - if rawdata then - local features = rawdata.resources.features - if features.gsub then - for kind, feature in next, features.gsub do - local validlookups, lookuplist = fonts.handlers.otf.collectlookups(rawdata,kind,script,language) - if validlookups then - for i=1,#lookuplist do - local lookup = lookuplist[i] - local steps = lookup.steps - for i=1,lookup.nofsteps do - local coverage = steps[i].coverage - if coverage then - for k, v in next, coverage do - all[k][lookup.type][kind] = v + local function collectalllookups(tfmdata,script,language) + local all = setmetatableindex(function(t,k) local v = setmetatableindex("table") t[k] = v return v end) + local shared = tfmdata.shared + local rawdata = shared and shared.rawdata + if rawdata then + local features = rawdata.resources.features + if features.gsub then + for kind, feature in next, features.gsub do + local validlookups, lookuplist = fonts.handlers.otf.collectlookups(rawdata,kind,script,language) + if validlookups then + for i=1,#lookuplist do + local lookup = lookuplist[i] + local steps = lookup.steps + for i=1,lookup.nofsteps do + local coverage = steps[i].coverage + if coverage then + for k, v in next, coverage do + all[k][lookup.type][kind] = v + end + end end end end end end end + return all end - end - return all -end -local alllookups = collectalllookups(tfmdata,"math","dflt") + local alllookups = collectalllookups(tfmdata,"math","dflt") + + local luametatex = LUATEXENGINE == "luametatex" context.showmathcharactersstart() for _, unicode in next, sorted do @@ -163,10 +165,29 @@ local alllookups = collectalllookups(tfmdata,"math","dflt") local mathspec = info.mathspec local mathsymbol = info.mathsymbol local description = info.description or no_description - context.showmathcharactersstartentry() - context.showmathcharactersreference(f_unicode(unicode)) - context.showmathcharactersentryhexdectit(f_unicode(code),code,lower(description)) - context.showmathcharactersentrywdhtdpic(round(char.width or 0),round(char.height or 0),round(char.depth or 0),round(char.italic or 0)) + context.showmathcharactersstartentry( + ) + context.showmathcharactersreference( + f_unicode(unicode) + ) + context.showmathcharactersentryhexdectit( + f_unicode(code), + code, + lower(description) + ) + if luametatex then + context.showmathcharactersentrywdhtdpicta( + code + ) + else + context.showmathcharactersentrywdhtdpicta( + round(char.width or 0), + round(char.height or 0), + round(char.depth or 0), + round(char.italic or 0), + round(char.topaccent or 0) + ) + end if virtual and commands then local t = { } for i=1,#commands do diff --git a/tex/context/modules/mkiv/s-math-repertoire.mkiv b/tex/context/modules/mkiv/s-math-repertoire.mkiv index 826c13fb0..59a2b828b 100644 --- a/tex/context/modules/mkiv/s-math-repertoire.mkiv +++ b/tex/context/modules/mkiv/s-math-repertoire.mkiv @@ -34,6 +34,8 @@ \definecolor[backgroundcolory][g=.6] \definecolor[baselinecolor] [a=1,t=.5,s=.6] \definecolor[charactercolor] [b=.6] +\definecolor[italiccolor] [r=.6] +\definecolor[anchorcolor] [s=1] \definecolor[pagecolor] [s=.1] \definecolor[nonecolor] [s=.5] \definecolor[textcolor] [s=.9] @@ -225,24 +227,68 @@ {\iffontchar\font#2\relax \scale [sx=#1,sy=#1] - {\dontleavehmode - \begingroup - \setbox\scratchbox\hbox{\charactercolor\char#2}% - \scratchdimen\wd\scratchbox - \ifdim\scratchdimen>\zeropoint + {\dontleavehmode\hbox\bgroup + \setbox\scratchbox\hbox\bgroup + \charactercolor + \char#2\relax + \egroup + \scratchwidth \wd\scratchbox + \scratchheight\ht\scratchbox + \scratchdepth \dp\scratchbox + \scratchitalic\ifdefined\glyphscale\glyphxscaled\fontcharic\font#2\relax\else\zeropoint\fi + \setbox\scratchbox\hbox\bgroup + \ifdim\scratchitalic=\zeropoint\else + \hskip\scratchwidth + \ifdim\scratchitalic<\zeropoint + \hskip\scratchitalic + \scratchitalic-\scratchitalic + \fi + \italiccolor + \vrule + width \scratchitalic + height \scratchheight + depth \scratchdepth + \relax + \hskip-\dimexpr\scratchwidth+\scratchitalic\relax + \fi + \unhbox\scratchbox + \egroup + \scratchtotal\dimexpr\scratchwidth+\scratchitalic\relax + \wd\scratchbox\scratchtotal + % + \ifdim\scratchtotal>\zeropoint \backgroundline[backgroundcolor]{\box\scratchbox}% - \else\ifdim\scratchdimen<\zeropoint - \scratchdimen-\scratchdimen - \setbox\scratchbox\hbox to \scratchdimen{\hss\charactercolor\char#2}% + \else\ifdim\scratchtotal<\zeropoint + % really negative width? + \scratchtotal-\scratchtotal + \setbox\scratchbox\hbox to \scratchtotal{\hss\charactercolor\char#2}% \backgroundline[backgroundcolorx]{\box\scratchbox}% \else \setbox\scratchbox\hbox to \emwidth{\hss\charactercolor\char#2}% - \scratchdimen\wd\scratchbox + \scratchtotal\wd\scratchbox \backgroundline[backgroundcolory]{\box\scratchbox}% \fi\fi - \hskip-\scratchdimen - \baselinecolor\vrule width \scratchdimen height .05\exheight depth .05\exheight - \endgroup}% + \hskip-\scratchtotal + \baselinecolor\vrule width \scratchtotal height .05\exheight depth .05\exheight + % + \ifdefined\glyphscale + \scratchdimen\glyphyscaled\fontcharta\font#2\relax + \ifdim\scratchdimen=\zeropoint\else + \hskip-\scratchtotal + \hbox to \scratchwidth yoffset \scratchheight \bgroup + \hskip\scratchdimen + \anchorcolor + \vrule + width .10\exheight + height .05\exheight + depth .05\exheight + \relax + \hss + \egroup + \hskip\scratchitalic + \fi + \fi + \egroup}% \fi} \unexpanded\def\showmathcharactersmth#1#2% @@ -325,17 +371,50 @@ [preset=middlebottom,voffset=5mm] {\showmathcharactersbodyfontschars{#2}}}} -% dimensions - -\unexpanded\def\showmathcharactersentrywdhtdpic#1#2#3#4% - {\setlayer - [page] - [preset=leftbottom,offset=5mm] - {\somedata[align=normal,width=5cm] - {\strut width \hfill \the\dimexpr#1\scaledpoint\par - \strut height\hfill \the\dimexpr#2\scaledpoint\par - \strut depth \hfill \the\dimexpr#3\scaledpoint\par - \strut italic\hfill \the\dimexpr#4\scaledpoint}}} +% dimensions (we can ask them in tex) + +\ifcase\contextlmtxmode + + \unexpanded\def\showmathcharactersentrywdhtdpicta#1#2#3#4#5% + {\setlayer + [page] + [preset=leftbottom,offset=5mm] + {\somedata[align=normal,width=5cm] + {\strut width \hfill \the\dimexpr#1\scaledpoint\par + \strut height\hfill \the\dimexpr#2\scaledpoint\par + \strut depth \hfill \the\dimexpr#3\scaledpoint\par + \ifnum#4=\zerocount\else + \strut italic\hfill \the\dimexpr#4\scaledpoint\par + \fi + \ifnum#5=\zerocount\else + \strut accent\hfill \the\dimexpr#5\scaledpoint + \fi + }}} + +\else + + \unexpanded\def\showmathcharactersentrywdhtdpicta#1% + {\setlayer + [page] + [preset=leftbottom,offset=5mm] + {\somedata[align=normal,width=5cm] + {\scratchwidth \glyphxscaled\fontcharwd\font#1% + \scratchheight\glyphxscaled\fontcharht\font#1% + \scratchdepth \glyphxscaled\fontchardp\font#1% + \scratchitalic\glyphxscaled\fontcharic\font#1% + \scratchdimen \glyphxscaled\fontcharta\font#1% + \strut width \hfill \the\scratchwidth \par + \strut height\hfill \the\scratchheight\par + \strut depth \hfill \the\scratchdepth \par + \ifnum\scratchitalic=\zerocount\else + \strut italic\hfill \the\scratchitalic\par + \fi + \ifnum\scratchdimen=\zerocount\else + \strut accent\hfill \the\scratchdimen + \fi + }}} + +\fi \unexpanded\def\showmathcharactersentryresource#1% {} % {virtual: #1\par} @@ -459,16 +538,20 @@ \continueifinputfile{s-math-repertoire.mkiv} +% \enabledirectives[math.nogoodies] + % \showmathcharacterssetbodyfonts{lucidaot,cambria,xits,stixtwo,modern,pagella,termes,bonum,schola,dejavu} +\showmathcharacterssetbodyfonts{lucidaot,cambria,stixtwo,modern,pagella,termes,bonum,schola,ebgaramond,dejavu,modernlatin} % \showmathcharacterssetbodyfonts{newcomputermodern-book,lucidaot,cambria,stixtwo,modern,pagella,termes,bonum,schola,dejavu} % \showmathcharacterssetbodyfonts{newcomputermodern-book,stixtwo,modern,pagella,termes,bonum,schola,dejavu} -\showmathcharacterssetbodyfonts{newcomputermodern-book,lucidaot,cambria,stixtwo,modern,pagella,termes,schola,dejavu} +% \showmathcharacterssetbodyfonts{newcomputermodern-book,lucidaot,cambria,stixtwo,modern,pagella,termes,schola,dejavu} +% \showmathcharacterssetbodyfonts{modernlatin,lucidaot,cambria,stixtwo,modern,pagella,termes,schola,dejavu} \starttext \doifelse {\getdocumentargument{bodyfont}} {} { - % \setupbodyfont[cambria, 12pt] + \setupbodyfont[cambria, 12pt] % \setupbodyfont[modern, 12pt] % \setupbodyfont[lmvirtual, 12pt] % \setupbodyfont[pxvirtual, 12pt] @@ -484,7 +567,7 @@ % \setupbodyfont[schola, 12pt] % \setupbodyfont[dejavu, 12pt] % \setupbodyfont[lucidaot, 12pt] - \setupbodyfont[newcomputermodern-book, 12pt] + % \setupbodyfont[newcomputermodern-book, 12pt] } { |