[NTG-context] adapt fontsize to given width

Wolfgang Schuster schuster.wolfgang at gmail.com
Wed Jan 14 19:59:18 CET 2015


> Am 14.01.2015 um 18:58 schrieb Wolfgang Schuster <schuster.wolfgang at gmail.com>:
> 
> 
>> Am 14.01.2015 um 17:50 schrieb Pablo Rodriguez <oinos at 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


More information about the ntg-context mailing list