ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* special characters and \startuseMPgraphic{FunnyFrame}
@ 2004-05-03 18:40 Helmut Schwertner
  2004-05-03 18:57 ` Willi Egger
  2004-05-03 19:00 ` Mikael Persson
  0 siblings, 2 replies; 3+ messages in thread
From: Helmut Schwertner @ 2004-05-03 18:40 UTC (permalink / raw)


Hello,

the following example does not work if the text in the 
\FrameTitle{Blockflötenspielen} contains special characters like öäßé etc.

Has someone a solution for this problem?

Thanks a lot,

Helmut


***********************************************************
\mainlanguage[de]
\language[de]
\enableregime[windows]
\setuppapersize[a4][a4]
\setupoutput[pdftex]
\pdfcompresslevel=0

\runMPgraphicstrue

\setupcolors[state=start]

\startuseMPgraphic{FunnyFrame}
  picture p; numeric w, h, o;
  p:=textext.rt(\MPstring{FunnyFrame});
  w:=OverlayWidth; h:=OverlayHeight; o:=BodyFontSize;
  p:=p shifted (2o,h-ypart center p); draw p;
  drawoptions (withpen pencircle scaled 1pt withcolor .625blue);
  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p, h) ;
  draw boundingbox p;
  setbounds currentpicture to unitsquare xyscaled (w,h);
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]

\defineframedtext[FunnyText][frame=off,background=FunnyFrame]

\def\StartFrame{\startFunnyText}
\def\StopFrame{\stopFunnyText}

\def\FrameTitle#1%
  {\setMPtext{FunnyFrame}{\hbox spread 2em {\hss\strut#1\hss}}}

\setMPtext{FunnyFrame}{}

\starttext

\FrameTitle{Blockflötenspielen}
\StartFrame
These: Blockflötenspielen macht Spaß!
\StopFrame

\stoptext

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

* Re: special characters and \startuseMPgraphic{FunnyFrame}
  2004-05-03 18:40 special characters and \startuseMPgraphic{FunnyFrame} Helmut Schwertner
@ 2004-05-03 18:57 ` Willi Egger
  2004-05-03 19:00 ` Mikael Persson
  1 sibling, 0 replies; 3+ messages in thread
From: Willi Egger @ 2004-05-03 18:57 UTC (permalink / raw)


Hi Helmut,

In order to make it work you need to setup the bodyfont. Furthermore it 
is needed to let MetaPost know which font to use. See below.

Here your code gives the expected result.

Grüße
Willi



Helmut Schwertner wrote:

> Hello,
> 
> the following example does not work if the text in the 
> \FrameTitle{Blockflötenspielen} contains special characters like öäßé etc.
> 
> Has someone a solution for this problem?
> 
> Thanks a lot,
> 
> Helmut
> 
> 
> ***********************************************************
> \mainlanguage[de]
> \language[de]
> \enableregime[windows]
> \setuppapersize[a4][a4]
> \setupoutput[pdftex]
> \pdfcompresslevel=0
> 
> \runMPgraphicstrue

\usetypescript[palatino][texnansi]
\setupbodyfont[palatino,rm,12pt]

\startMPenvironment
     \usetypescript[palatino][texnansi]
     \setupbodyfont[palatino,rm,14pt]
\stopMPenvironment

> \setupcolors[state=start]
> 
> \startuseMPgraphic{FunnyFrame}
>  picture p; numeric w, h, o;
>  p:=textext.rt(\MPstring{FunnyFrame});
>  w:=OverlayWidth; h:=OverlayHeight; o:=BodyFontSize;
>  p:=p shifted (2o,h-ypart center p); draw p;
>  drawoptions (withpen pencircle scaled 1pt withcolor .625blue);
>  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p, h) ;
>  draw boundingbox p;
>  setbounds currentpicture to unitsquare xyscaled (w,h);
> \stopuseMPgraphic
> 
> \defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
> 
> \defineframedtext[FunnyText][frame=off,background=FunnyFrame]
> 
> \def\StartFrame{\startFunnyText}
> \def\StopFrame{\stopFunnyText}
> 
> \def\FrameTitle#1%
>  {\setMPtext{FunnyFrame}{\hbox spread 2em {\hss\strut#1\hss}}}
> 
> \setMPtext{FunnyFrame}{}
> 
> \starttext
> 
> \FrameTitle{Blockflötenspielen}
> \StartFrame
> These: Blockflötenspielen macht Spaß!
> \StopFrame
> 
> \stoptext
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: special characters and  \startuseMPgraphic{FunnyFrame}
  2004-05-03 18:40 special characters and \startuseMPgraphic{FunnyFrame} Helmut Schwertner
  2004-05-03 18:57 ` Willi Egger
@ 2004-05-03 19:00 ` Mikael Persson
  1 sibling, 0 replies; 3+ messages in thread
From: Mikael Persson @ 2004-05-03 19:00 UTC (permalink / raw)


> Hello,
>
> the following example does not work if the text in the
> \FrameTitle{Blockflötenspielen} contains special characters like öäßé etc.
>
> Has someone a solution for this problem?
>
> Thanks a lot,
>
> Helmut
>
>

I had a similar problem some time ago. But I used the utf regime. The
solution (I dont know if I read it on the list or where it came from) was
to put curly braces around those characters. In this case it would be

\enableregime[utf]
instead of
\enableregime[windows]

and then

These: Blockfl{ö}tenspielen macht Spa{ß}!

I tried this with your doc and it worked.

Probably someone soon comes up with a nicer solution,

Regards, Micke P

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

end of thread, other threads:[~2004-05-03 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03 18:40 special characters and \startuseMPgraphic{FunnyFrame} Helmut Schwertner
2004-05-03 18:57 ` Willi Egger
2004-05-03 19:00 ` Mikael Persson

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).