ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* glyph path
@ 2014-02-19 12:25 Peter Rolf
  2014-02-19 18:41 ` Peter Rolf
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Rolf @ 2014-02-19 12:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Hi,

I tried the "Dcaron" example from the MetaPost manual (page 50) and it
works nicely when called with "mpost".

% Dcaron.mp
fontmapfile"=lm-ec.map";
beginfig(56);
    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
endfig;
% -------

But how can I get the glyph path(s) with luatex (mplib)?

Minimal example (glyph.mkiv) and console output are attached (log is
empty). Looks like I can't use 'fontmapfile' and without it the glyphs
are not found.


Peter

[-- Attachment #2: glyph.console --]
[-- Type: text/plain, Size: 5167 bytes --]


mtx-context     | run 1: luatex --fmt="R:/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="glyph" --lua="R:/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui" --no-parse-first-line --c:currentrun=1 --c:fulljobname="./glyph.mkiv" --c:input="./glyph.mkiv" --c:kindofrun=1 --c:maxnofruns=8 "cont-yes.mkiv"
This is LuaTeX, Version beta-0.77.0-2013122323 (rev 4694) 
 \write18 enabled.
(R:/tex/texmf-context/tex/context/base/cont-yes.mkiv

ConTeXt  ver: 2013.12.24 17:52 MKIV beta  fmt: 2013.12.25  int: english/english

system          > 'cont-new.mkiv' loaded
(R:/tex/texmf-context/tex/context/base/cont-new.mkiv)
system          > files > jobname 'glyph', input './glyph.mkiv', result 'glyph'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
(d:/mydocs/TeX/dokumente/D3/glyph.mkiv{R:/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown library 'loc'
{R:/tex/texmf/fonts/map/dvips/lm/lm-math.map}{R:/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > 'fallback modern rm 12pt' is loaded
metapost        > initializing instance 'metafun' using format 'metafun'
metapost        > loading 'metafun' as 'R:/tex/texmf-context/metapost/context/base/metafun.mpiv' using method 'default'
metapost        > initializing number mode 'scaled'
metapost        > error: 
Warning: cannot open font map file mpost.map
{lm-ec.map
Out of memory!

metapost        > error: no-term
no-error
nil
backend         > xmp > using file 'R:/tex/texmf-context/tex/context/base/lpdf-pdx.xml'
pages           > flushing realpage 1, userpage 1
 ) )<R:/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf>

mkiv lua stats  > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: R:/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > resource resolver: loadtime 0.000 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 29 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 338 modules (0.094 sec), 69 tables (0.000 sec), 407 chunks (0.094 sec)
mkiv lua stats  > cleaned up reserved nodes: 42 nodes, 9 lists of 442
mkiv lua stats  > node memory usage: 2 glue, 2 penalty, 9 attribute, 28 glue_spec, 3 attribute_list
mkiv lua stats  > node list callback tasks: 6 unique task lists, 5 instances (re)created, 40 calls
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > loaded patterns: en::2, load time: 0.000
mkiv lua stats  > jobdata time: 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats  > callbacks: 141 direct, 196 indirect, 337 total
mkiv lua stats  > result saved in file: glyph.pdf, compresslevel 3, objectcompreslevel 3
mkiv lua stats  > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf
mkiv lua stats  > fonts load time: 0.094 seconds for 4 fonts, 2 shared in backend, 2 common vectors, 0 common hashes
mkiv lua stats  > used platform: win64, type: windows, binary subtree: texmf-win64
mkiv lua stats  > luatex banner: this is luatex, version beta-0.77.0 (tex live 2013/w32tex) (rev 4694)
mkiv lua stats  > control sequences: 38342 of 65536 + 100000
mkiv lua stats  > current memory usage: 49 MB (ctx: 49 MB)
mkiv lua stats  > runtime: 0.250 seconds, 1 processed pages, 1 shipped pages, 4.000 pages/second

mtx-context     | run 1: luatex --fmt="R:/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="glyph" --lua="R:/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui" --no-parse-first-line --c:currentrun=2 --c:fulljobname="./glyph.mkiv" --c:input="./glyph.mkiv" --c:kindofrun=2 --c:maxnofruns=8 "cont-yes.mkiv"
This is LuaTeX, Version beta-0.77.0-2013122323 (rev 4694) 
 \write18 enabled.
(R:/tex/texmf-context/tex/context/base/cont-yes.mkiv

ConTeXt  ver: 2013.12.24 17:52 MKIV beta  fmt: 2013.12.25  int: english/english

system          > 'cont-new.mkiv' loaded
(R:/tex/texmf-context/tex/context/base/cont-new.mkiv)
system          > files > jobname 'glyph', input './glyph.mkiv', result 'glyph'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
(d:/mydocs/TeX/dokumente/D3/glyph.mkiv{R:/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown library 'loc'
{R:/tex/texmf/fonts/map/dvips/lm/lm-math.map}{R:/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > 'fallback modern rm 12pt' is loaded
metapost        > initializing instance 'metafun' using format 'metafun'
metapost        > loading 'metafun' as 'R:/tex/texmf-context/metapost/context/base/metafun.mpiv' using method 'default'
metapost        > initializing number mode 'scaled'

mtx-context     | fatal error: return code: -1073741819

[-- Attachment #3: glyph.mkiv --]
[-- Type: text/plain, Size: 596 bytes --]

\startMPinclusions
   fontmapfile "=lm-ec.map";
\stopMPinclusions

\startuniqueMPgraphic{Dcaron}
   path p[];
   picture q;

   q:= glyph "Dcaron" of "ec-lmr10" scaled .2;
   i:= 1;
   for item within q:
       p[i] := pathpart item;
       i:= i+1;
   endfor

   draw_arrow_path(p1);
   draw_arrow_path(p2);
   draw_arrow_path(p3);

   passarrayvariable("Dcaron",p,1,3,1);
   setbounds currentpicture to boundingbox q;
\stopuniqueMPgraphic


\starttext
\ctxlua{metapost.showlog = true}
\uniqueMPgraphic{Dcaron}
\ctxlua{inspect(metapost.variables[Dcaron])}
\stoptext

[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glyph path
  2014-02-19 12:25 glyph path Peter Rolf
@ 2014-02-19 18:41 ` Peter Rolf
  2014-02-20  8:58   ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Rolf @ 2014-02-19 18:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Forgot to tell why I need the glyph paths...
I implemented multi path support in drops yesterday and now I want to
test it with some glyphs. Currently I use Inkscape (export the glyph
path as PDF) and pdftoedit to finally get a MP path. Time consuming and
the result still needs a manual clean-up.

Here is my current test example. Needless to say, that the path blew up
my code in the first run (a too low threshold value) :-D

http://www.wuala.com/indiego/public/ConTeXt/pathtest.pdf


Am 19.02.2014 13:25, schrieb Peter Rolf:
> Hi,
> 
> I tried the "Dcaron" example from the MetaPost manual (page 50) and it
> works nicely when called with "mpost".
> 
> % Dcaron.mp
> fontmapfile"=lm-ec.map";
> beginfig(56);
>     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
> endfig;
> % -------
> 
> But how can I get the glyph path(s) with luatex (mplib)?
> 
> Minimal example (glyph.mkiv) and console output are attached (log is
> empty). Looks like I can't use 'fontmapfile' and without it the glyphs
> are not found.
> 
> 
> Peter
> 
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glyph path
  2014-02-19 18:41 ` Peter Rolf
@ 2014-02-20  8:58   ` Hans Hagen
  2014-02-20 10:57     ` Peter Rolf
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2014-02-20  8:58 UTC (permalink / raw)
  To: ntg-context

On 2/19/2014 7:41 PM, Peter Rolf wrote:
> Forgot to tell why I need the glyph paths...
> I implemented multi path support in drops yesterday and now I want to
> test it with some glyphs. Currently I use Inkscape (export the glyph
> path as PDF) and pdftoedit to finally get a MP path. Time consuming and
> the result still needs a manual clean-up.

% macros=mkvi

\definefont[RatherBig][Mono at 60pt]

\defineeffect [justone] [alternative=outer,rulethickness=1pt]
\defineeffect [justtwo] [alternative=inner]

\starttexdefinition example #font#line#text
     \hbox {
         \framed [offset=\dimexpr#line/2\relax,strut=no,frame=off] {
             \definedfont[#font]
             \defineeffect[bg][alternative=outer,rulethickness=#line]
             \defineeffect[fg][alternative=inner]
             \hsmash{\red \effect[bg]{#text}}
             \hbox  {\blue\effect[fg]{#text}}
         }
     }
\stoptexdefinition

\starttext

{\effect[justone]{\RatherBig BIG}}

{\effect[justtwo]{\RatherBig BIG}}

\example{Mono at 60pt}{5pt}{BIG}

\example{Mono at 80pt}{10pt}{BIG}

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: glyph path
  2014-02-20  8:58   ` Hans Hagen
@ 2014-02-20 10:57     ` Peter Rolf
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Rolf @ 2014-02-20 10:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 20.02.2014 09:58, schrieb Hans Hagen:
> On 2/19/2014 7:41 PM, Peter Rolf wrote:
>> Forgot to tell why I need the glyph paths...
>> I implemented multi path support in drops yesterday and now I want to
>> test it with some glyphs. Currently I use Inkscape (export the glyph
>> path as PDF) and pdftoedit to finally get a MP path. Time consuming and
>> the result still needs a manual clean-up.
> 
> % macros=mkvi
> 
> \definefont[RatherBig][Mono at 60pt]
> 
> \defineeffect [justone] [alternative=outer,rulethickness=1pt]
> \defineeffect [justtwo] [alternative=inner]
> 
> \starttexdefinition example #font#line#text
>     \hbox {
>         \framed [offset=\dimexpr#line/2\relax,strut=no,frame=off] {
>             \definedfont[#font]
>             \defineeffect[bg][alternative=outer,rulethickness=#line]
>             \defineeffect[fg][alternative=inner]
>             \hsmash{\red \effect[bg]{#text}}
>             \hbox  {\blue\effect[fg]{#text}}
>         }
>     }
> \stoptexdefinition
> 
> \starttext
> 
> {\effect[justone]{\RatherBig BIG}}
> 
> {\effect[justtwo]{\RatherBig BIG}}
> 
> \example{Mono at 60pt}{5pt}{BIG}
> 
> \example{Mono at 80pt}{10pt}{BIG}
> 
> \stoptext
> 

Thanks for this nice example (I wasn't aware of this).
But this doesn't really help me with my problem. I guess my example had
too much irritating eye candy, so I made another one :-)

http://www.wuala.com/indiego/public/ConTeXt/pathtest2.pdf

The problem is, that I need direct access to the glyphs path(s), as I
must calculate the offset paths for the sub shadows (umbra/penumbra).
Inkscape has a similar function called "inset/outset path", if I
remember right.
In the example I used a negative offset for the umbra shadow (udistance)
and a positive for the penumbra shadow (pdistance). The original path is
drawn as 'arrowpath'.
The path creating algorithm (based on the Tiller-Hanson alg.) works
quite good so far, but still needs a lot of tweaking. And glyphs have a
wide range of shapes, so they are nearly ideal for testing purposes.

Anyhow, it can't be helped, if 'glyph' is not working. I'll test some
ConTeXt generated PDF glyphs (MPpage) then and see if I can optimize the
manual path creation a little bit.

Best wishes,

Peter



___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-20 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-19 12:25 glyph path Peter Rolf
2014-02-19 18:41 ` Peter Rolf
2014-02-20  8:58   ` Hans Hagen
2014-02-20 10:57     ` Peter Rolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).