[NTG-context] adapt fontsize to given width
Wolfgang Schuster
schuster.wolfgang at gmail.com
Wed Jan 14 20:48:51 CET 2015
> Am 14.01.2015 um 20:36 schrieb Pablo Rodriguez <oinos at 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
More information about the ntg-context
mailing list