----- Original Message ----- 
From: "Olivier Lefevre" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, August 25, 2007 8:57 PM
Subject: Re: [iText-questions] Helvetica vs. Arial


> Paulo Soares wrote:
>> Did you registered the font?
>
> Yes. Let's take an example. If I do:
>
>   String fontsDir = "c:\\WINDOWS\\Fonts";
>   FontFactory.getFontImp().registerDirectory(fontsDir);
>   DefaultFontMapper fm = new DefaultFontMapper();
>   fm.insertDirectory(fontsDir);
>   BaseFont f1 = FontFactory.getFont("Arial", 12, 
> com.lowagie.text.Font.BOLD).getBaseFont();
>   BaseFont f2 = fm.awtToPdf(new java.awt.Font("Arial", java.awt.Font.BOLD, 
> 12);
>   System.out.println(f1.equals(f2));
>
> (I assume the iText Graphics2D object will call awt2Pdf under the cover)
> I can clearly see that they are not the same font. The book is vague
> on this IMO: the font chapters were not written with Java2D in mind
> and it's not clear how to get the font you want when using iText
> through Java2D.

The font chapters were written with PDF in mind, not with AWT in mind. In 
any case your code works for me. Just call:

System.out.println(f1.getPostscriptFontName() + "," + 
f2.getPostscriptFontName());

to see that the fonts are the same.

Paulo 


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

Reply via email to