ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* adapt fontsize to given width
@ 2015-01-14 16:50 Pablo Rodriguez
  2015-01-14 17:58 ` Wolfgang Schuster
  2015-01-14 18:05 ` Alan BRASLAU
  0 siblings, 2 replies; 9+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 16:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following sample:

    \showframe
    \starttext
    {\setupbodyfont[120pt]My Title}
    \stoptext

Is there a way to make ConTeXt automatically calculate the size of the
\setupbodyfont, so that the passage fits exactly to text width?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 16:50 adapt fontsize to given width Pablo Rodriguez
@ 2015-01-14 17:58 ` Wolfgang Schuster
  2015-01-14 18:59   ` Wolfgang Schuster
  2015-01-14 19:36   ` Pablo Rodriguez
  2015-01-14 18:05 ` Alan BRASLAU
  1 sibling, 2 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2015-01-14 17:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 14.01.2015 um 17:50 schrieb Pablo Rodriguez <oinos@gmx.es>:
> 
> Dear list,
> 
> I have the following sample:
> 
>    \showframe
>    \starttext
>    {\setupbodyfont[120pt]My Title}
>    \stoptext
> 
> Is there a way to make ConTeXt automatically calculate the size of the
> \setupbodyfont, so that the passage fits exactly to text width?

\starttext

\WidthSpanningText{My Title}{\textwidth}{Serif}

\WidthSpanningText{My Title}{12cm}{MonoBold}

\WidthSpanningText{My Title}{14cm}{SansItalic}

\stoptext

Wolfgang
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 16:50 adapt fontsize to given width Pablo Rodriguez
  2015-01-14 17:58 ` Wolfgang Schuster
@ 2015-01-14 18:05 ` Alan BRASLAU
  2015-01-14 19:47   ` Pablo Rodriguez
  2015-01-14 21:00   ` Hans Hagen
  1 sibling, 2 replies; 9+ messages in thread
From: Alan BRASLAU @ 2015-01-14 18:05 UTC (permalink / raw)
  To: Pablo Rodriguez; +Cc: mailing list for ConTeXt users

On Wed, 14 Jan 2015 17:50:12 +0100
Pablo Rodriguez <oinos@gmx.es> wrote:

> Dear list,
> 
> I have the following sample:
> 
>     \showframe
>     \starttext
>     {\setupbodyfont[120pt]My Title}
>     \stoptext
> 
> Is there a way to make ConTeXt automatically calculate the size of the
> \setupbodyfont, so that the passage fits exactly to text width?
> 
> Many thanks for your help,
> 
> 
> Pablo

There is a MP solution:

\starttext
\startMPcode
   draw textext("My Title") xsized TextWidth ;
\stopMPcode
\stoptext

Alan
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 17:58 ` Wolfgang Schuster
@ 2015-01-14 18:59   ` Wolfgang Schuster
  2015-01-14 19:43     ` Pablo Rodriguez
  2015-01-14 19:36   ` Pablo Rodriguez
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2015-01-14 18:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 14.01.2015 um 18:58 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:
> 
> 
>> Am 14.01.2015 um 17:50 schrieb Pablo Rodriguez <oinos@gmx.es>:
>> 
>> Dear list,
>> 
>> I have the following sample:
>> 
>>   \showframe
>>   \starttext
>>   {\setupbodyfont[120pt]My Title}
>>   \stoptext
>> 
>> Is there a way to make ConTeXt automatically calculate the size of the
>> \setupbodyfont, so that the passage fits exactly to text width?
> 
> \starttext
> 
> \WidthSpanningText{My Title}{\textwidth}{Serif}
> 
> \WidthSpanningText{My Title}{12cm}{MonoBold}
> 
> \WidthSpanningText{My Title}{14cm}{SansItalic}
> 
> \stoptext

Another solution is to use the \scale command:

\starttext
\scale[width=\textwidth]{My Title}
\stoptext

Wolfgang
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 17:58 ` Wolfgang Schuster
  2015-01-14 18:59   ` Wolfgang Schuster
@ 2015-01-14 19:36   ` Pablo Rodriguez
  2015-01-14 19:48     ` Wolfgang Schuster
  1 sibling, 1 reply; 9+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 19:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/14/2015 06:58 PM, Wolfgang Schuster wrote:
>> [...]
>> Is there a way to make ConTeXt automatically calculate the size of the
>> \setupbodyfont, so that the passage fits exactly to text width?
> 
> \starttext
> \WidthSpanningText{My Title}{\textwidth}{Serif}
> \WidthSpanningText{My Title}{12cm}{MonoBold}
> \WidthSpanningText{My Title}{14cm}{SansItalic}
> \stoptext

Many thanks for your reply, Wolfgang.

That was what I was looking for.

There is a minor issue with alignment:

    \starttext

    \startalign[center]
    \widthspanningtext{text}{.5\textwidth}{Serif}
    \stopalign

    \hfill\widthspanningtext{text}{.5\textwidth}{Serif}

    \stoptext

Am I missing something or is \hfill the only way to align the contents
from \widthspanningtext?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 18:59   ` Wolfgang Schuster
@ 2015-01-14 19:43     ` Pablo Rodriguez
  0 siblings, 0 replies; 9+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 19:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/14/2015 07:59 PM, Wolfgang Schuster wrote:
> [...]
> Another solution is to use the \scale command:
> 
> \starttext
> \scale[width=\textwidth]{My Title}
> \stoptext

Many thanks for the new rely, Wolfgang.

I think this is easier to remember.

And replying to my previous question \dontleavehmode allows right (I
mean correct ;-)) alignment.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 18:05 ` Alan BRASLAU
@ 2015-01-14 19:47   ` Pablo Rodriguez
  2015-01-14 21:00   ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 19:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/14/2015 07:05 PM, Alan BRASLAU wrote:
> [...]
> There is a MP solution:
> 
> \starttext
> \startMPcode
>    draw textext("My Title") xsized TextWidth ;
> \stopMPcode
> \stoptext

Many thanks for your reply, Alan.

It’s good to know that MP fits perfectly here.

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 19:36   ` Pablo Rodriguez
@ 2015-01-14 19:48     ` Wolfgang Schuster
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2015-01-14 19:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 14.01.2015 um 20:36 schrieb Pablo Rodriguez <oinos@gmx.es>:
> 
> On 01/14/2015 06:58 PM, Wolfgang Schuster wrote:
>>> [...]
>>> Is there a way to make ConTeXt automatically calculate the size of the
>>> \setupbodyfont, so that the passage fits exactly to text width?
>> 
>> \starttext
>> \WidthSpanningText{My Title}{\textwidth}{Serif}
>> \WidthSpanningText{My Title}{12cm}{MonoBold}
>> \WidthSpanningText{My Title}{14cm}{SansItalic}
>> \stoptext
> 
> Many thanks for your reply, Wolfgang.
> 
> That was what I was looking for.
> 
> There is a minor issue with alignment:
> 
>    \starttext
> 
>    \startalign[center]
>    \widthspanningtext{text}{.5\textwidth}{Serif}
>    \stopalign
> 
>    \hfill\widthspanningtext{text}{.5\textwidth}{Serif}
> 
>    \stoptext
> 
> Am I missing something or is \hfill the only way to align the contents
> from \widthspanningtext?

Use

    \midaligned{\WidthSpanningText{…}{…}{…}}

or

    \startlinealignment[middle]
        \WidthSpanningText{…}{…}{…}
    \stoplinealignment

Wolfgang
___________________________________________________________________________________
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] 9+ messages in thread

* Re: adapt fontsize to given width
  2015-01-14 18:05 ` Alan BRASLAU
  2015-01-14 19:47   ` Pablo Rodriguez
@ 2015-01-14 21:00   ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2015-01-14 21:00 UTC (permalink / raw)
  To: ntg-context

On 1/14/2015 7:05 PM, Alan BRASLAU wrote:
> On Wed, 14 Jan 2015 17:50:12 +0100
> Pablo Rodriguez <oinos@gmx.es> wrote:
>
>> Dear list,
>>
>> I have the following sample:
>>
>>      \showframe
>>      \starttext
>>      {\setupbodyfont[120pt]My Title}
>>      \stoptext
>>
>> Is there a way to make ConTeXt automatically calculate the size of the
>> \setupbodyfont, so that the passage fits exactly to text width?
>>
>> Many thanks for your help,
>>
>>
>> Pablo
>
> There is a MP solution:
>
> \starttext
> \startMPcode
>     draw textext("My Title") xsized TextWidth ;
> \stopMPcode
> \stoptext

\scale[width=\textwidth]{My Title}


-----------------------------------------------------------------
                                           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] 9+ messages in thread

end of thread, other threads:[~2015-01-14 21:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 16:50 adapt fontsize to given width Pablo Rodriguez
2015-01-14 17:58 ` Wolfgang Schuster
2015-01-14 18:59   ` Wolfgang Schuster
2015-01-14 19:43     ` Pablo Rodriguez
2015-01-14 19:36   ` Pablo Rodriguez
2015-01-14 19:48     ` Wolfgang Schuster
2015-01-14 18:05 ` Alan BRASLAU
2015-01-14 19:47   ` Pablo Rodriguez
2015-01-14 21:00   ` Hans Hagen

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