MetaPost integration: default parameters
Hi, ConTeXt already passes quite a few length parameters on to embedded MetaPost code ... BodyFontSize, CurrentWidth etc. Would it be possible to add some more font/math related parameters to the default definitions? I'm thinking of exposing math OpenType parameters like AxisHeight FractionRuleThickness UpperLimitBaselineRiseMin UpperLimitGapMin LowerLimitGapMin LowerLimitBaselineDropMin etc. of the surrounding text to MetaPost as well. This would be very handy for me since I need to draw diagrammatic expressions to be used in formulas and I'd like them to adapt to the current math font and fontsize automatically. At the moment I set these variables manually... Also, is there a way to directly get the glyph outlines of, say, $ \bigotimes$ in MetaPost code and use it to derive some length unit from it? Oliver
On Fri, Nov 13, 2009 at 17:53, Oliver Buerschaper wrote:
Also, is there a way to directly get the glyph outlines of, say, $\bigotimes$ in MetaPost code and use it to derive some length unit from it?
Yes, but this only works for Type1 fonts, not for OpenType. The example below is a literal copy from metapost manual (created by Taco). You first search in the source for that glyph: \definemathsymbol [bigotimes] [op] [ex] ["4E] % this equals 78 in decimal notation and then you need either name or number of glyph + name of font. fontmapfile "=lm-math.map"; beginfig(1); picture q; path p; interim ahlength := 12bp; interim ahangle := 25; q := glyph 78 of "lmex10" scaled .2; % q := glyph "circlemultiplytext" of "lmex10" scaled .2; % cheat by looking at lm-mathex.enc for item within q: p := pathpart item; drawarrow p withcolor (.6,.9,.6) withpen pencircle scaled 1.5; for j=0 upto length p: pickup pencircle scaled .7; draw (point j of p -- precontrol j of p) dashed evenly withcolor blue; draw (point j of p -- postcontrol j of p) dashed evenly withcolor blue; pickup pencircle scaled 3; draw precontrol j of p withcolor red; draw postcontrol j of p withcolor red; pickup pencircle scaled 2; draw point j of p withcolor black; endfor endfor endfig; end. Mojca
Hi Mojca,
Also, is there a way to directly get the glyph outlines of, say, $\bigotimes$ in MetaPost code and use it to derive some length unit from it?
Yes, but this only works for Type1 fonts, not for OpenType.
The example below is a literal copy from metapost manual (created by Taco).
This is quite impressive! This will make it much easier for me to obtain the right dimensions… Now if only this worked with OpenType as well (or any other font format ConTeXt understands natively)… and it would be really great if direct access to outlines extended to arbitrary typeset material beyond single glyphs. I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV? Oliver
On Sun, Nov 22, 2009 at 8:16 PM, Oliver Buerschaper
I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV?
If you manage to extend dvips to handle OpenType fonts then maybe ...
So does this mean that outline fonts in MetaPost are currently dead with MkIV?
%%test-outlined.tex \starttext \startTEXpage \startuseMPgraphic{a} graphictext "\bf Fun" scaled 4 zscaled (1,1.5) withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext #context test-outlined works ok here -- luigi
Am 22.11.2009 um 21:15 schrieb luigi scarso:
%%test-outlined.tex \starttext \startTEXpage \startuseMPgraphic{a} graphictext "\bf Fun" scaled 4 zscaled (1,1.5) withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext
\starttext {\blue\tfd Fun\llap{\red\property[outer]{\tfd Fun}}} \stoptext Wolfgang
On Sun, Nov 22, 2009 at 9:33 PM, Wolfgang Schuster
Am 22.11.2009 um 21:15 schrieb luigi scarso:
%%test-outlined.tex \starttext \startTEXpage \startuseMPgraphic{a} graphictext "\bf Fun" scaled 4 zscaled (1,1.5) withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext
\starttext {\blue\tfd Fun\llap{\red\property[outer]{\tfd Fun}}} \stoptext
Also from metapost manual \starttext \startTEXpage \startuseMPgraphic{a} fontmapfile "=lm-ec.map"; picture q; path p; interim ahlength := 12bp; interim ahangle := 25; q := glyph "Dcaron" of "ec-lmr10" scaled .2; for item within q: p := pathpart item; drawarrow p withcolor (.6,.9,.6) withpen pencircle scaled 1.5; for j=0 upto length p: pickup pencircle scaled .7; draw (point j of p -- precontrol j of p) dashed evenly withcolor blue; draw (point j of p -- postcontrol j of p) dashed evenly withcolor blue; pickup pencircle scaled 3; draw precontrol j of p withcolor red; draw postcontrol j of p withcolor red; pickup pencircle scaled 2; draw point j of p withcolor black; endfor endfor \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext -- luigi
Oliver Buerschaper wrote:
I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV? If you manage to extend dvips to handle OpenType fonts then maybe ...
So does this mean that outline fonts in MetaPost are currently dead with MkIV?
it's unrelated to tex ... outlines are ther ebecause of the svg output mode of metapost and so providing access made sense; opentype is another matter Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, Nov 22, 2009 at 20:16, Oliver Buerschaper wrote:
I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV?
If you manage to extend dvips to handle OpenType fonts then maybe ...
So does this mean that outline fonts in MetaPost are currently dead with MkIV?
I just said that pstoedit workflow is not likely to work with OpenType fonts, nothing else. You can still use something like (copy-pasting Wolfgang's example without testing): textext("{\blue\tfd Fun\llap{\red\property[outer]{\tfd Fun}}}") or you can use non-OpenType font in MKIV to access the exact path of text. But I'm really impressed about Taco's answer :) Mojca
Mojca Miklavec wrote:
On Sun, Nov 22, 2009 at 20:16, Oliver Buerschaper wrote:
I know there used to be a TeX -> PS -> pstoedit -> MetaPost workflow. Does this still work with MkIV? If you manage to extend dvips to handle OpenType fonts then maybe ... So does this mean that outline fonts in MetaPost are currently dead with MkIV?
I just said that pstoedit workflow is not likely to work with OpenType fonts, nothing else.
why not? it uses gs for converting the shapes to outlines ... works ok Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Mon, Nov 23, 2009 at 10:47 AM, Hans Hagen
why not? it uses gs for converting the shapes to outlines ... works ok
Hans I will check it with Symbola http://users.teilar.gr/~g1951d/Symbola.zip -- luigi
On Mon, Nov 23, 2009 at 10:56 AM, luigi scarso
On Mon, Nov 23, 2009 at 10:47 AM, Hans Hagen
wrote: why not? it uses gs for converting the shapes to outlines ... works ok
Hans I will check it with Symbola http://users.teilar.gr/~g1951d/Symbola.zip Given that I'm lazy
# diff mlib-pps.lua mlib-pps-patch.lua 809c809 < local start = [[\starttext]] ---
local start = [[\definefont[MyUnicodeSymbols][Symbola]\starttext]]
%%test-outlined.tex \definefont[MyUnicodeSymbols][Symbola] \ctxloadluafile{mlib-pps-patch}{} \starttext \startTEXpage \startuseMPgraphic{a} graphictext "\bf No Fun here {\MyUnicodeSymbols\unicodechar{9925}}" scaled 4 zscaled (1,1.5) withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt \stopuseMPgraphic \useMPgraphic{a} \stopTEXpage \stoptext -- luigi
MetaPost is broken in mkiv (works in mkii). minimal example: \starttext \startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic \uniqueMPgraphic{circle} \stoptext
On Tue, Nov 24, 2009 at 9:05 PM, Alan BRASLAU
MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
It seems ok here # context --version MTXrun | main context file: /opt/luatex/minimals-beta/tex/texmf-context/tex/context/base/context.tex MTXrun | current version: 2009.11.24 10:13 root@luigicasa-laptop:/opt/luatex/mkiv# luatex --version This is LuaTeX, Version beta-0.44.0-2009110210 # uname -a Linux luigicasa-laptop 2.6.24-25-generic #1 SMP Tue Oct 20 07:31:10 UTC 2009 i686 GNU/Linux Ububtu 8.04 LTS 32 bit -- luigi
On Tuesday 24 November 2009 21:20:05 luigi scarso wrote:
On Tue, Nov 24, 2009 at 9:05 PM, Alan BRASLAU
wrote: MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
It seems ok here # context --version MTXrun | main context file: /opt/luatex/minimals-beta/tex/texmf-context/tex/context/base/context.tex MTXrun | current version: 2009.11.24 10:13
root@luigicasa-laptop:/opt/luatex/mkiv# luatex --version This is LuaTeX, Version beta-0.44.0-2009110210
Thanks. I checked, and it is broken on amd64: MTXrun | main context file: /home/local/context/tex/texmf- context/tex/context/base/context.tex MTXrun | current version: 2009.11.24 10:13 This is LuaTeX, Version beta-0.45.0-2009112119 But works on i686: MTXrun | main context file: /home/dell/local/context/tex/texmf- context/tex/context/base/context.tex MTXrun | current version: 2009.11.24 10:13 This is LuaTeX, Version beta-0.44.0-2009110210 So it is a luatex bug in Version beta-0.45.0-2009112119 Alan
Alan BRASLAU wrote:
MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
the problem was in the backend of one of the recent luatex binaries but has been solved already Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, Nov 24, 2009 at 21:21, Hans Hagen wrote:
Alan BRASLAU wrote:
MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
the problem was in the backend of one of the recent luatex binaries but has been solved already
May I bet that Alan is using linux for which I need Hans' build for which it might be polite of me to send him new building scripts since the current ones fail (the old version of svn on debian sarge doesn't recognize some of the options)? Sorry guys, but it's too late today. Mojca
Mojca Miklavec wrote:
On Tue, Nov 24, 2009 at 21:21, Hans Hagen wrote:
MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
Alan BRASLAU wrote: the problem was in the backend of one of the recent luatex binaries but has been solved already
May I bet that Alan is using linux for which I need Hans' build for which it might be polite of me to send him new building scripts since the current ones fail (the old version of svn on debian sarge doesn't recognize some of the options)?
Sorry guys, but it's too late today.
ok, i will do it tomorrow Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tuesday 24 November 2009 21:49:06 Hans Hagen wrote:
Mojca Miklavec wrote:
On Tue, Nov 24, 2009 at 21:21, Hans Hagen wrote:
Alan BRASLAU wrote:
MetaPost is broken in mkiv (works in mkii).
minimal example:
\starttext
\startuniqueMPgraphic{circle} pickup pencircle scaled 1pt ; draw fullcircle scaled 2cm ; \stopuniqueMPgraphic
\uniqueMPgraphic{circle}
\stoptext
the problem was in the backend of one of the recent luatex binaries but has been solved already
May I bet that Alan is using linux for which I need Hans' build for which it might be polite of me to send him new building scripts since the current ones fail (the old version of svn on debian sarge doesn't recognize some of the options)?
Sorry guys, but it's too late today.
ok, i will do it tomorrow
Hans
I rebuilt luatex from svn on Debian x86_64 and MP is fixed. Alan
On Tue, Nov 24, 2009 at 10:51 PM, Alan BRASLAU
I rebuilt luatex from svn on Debian x86_64 and MP is fixed. hm. Can you also try with beta source http://foundry.supelec.fr/gf/download/frsrelease/359/1390/luatex-beta-0.45.0... ? -- luigi
luigi scarso wrote:
On Tue, Nov 24, 2009 at 10:51 PM, Alan BRASLAU
wrote: I rebuilt luatex from svn on Debian x86_64 and MP is fixed. hm. Can you also try with beta source http://foundry.supelec.fr/gf/download/frsrelease/359/1390/luatex-beta-0.45.0...
That one is broken, sorry. New beta on thursday (probably). Best wishes, Taco
Oliver Buerschaper wrote:
Hi Mojca,
Also, is there a way to directly get the glyph outlines of, say, $\bigotimes$ in MetaPost code and use it to derive some length unit from it? Yes, but this only works for Type1 fonts, not for OpenType.
The example below is a literal copy from metapost manual (created by Taco).
This is quite impressive! This will make it much easier for me to obtain the right dimensions…
Now if only this worked with OpenType as well (or any other font
At some point next year I will rewrite the font backend of luatex, and at the same time make it a bit more generic. Once that is done, the new code can be ported to metapost. Don't hold your breath, it will likely take more than a year. Best wishes, Taco
participants (7)
-
Alan BRASLAU
-
Hans Hagen
-
luigi scarso
-
Mojca Miklavec
-
Oliver Buerschaper
-
Taco Hoekwater
-
Wolfgang Schuster