Andrius Juozapaitis wrote:
> Leonard,
>
> Sorry, I considered the testcase was enough to prove my point.
Did you look at the Fonts used in your PDF? There's only one font
present. This should ring a bell; you'd know that you were using
a technique for creating a bold font that works, but is certainly
not recommended. Perhaps you didn't read the book yet.
If you had, you'd know that Arial is not a font, but a font family
containing a series of different fonts: normal, bold, italic,
bolditalic,...
You have discovered that this works:
BaseFont f = BaseFont.createFont("c:/windows/fonts/arial.ttf",
BaseFont.CP1257, BaseFont.EMBEDDED);
Font font = new Font(f, 8);
Font boldFont = new Font(f, 8, Font.BOLD);
But you've also discovered the limitations: if you only use that
one font arial.ttf, you can't predict what the text will look like
on the end users machine. (I'm using a recent version of Adobe
Reader and maybe I'm a perfectionist, but I really don't like the
quality of the bold font.)
If I were you, I wouldn't use the above amateurish way of
creating a font, but follow the advice given in the book,
and do it like this:
BaseFont f = BaseFont.createFont("c:/windows/fonts/arial.ttf",
BaseFont.CP1257, BaseFont.EMBEDDED);
Font font = new Font(f, 8);
BaseFont fb = BaseFont.createFont("c:/windows/fonts/arialbd.ttf",
BaseFont.CP1257, BaseFont.EMBEDDED);
Font boldFont = new Font(bf, 8, Font.BOLD);
Now when you'll look inside your PDF, you'll discover that two
different fonts are present; and you won't have undesired side effects.
Don't underestimate the power of reading the (right) documentation!!!
(By "right" documentation, I mean: "iText in Action")
--
This answer is provided by 1T3XT BVBA
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar