summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpxl/mp-lmtx.mpxl28
-rw-r--r--metapost/context/fonts/mpiv/demo-symbols.tex35
2 files changed, 53 insertions, 10 deletions
diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl
index 88a0450d6..ae00f43f1 100644
--- a/metapost/context/base/mpxl/mp-lmtx.mpxl
+++ b/metapost/context/base/mpxl/mp-lmtx.mpxl
@@ -2221,6 +2221,34 @@ def lmt_registerglyph = applyparameters "mpsglyph" "lmt_do_registerglyph" end
newscriptindex mfid_registerglyphs ; mfid_registerglyphs := scriptindex "registerglyphs" ; def lmt_do_registerglyphs = runscript mfid_registerglyphs enddef ;
newscriptindex mfid_registerglyph ; mfid_registerglyph := scriptindex "registerglyph" ; def lmt_do_registerglyph = runscript mfid_registerglyph enddef ;
+% 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 ;
+ ) ;
+ llx := xpart llcorner snippets[u] ;
+ lly := ypart llcorner snippets[u] ;
+ urx := xpart urcorner snippets[u] ;
+ ury := ypart urcorner snippets[u] ;
+ lmt_registerglyph [
+ category = getparameter "mpsfont" "category",
+ unicode = u,
+ code = "draw " & str snippets & "[" & decimal u & "]",
+ height = ury,
+ depth = - lly,
+ width = urx - llx,
+ boundingbox = { llx, lly, urx, ury }
+ ] ;
+enddef ;
+
+permanent composeglyph ;
+
% Again an experiment (todo: the faster method):
newscriptindex mfid_remaptext ; mfid_remaptext := scriptindex "remaptext" ; def lmt_remaptext = runscript mfid_remaptext enddef ;
diff --git a/metapost/context/fonts/mpiv/demo-symbols.tex b/metapost/context/fonts/mpiv/demo-symbols.tex
index e9af4a027..b85803b24 100644
--- a/metapost/context/fonts/mpiv/demo-symbols.tex
+++ b/metapost/context/fonts/mpiv/demo-symbols.tex
@@ -1,21 +1,36 @@
+%\setupbodyfont[dejavu]
+
\starttext
- \definemetafont[demo-symbols][demo-symbols.mp]
+ \ifcase\contextlmtxmode
+
+ \definemetafont[demo-symbols][demo-symbols.mp]
+
+ \startbuffer
+ watch this: {\demo\char"261A} \quad \ruledhbox{\demo\char"261A}
+ \stopbuffer
+
+ \definefont[demo][demo@demo-symbols]
+
+ \getbuffer \blank
+
+ \definefont[demo][demo@demo-symbols at \the\dimexpr3\exheight]
- \startbuffer
- watch this: {\demo\char"261A} \quad \ruledhbox{\demo\char"261A}
- \stopbuffer
+ \getbuffer \blank
- \definefont[demo][demo@demo-symbols]
+ \definefont[demo][demo@demo-symbols at \the\dimexpr4\exheight]
- \getbuffer \blank
+ \getbuffer \blank
- \definefont[demo][demo@demo-symbols at \the\dimexpr3\exheight]
+ \else
- \getbuffer \blank
+ \showglyphs
- \definefont[demo][demo@demo-symbols at \the\dimexpr4\exheight]
+ \startTEXpage[offset=10pt]
+ \definemetafont[MyDemoA][demo-symbols][at 10pt]\MyDemoA\char9754
+ \definemetafont[MyDemoB][demo-symbols][at 30pt]\MyDemoB\char9754
+ \stopTEXpage
- \getbuffer \blank
+ \fi
\stoptext