summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-01-22 09:57:33 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-01-22 09:57:33 +0100
commitdee0d939a50007dbe52f7035d67c01a78289e585 (patch)
tree15bb507c18b734bc9949b3f03b90eb4638615694
parentaea52f4b97d1be9ba194cd9a1d0ff1865c413691 (diff)
downloadcontext-dee0d939a50007dbe52f7035d67c01a78289e585.tar.gz
2021-01-22 09:41:00
-rw-r--r--metapost/context/base/mpxl/mp-lmtx.mpxl27
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26114 -> 26122 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin255046 -> 255048 bytes
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/enco-ini.mkxl6
-rw-r--r--tex/context/base/mkxl/font-mpf.lmt4
-rw-r--r--tex/context/base/mkxl/meta-imp-clock.mkxl139
-rw-r--r--tex/context/base/mkxl/meta-imp-demo.mkxl46
-rw-r--r--tex/context/base/mkxl/mlib-scn.lmt18
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
15 files changed, 231 insertions, 23 deletions
diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl
index ae00f43f1..cfa169316 100644
--- a/metapost/context/base/mpxl/mp-lmtx.mpxl
+++ b/metapost/context/base/mpxl/mp-lmtx.mpxl
@@ -2223,15 +2223,9 @@ newscriptindex mfid_registerglyph ; mfid_registerglyph := scriptindex "registe
% An experimental macro:
-vardef composeglyph(suffix snippets) =
- save llx, lly, urx, ury, u ;
- u := getparameter "mpsfont" "unicode" ;
- snippets[u] := image (
- for i=1 upto getparametercount "mpsfont" "shapes" :
- draw scantokens ( getparameter "mpsfont" "shapes" i "shape" )
- withcolor getparameter "mpsfont" "shapes" i "color" ;
- endfor ;
- ) ;
+vardef registercomposedglyph (expr u) (suffix snippets) =
+ save llx, lly, urx, ury ;
+snippets[u] := snippets[u] shifted (-xpart llcorner snippets[u], 0) ;
llx := xpart llcorner snippets[u] ;
lly := ypart llcorner snippets[u] ;
urx := xpart urcorner snippets[u] ;
@@ -2247,7 +2241,20 @@ vardef composeglyph(suffix snippets) =
] ;
enddef ;
-permanent composeglyph ;
+vardef composeglyph (suffix snippets) =
+ save u ; u := getparameter "mpsfont" "unicode" ;
+ snippets[u] := image (
+ for i=1 upto getparametercount "mpsfont" "shapes" :
+ draw scantokens ( getparameter "mpsfont" "shapes" i "shape" )
+ if hasparameter "mpsfont" "shapes" i "color" :
+ withcolor getparameter "mpsfont" "shapes" i "color"
+ fi ;
+ endfor ;
+ ) ;
+ registercomposedglyph(u, snippets) ;
+enddef ;
+
+permanent registercomposeglyph, composeglyph ;
% Again an experiment (todo: the faster method):
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index cb5ab4de1..25c8ae59e 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2021.01.21 18:01}
+\newcontextversion{2021.01.22 09:38}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index e0b21635f..440c698e7 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.01.21 18:01}
+\edef\contextversion{2021.01.22 09:38}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 957f20c84..1dac6a5e0 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.01.21 18:01}
+\newcontextversion{2021.01.22 09:38}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 1333eb16f..a70ed6513 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.01.21 18:01}
+\edef\contextversion{2021.01.22 09:38}
%D Kind of special:
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index d7e78e066..5f7b6c7be 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 27fb6a984..17332430e 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index fd44f4c82..ff33c5c5a 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.01.21 18:01}
+\newcontextversion{2021.01.22 09:38}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 123558d39..54247cef5 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.01.21 18:01}
+\immutable\edef\contextversion{2021.01.22 09:38}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/enco-ini.mkxl b/tex/context/base/mkxl/enco-ini.mkxl
index 9bf442eec..7873bae1f 100644
--- a/tex/context/base/mkxl/enco-ini.mkxl
+++ b/tex/context/base/mkxl/enco-ini.mkxl
@@ -326,8 +326,7 @@
\gletcsname\??controlspace\number\scratchdimen\endcsname\lastrawfontcall}
\permanent\protected\def\normalcontrolspace
- %{\iffontchar\font\numexpr\expandafter`\textcontrolspace\relax
- {\iffontchar\font\textcontrolspace % in luametatex we also accept a char
+ {\iffontchar\font\numexpr\expandafter`\textcontrolspace\relax
\textcontrolspace
\else
\fallbackcontrolspace
@@ -336,8 +335,7 @@
\aliased\let\textvisiblespace\normalcontrolspace
\permanent\protected\def\optionalcontrolspace
- %{\iffontchar\font\numexpr\expandafter`\textcontrolspace\relax
- {\iffontchar\font\textcontrolspace % in luametatex we also accept a char
+ {\iffontchar\font\numexpr\expandafter`\textcontrolspace\relax
\textcontrolspace
\else
\asciispacechar % used for export !
diff --git a/tex/context/base/mkxl/font-mpf.lmt b/tex/context/base/mkxl/font-mpf.lmt
index 5934c1037..b4dbd2b3b 100644
--- a/tex/context/base/mkxl/font-mpf.lmt
+++ b/tex/context/base/mkxl/font-mpf.lmt
@@ -76,7 +76,9 @@ local function setmetaglyphs(category,fontid,unicode,specification)
newdata.depth = -lly
newdata.unicode = unicode
-- commands = { { "offset", -llx, 0, newdata.commands[1][1], newdata.commands[1][2] } }
- newdata.commands = { { "offset", -llx, 0 }, newdata.commands[1] }
+ if llx ~= 0 then
+ newdata.commands = { { "offset", -llx, 0 }, newdata.commands[1] }
+ end
-- pass dimensions to lua
characters[unicode] = newdata
-- pass dimensions to tex
diff --git a/tex/context/base/mkxl/meta-imp-clock.mkxl b/tex/context/base/mkxl/meta-imp-clock.mkxl
new file mode 100644
index 000000000..b48abf5ee
--- /dev/null
+++ b/tex/context/base/mkxl/meta-imp-clock.mkxl
@@ -0,0 +1,139 @@
+%D \module
+%D [ file=meta-imp-clock,
+%D version=2021.01.21,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Demo Clock Font,
+%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 This is just a demo of defining a font in \METAPOST. The rendering as well as definitions
+%D are delayed till we actually need the glyph. A crazy examples made in crazy times.
+
+\startMPcalculation{simplefun}
+
+ % the 0 in getparameterdefault makes sure we convert to a number
+
+ picture DemoClocks[];
+
+ vardef ClockCircle =
+ image(draw fullcircle scaled 10 ;)
+ enddef ;
+
+ vardef ClockPoints =
+ image (
+ for i=1 upto 12 :
+ draw (0,5) rotated ((360 * i) / 12) withpen pencircle scaled 1 ;
+ endfor ;
+ )
+ enddef ;
+
+ vardef ClockTicks =
+ image (
+ for i=1 upto 12 :
+ draw ((0,4.5)--(0,5.5)) rotated ((360 * i) / 12) ;
+ endfor ;
+ )
+ enddef ;
+
+ vardef ClockCenter =
+ image (
+ draw origin withpen pencircle scaled 1 ;
+ )
+ enddef ;
+
+ vardef ClockHour =
+ image(
+ draw (origin -- (0,4)) rotated (
+ - 360 * (getparameterdefault "mpsfont" "hour" 0) / 12
+ - 360 * (getparameterdefault "mpsfont" "minute" 0) / (60 * 12)
+
+ ) )
+ enddef ;
+
+ vardef ClockMinute =
+ image(
+ draw (origin -- (0,5)) rotated (
+ - 360 * (getparameterdefault "mpsfont" "minute" 0) / 60
+ )
+ )
+ enddef ;
+
+ vardef DemoClock =
+ composeglyph(DemoClocks) ;
+ enddef ;
+
+ lmt_registerglyphs [
+ name = "clock",
+ units = 10,
+ width = 10,
+ height = 10,
+ depth = 0,
+ ] ;
+
+ lmt_registerglyph [
+ category = "clock",
+ ] ;
+
+\stopMPcalculation
+
+% \startluacode
+% metapost.metafonts.clock = { }
+% \stopluacode
+
+\continueifinputfile{meta-imp-clock.mkxl}
+
+% \enableexperiments[fonts.compact]
+
+\setuplayout[tight]
+
+\setupbodyfont[dejavu]
+
+\definefontfeature[clock][metapost=clock,metafont=clock]
+
+\definefont[ClockFont][Serif*clock]
+
+\starttext
+
+\unexpanded\def\MyClock#1#2%
+ {\begingroup
+ \ClockFont
+ \iffontchar\font\privatecharactercode{CLOCK:#1:#2}\else
+ % We could move this out to a helper \MyClockMake{#1}{#2} but normally
+ % it's efficient enough. (If we trace a lot it matters more.)
+ \setmetaglyph {
+ category {clock}
+ name {CLOCK:#1:#2}
+ code {DemoClock}
+ hour {#1}
+ minute {#2}
+ shapes {
+ { shape {ClockCircle} color {darkred} }
+ { shape {ClockTicks} color {middlegray} }
+ % { shape {ClockBullets} color {middlegray} }
+ { shape {ClockHour} color {darkgreen} }
+ { shape {ClockMinute} color {darkblue} }
+ { shape {ClockCenter} color {middlegray} }
+ }
+ }%
+ \fi
+ \setalternate{\twodigits{#1}:\twodigits{#2}}% cut'n'paste in acrobat
+ \privatecharacter{CLOCK:#1:#2}%
+ \endgroup}
+
+\dorecurse{8}{
+ \begingroup
+ \glyphxscale \numexpr 1000+#100\relax
+ \glyphyscale \glyphxscale
+ \veryraggedright
+ \dostepwiserecurse{0}{60}{1}{
+ \MyClock{3}{##1}\hskip\zeropoint plus \onepoint\allowbreak% space
+ }
+ \blank
+ \endgroup
+}
+\stoptext
diff --git a/tex/context/base/mkxl/meta-imp-demo.mkxl b/tex/context/base/mkxl/meta-imp-demo.mkxl
index 220d5206d..b89a4771b 100644
--- a/tex/context/base/mkxl/meta-imp-demo.mkxl
+++ b/tex/context/base/mkxl/meta-imp-demo.mkxl
@@ -184,4 +184,50 @@ metapost.metafonts.demo = {
\DemoB\setupinterlinespace \dorecurse{20}{\dorecurse{1000}{g h }\par}\page
\DemoC\setupinterlinespace \dorecurse{30}{\dorecurse{1000}{g h }\par}\page
+ \unexpanded\def\MyChar#1%
+ {\begingroup
+ \DemoA
+ \iffontchar\font\privatecharactercode{forever-#1}\else
+ \setmetaglyph {
+ category {demo}
+ name {forever-#1}
+ code {DemoGlyph}
+ shapes {
+ { shape {DemoCenter} color {middlegray} }
+ { shape {DemoLowerLeft} color {dark#1} }
+ { shape {DemoLowerRight} color {dark#1} }
+ { shape {DemoUpperRight} color {dark#1} }
+ { shape {DemoUpperLeft} color {dark#1} }
+ { shape {DemoUp} color {light#1} }
+ { shape {DemoDown} color {light#1} }
+ { shape {DemoLeft} color {light#1} }
+ { shape {DemoRight} color {light#1} }
+ }
+ }%
+ \fi
+ \privatecharacter{forever-#1}%
+ \endgroup}
+
+ \dontcomplain
+
+ \dorecurse{1000}{%
+ \MyChar{red}\space
+ \MyChar{green}\space
+ \MyChar{blue}\space
+ \MyChar{yellow}\space
+ }
+
+ \page
+
+ \start
+ \glyphxscale 1200
+ \glyphyscale 800
+ \dorecurse{1000}{%
+ \MyChar{red}\allowbreak
+ \MyChar{green}\allowbreak
+ \MyChar{blue}\allowbreak
+ \MyChar{yellow}\allowbreak
+ }
+ \stop
+
\stoptext
diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt
index 2bca97abb..e68abf587 100644
--- a/tex/context/base/mkxl/mlib-scn.lmt
+++ b/tex/context/base/mkxl/mlib-scn.lmt
@@ -26,7 +26,7 @@ if not modules then modules = { } end modules ['mlib-scn'] = {
-- endfor ;
-- popparameters;
-local type, next, rawget, getmetatable = type, next, rawget, getmetatable
+local type, next, rawget, getmetatable, tonumber = type, next, rawget, getmetatable, tonumber
local byte, gmatch = string.byte, string.gmatch
local insert, remove = table.insert, table.remove
@@ -480,6 +480,14 @@ local function getparameterdefault()
if vl == nil then
return injectnumeric(0)
else
+ if type(vl) == "string" then
+ local td = type(list[n])
+ if td == "number" then
+ vl = tonumber(vl)
+ elseif td == "boolean" then
+ vl = vl == "true"
+ end
+ end
return get(vl)
end
else
@@ -527,6 +535,14 @@ local function getparameterdefault()
if v == nil then
return get(list[n])
else
+ if type(v) == "string" then
+ local td = type(list[n])
+ if td == "number" then
+ v = tonumber(v)
+ elseif td == "boolean" then
+ v = v == "true"
+ end
+ end
return get(v)
end
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f332a013b..5ad418348 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2021-01-21 18:01
+-- merge date : 2021-01-22 09:38
do -- begin closure to overcome local limits and interference