[NTG-context] adapt fontsize to given width

Pablo Rodriguez oinos at gmx.es
Wed Jan 14 20:36:11 CET 2015


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


More information about the ntg-context mailing list