Am 2011-05-17 um 13:53 schrieb Hans Hagen:
On 17-5-2011 1:25, Henning Hraban Ramm wrote:
Hello again, it's been a while... ;-)
I need to pack fixed lines into a fixed width box.
Some years ago I had something similar in plain PostScript, where I pre-calculated the width of a text box, let the default font if it would fit my max size, otherwise try a narrow font and if that wasn’t enough decreased font size until it would fit.
This time I've only one font and must not decrease font size, but must use negative kerning and perhaps some artificial narrowing. How can I do that with ConTeXt? I use MkIV, so any Lua solution is welcome.
\starttext
\definefontfeature[realugly][default][extend=0.25]
\definedfont[Serif*realugly] Only You Can Read This
\stoptext
Thank you - but this is fixed narrowing. I also found stretching to a fixed width using \stretched: \hbox to 3.9cm{\stretched{Täxt wÿth ſpöciäl çhaŕàćťërs}} (You don’t need to escape Unicode chars anymore, in contrast to the docs/source.) But what I really need is some width checking like "if this line is wider than 4cm, then use stretching/narrowing". I don’t want to murder typography if the text is short enough. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)