Forum How do I...?

How do I stretch a text (font) by a certain percentage?

massifr
I need to stretch some text and I'd need to stretch it by a certain percentage (90%, for example).

I think the font-stretch property works looking for a font variant representing the same font family at a different stretch.

What I need is not to select a font variant, but to scale the text horizontally. In PDF it is simple, since it means composing the CTM (current transformation matrix) with the one representing the x-scaling.
But how do I tell prince to do that in terms of CSS?
mikeday
CSS has no mechanism for arbitrarily scaling text horizontally, you need to select a condensed font with the font-stretch property, or use SVG, which allows you to apply any transformation matrix to text or shapes.
massifr
Are you going to implement it as a non-standard CSS property (using a different name)?

It's quite a common feature in DTP, like pseudo-italic (skewing), pseudo-bold (with glyph borders).

It would not be the first one, you had to introduce other non-standard properties and functions (cmyk() or hyphenation related ones) for other purposes.

The SVG solution is not feasible, since I need a stretched font for normal text, not for a single line, like a title. Only a small bunch of fonts have variants at different stretches (Helvetica has them, Garamond has not, as far as I know).

Anyway thanks for the clarification.
mikeday
Prince 7.0 will support pseudo-italic and pseudo-bold when real font variants are not available. It might make sense to add pseudo-stretch as well when real condensed or expanded fonts are not available, but this feature will need to wait for a future release. (Note that in most cases a real font will look better than a synthesized one).
jim_albright
Would adding inter word space or tracking accomplish what you want?

Jim Albright
Wycliffe Bible Translators

massifr
jim_albright wrote:
Would adding inter word space or tracking accomplish what you want?


No, it would not, because I need to make the font a 30% narrower (it's the stretch amount of a condensed font, which is about 75% of its regular version); it's too much for a word space/tracking solution: glyphs would overlap.
jim_albright
I totally understand why tracking wouldn't work. Can you use a smaller font size? Probably not.

Jim Albright
Wycliffe Bible Translators

massifr
I am working on a rotated index of terms. If you don't know what it is, here's an example:

http://www.sti.nasa.gov/98Thesaurus/vol2.pdf

The NASA index is in two columns. My terms are a bit longer than the NASA ones, so stretching the font would be a way to reduce the number of terms split in two lines.

Without stretching, the solutions are:
- pass to a one-column format, nearly doubling the index length in pages and getting pages with a lot of blank space
- reduce the font size, as you prompted, but reducing readability too
jim_albright
So will humans actually print this out?

If it is online shouldn't you hotlink term?

If not printed then the number of pages is not an issue.

Jim Albright
Wycliffe Bible Translators