diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-01-22 09:57:33 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-01-22 09:57:33 +0100 |
commit | dee0d939a50007dbe52f7035d67c01a78289e585 (patch) | |
tree | 15bb507c18b734bc9949b3f03b90eb4638615694 /metapost | |
parent | aea52f4b97d1be9ba194cd9a1d0ff1865c413691 (diff) | |
download | context-dee0d939a50007dbe52f7035d67c01a78289e585.tar.gz |
2021-01-22 09:41:00
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpxl/mp-lmtx.mpxl | 27 |
1 files changed, 17 insertions, 10 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): |