[NTG-context] glyph path

Peter Rolf indiego at gmx.net
Thu Feb 20 11:57:37 CET 2014


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





More information about the ntg-context mailing list