Hello, How to make the width of framedtext automatically adapts to its contents. Fabrice \definefloat [recipe] [figure] \setupfloat [recipe] [default={right,none}] \definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784] \definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00] \defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, height=fit] \startuseMPgraphic{MyFrame} path b; picture p; p := textext.rt("\tfx\white\framedtextparameter{Title}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); b := boundingbox p enlarged .3EmWidth ; fill OverlayBox withcolor \MPcolor{MyColorA}; fill b withcolor \MPcolor{MyColorB} ; draw p ; setbounds currentpicture to boundingbox currentpicture enlarged 2mm ; \stopuseMPgraphic \defineoverlay [MyFrame] [\useMPgraphic{MyFrame}] \starttext \placerecipe{}{ \startMyFrame[Title=Info] L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes. \stopMyFrame} \input Knuth \stoptext
On Tue, 1 Nov 2016 00:12:37 +0100
Fabrice Couvreur
How to make the width of framedtext automatically adapts to its contents.
[…]
\defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, align=tolerant, height=fit]
[…]
You can use \showframe to visualise the frames and check what's going on. Marco
Just use
...
\startMyFrame[Title=Info]
\setupalign[hyphenated,morehyphenation,verytolerant]
...
Piotr
2016-11-01 0:12 GMT+01:00 Fabrice Couvreur
Hello, How to make the width of framedtext automatically adapts to its contents. Fabrice
\definefloat [recipe] [figure]
\setupfloat [recipe] [default={right,none}]
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784] \definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]
\defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, height=fit]
\startuseMPgraphic{MyFrame} path b; picture p; p := textext.rt("\tfx\white\framedtextparameter{Title}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); b := boundingbox p enlarged .3EmWidth ; fill OverlayBox withcolor \MPcolor{MyColorA}; fill b withcolor \MPcolor{MyColorB} ; draw p ; setbounds currentpicture to boundingbox currentpicture enlarged 2mm ; \stopuseMPgraphic
\defineoverlay [MyFrame] [\useMPgraphic{MyFrame}]
\starttext
\placerecipe{}{ \startMyFrame[Title=Info] L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes. \stopMyFrame}
\input Knuth
\stoptext
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hello,
The option align = tolerant rule one of the problems I may encounter.
But I wonder
if it's possible that I should not choose myself width = 6cm to fit the
text. If I have to use the command several times with different content,
how make ?
Thank you
Fabrice
2016-11-01 9:23 GMT+01:00 Piotr Kopszak
Just use ... \startMyFrame[Title=Info] \setupalign[hyphenated,morehyphenation,verytolerant] ...
Piotr
Hello, How to make the width of framedtext automatically adapts to its contents. Fabrice
\definefloat [recipe] [figure]
\setupfloat [recipe] [default={right,none}]
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784] \definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]
\defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, height=fit]
\startuseMPgraphic{MyFrame} path b; picture p; p := textext.rt("\tfx\white\framedtextparameter{Title}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center
2016-11-01 0:12 GMT+01:00 Fabrice Couvreur
: p+.25ExHeight); b := boundingbox p enlarged .3EmWidth ; fill OverlayBox withcolor \MPcolor{MyColorA}; fill b withcolor \MPcolor{MyColorB} ; draw p ; setbounds currentpicture to boundingbox currentpicture enlarged 2mm ; \stopuseMPgraphic
\defineoverlay [MyFrame] [\useMPgraphic{MyFrame}]
\starttext
\placerecipe{}{ \startMyFrame[Title=Info] L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes. \stopMyFrame}
\input Knuth
\stoptext
____________________________________________________________
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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ____________________________________________________________
-- http://okle.pl ____________________________________________________________ _______________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ____________________________________________________________ _______________________
You mean, you effectively want ConTeXt to choose best proportions for
the framed text on its own? I guess very few designers would agree for
that, if any.
2016-11-01 10:47 GMT+01:00 Fabrice Couvreur
Hello, The option align = tolerant rule one of the problems I may encounter. But I wonder if it's possible that I should not choose myself width = 6cm to fit the text. If I have to use the command several times with different content, how make ? Thank you Fabrice
2016-11-01 9:23 GMT+01:00 Piotr Kopszak
: Just use ... \startMyFrame[Title=Info] \setupalign[hyphenated,morehyphenation,verytolerant] ...
Piotr
2016-11-01 0:12 GMT+01:00 Fabrice Couvreur
: Hello, How to make the width of framedtext automatically adapts to its contents. Fabrice
\definefloat [recipe] [figure]
\setupfloat [recipe] [default={right,none}]
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784] \definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]
\defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, height=fit]
\startuseMPgraphic{MyFrame} path b; picture p; p := textext.rt("\tfx\white\framedtextparameter{Title}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); b := boundingbox p enlarged .3EmWidth ; fill OverlayBox withcolor \MPcolor{MyColorA}; fill b withcolor \MPcolor{MyColorB} ; draw p ; setbounds currentpicture to boundingbox currentpicture enlarged 2mm ; \stopuseMPgraphic
\defineoverlay [MyFrame] [\useMPgraphic{MyFrame}]
\starttext
\placerecipe{}{ \startMyFrame[Title=Info] L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes. \stopMyFrame}
\input Knuth
\stoptext
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
Okay, so to change locally, I do this :
\placerecipe{}{
\setupframedtexts[MyFrame][width=10cm]
\startMyFrame[Title=One]
....
\stopMyFrame}
\placerecipe{}{
\setupframedtexts[MyFrame][width=8cm]
\startMyFrame[Title=Two]
....
\stopMyFrame}
\placerecipe{}{
\startMyFrame[Title=Three]
....
\stopMyFrame}
2016-11-01 11:17 GMT+01:00 Piotr Kopszak
You mean, you effectively want ConTeXt to choose best proportions for the framed text on its own? I guess very few designers would agree for that, if any.
2016-11-01 10:47 GMT+01:00 Fabrice Couvreur
: Hello, The option align = tolerant rule one of the problems I may encounter. But I wonder if it's possible that I should not choose myself width = 6cm to fit the text. If I have to use the command several times with different content, how make ? Thank you Fabrice
2016-11-01 9:23 GMT+01:00 Piotr Kopszak
: Just use ... \startMyFrame[Title=Info] \setupalign[hyphenated,morehyphenation,verytolerant] ...
Piotr
2016-11-01 0:12 GMT+01:00 Fabrice Couvreur
:
Hello, How to make the width of framedtext automatically adapts to its contents. Fabrice
\definefloat [recipe] [figure]
\setupfloat [recipe] [default={right,none}]
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784] \definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]
\defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, width=6cm, height=fit]
\startuseMPgraphic{MyFrame} path b; picture p; p := textext.rt("\tfx\white\framedtextparameter{Title}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); b := boundingbox p enlarged .3EmWidth ; fill OverlayBox withcolor \MPcolor{MyColorA}; fill b withcolor \MPcolor{MyColorB} ; draw p ; setbounds currentpicture to boundingbox currentpicture enlarged 2mm ; \stopuseMPgraphic
\defineoverlay [MyFrame] [\useMPgraphic{MyFrame}]
\starttext
\placerecipe{}{ \startMyFrame[Title=Info] L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes. \stopMyFrame}
\input Knuth
\stoptext
____________________________________________________________
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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ____________________________________________________________
-- http://okle.pl ____________________________________________________________ _______________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ____________________________________________________________ _______________________
Fabrice Couvreur mailto:fabrice1.couvreur@gmail.com 1. November 2016 um 12:09 Okay, so to change locally, I do this:
\placerecipe{}{ \setupframedtexts[MyFrame][width=10cm] \startMyFrame[Title=One] You can set the width with \startMyFrame, e.g.
\startMyFrame[Title=One,width=10cm] Wolfgang
Sounds something like how PowerPoint works (but adjusting point size to fit a frame...). Alan
On 1 Nov 2016, at 04:17, Piotr Kopszak
wrote: You mean, you effectively want ConTeXt to choose best proportions for the framed text on its own? I guess very few designers would agree for that, if any.
participants (5)
-
Alan Braslau
-
Fabrice Couvreur
-
Marco Patzer
-
Piotr Kopszak
-
Wolfgang Schuster