Different things, PDF and RTF. RTF gets the font name and Word looks for
that font, by name, in your computer. In PDF, the font must be mapped by
the program. If the font is not found Helvetica is used. You must call
defaultFontMapper.insertDirectory().

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of GAMBELLI Raffaele
> Sent: Monday, January 08, 2007 4:39 PM
> To: [email protected]
> Subject: [iText-questions] Font and PDF
> 
> 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/
> 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


-------------------------------------------------------------------------
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/

Reply via email to