Hi
first of all, this page on your site seems not working:
http://itext.sourceforge.net/tutorial/objects/fonts/index.html#type1
As always I'm writing code to generate either rtf either pdf:
starting from a java.awt.Font I produce
a com.lowagie.text.Font fot PDF generation and
a com.lowagie.text.rtf.style.RtfFont for RTF generation.
In first case, PDF, the code is:
...
java.awt.Font myAwtFont = ...;
DefaultFontMapper defaultFontMapper = new DefaultFontMapper();
BaseFont pdfFont = defaultFontMapper.awtToPdf(myAwtFont);
Font f = new Font(pdfFont);
// I set manually the size, in fact awtToPdf method seems to not consider the
size
f.setSize(myAwtFont.getSize());
simpleParagraph = new Paragraph("Ah yeah", f);
...
In second case the code is:
...
java.awt.Font myAwtFont = ...;
int fontStyle = 0;
switch (myAwtFont.getStyle()) {
case 0:
fontStyle = Font.NORMAL;
break;
case 1:
fontStyle = Font.BOLD;
break;
case 2:
fontStyle = Font.ITALIC;
break;
case 3:
fontStyle = Font.BOLDITALIC;
break;
}
RtfFont rtfFont = new RtfFont(myAwtFont.getFontName(), myAwtFont.getSize(),
fontStyle);
simpleParagraph = new Paragraph("Ah yeah", rtfFont);
...
I tried with Courier New and Times New Roman
With RTF ALL IS OK, while with PDF all the fonts are treated as they were Arial
Font.
What could I try?
Thank you very much,
best regards.
Raffaele
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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/