ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Is it possible to automatically determine font size	to fit text to a given space?
Date: Fri, 02 Dec 2005 16:30:00 +0100	[thread overview]
Message-ID: <43906878.6090908@wxs.nl> (raw)
In-Reply-To: <439065D0.70807@student.kuleuven.be>

Wolfgang Zillig wrote:

> Could't it be done by metapost?
>
no, that is overkill, but what can be done is:

\startbuffer
the label
\stopbuffer

\externalfigure[buffer][factor=max]

or

\scale[factor=max]{\framed[align=normal]{the label text}}
 
that would scale each label to fit best

but it would look funny (all those different sizes)

a more clever solution would choose different sizes for different label 
components depending on the result

(there is a rudimentary strategy mechanism, one day i will perfect that, 
which can be used to optimize whole documents, think of manipulating the 
distance in columns, or fontsizes in order to stick within a certain 
amount of pages; pretty old and rusty code btw)

> Wolfgang
>
> Hans Hagen schrieb:
>
>> Daniel Pittman wrote:
>>
>>> Hints about that, or a native TeX method[1], would be very much
>>> appreciated.  At the moment it is a relatively slow process of manual
>>> trial and error.
>>>  
>>>
>> this is something tex is pretty good at and it runs as fast as normal
>>
>> how does your current code look? (the solution depends a bit it); 
>> think of something
>>
>> \doloop{
>>  \setbox\scratchbox=\vbox
>>     {the content of the label}
>>   \ifx\ht\scratchbox>10cm
>>       \switchtobodyfont[small]   \else
>>       \unvbox\scratchbox
>>       \exitloop
>>   \fi
>> }
>>
>> Hans
>> _______________________________________________
>> ntg-context mailing list
>> ntg-context@ntg.nl
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

  reply	other threads:[~2005-12-02 15:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-02  1:14 Daniel Pittman
2005-12-02 14:02 ` Hans Hagen
2005-12-02 15:18   ` Wolfgang Zillig
2005-12-02 15:30     ` Hans Hagen [this message]
2005-12-03 10:10   ` Daniel Pittman
2005-12-04  9:40   ` Gerben Wierda
2005-12-04 20:46     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43906878.6090908@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).