summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpxl/mp-lmtx.mpxl27
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):