Schalück wrote:
> Yes, it's a monospace ttf font. But on which parameters do I have to do some
> math?
> I don't want to change the font size, just enlarge the space between the
> characters.
That's explained in the book p229:
"In glyph space, 1000 units correspond with 1 unit in text space.
For instance, for a 12 pt font, 1000 units correspond with 12pt
(see figure 8.2).
The examples measures the strings 0123456789 and
abcdefghijklmnopqrstuvwxyz. The width of the string
with the numbers in glyph space is 5560. The width
in points is 5560 / 1000 x 12, or 66.72pt."
Suppose you are using BaseFont bf, then you can get
the width in Glyph space with bf.getWidth("0123456789");
whereas you get the width in pt with bf.getWidthPoint("...");
Suppose each character in your monospaced font measures
600 units in Glyph space, and you want a font size of 10pt,
then one character is 600 / 1000 x 10 = 6pt.
By default 1 inch is 72pt (unless you change the user unit),
so there are 12 glyphs in one inch.
If you want to change the width of each glyph in glyph space
(say you want only 8 glyphs in one inch), you could use the
example on page 266 to change the width of each character
to 900 (900 / 1000 x 10 = 9pt and 9 x 8 = 72).
An alternative would be to change the horizontal scaling
(for instance the way it's done on page 112), but the
downside is that you'll stretch your glyphs (depending
on the scaling factor, this could make your font look
ugly).
If you're adding text with PdfContentByte (as described
in Chapter 11), you can set the characterspacing (p347-348).
In other words: there's plenty of solutions, but it's
up to you to find out which one is best suited for your
problem.
br,
Bruno
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/