Try:

BaseFont bf = BaseFont.createFont("c:\\windows\\fonts\\myfont.ttf",
BaseFont.WINANSI, true)

and see if it throws any exception. 

> -----Original Message-----
> From: Schneider Christian S. (KBIB 21) 
> [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 08, 2005 3:30 PM
> To: Paulo Soares
> Subject: RE: [iText-questions] Font akzident_grotesk_bold.ttf
> 
> Many thanks for your email
> 
> enclosed please find a code a sample
> 
> 
> class PdfBean { 
> 
>       public static final String csFontBold =
> FontContainer.getCsFontBoldPdf();
>       .......
>       .......
>       protected static Font TITELFONT =
> FontFactory.getFont(csFontBold, 11, Font.BOLD); // look to me like it
> works well
>       ........
>       .......
>       
>       
>       protected void basicSetCell(PdfPTable table, String text, int
> alignement, Color background,
>             int border, Font font) {
> 
>         Phrase phrase = basicGetPhrase(text, font);
>         PdfPCell cell = new PdfPCell(phrase);
> 
>         if (background != null) {
>             cell.setBackgroundColor(background);
>         }
>         cell.setBorder(border);
>         if(chartFillPattern == null){
>             if(this.getBusinessUnit() != null){
>                 chartFillPattern =
> getChartFillPattern(this.getBusinessUnit());
>             }
>             else{
>                 chartFillPattern = new ChartFillPatternBW();
>             }
>         }
>         cell.setBorderColor(chartFillPattern.getBorderLineColor());
>         cell.setHorizontalAlignment(alignement);
>         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
>         table.addCell(cell);
>     }
>       //when i look to the attributes of phrase and tabel everything
> look good but on the pdf the font is wrong it takes the default font
> 
> }
>       
> 
> 
> class FontContainer { 
> 
>    private static final String AKZIDENT_GROTESK_BOLD_TTF =
> "akzident_grotesk_bold.ttf";
>    private static final String AKZIDENT_GROTESK_LIGHT_TTF =
> "akzident_grotesk_light.ttf";
>    private static String fontDirectory;       
> 
> ......
> 
>    public static String getCsFontBoldPdf() {
>         StringBuffer sb = new StringBuffer();
>         sb.append(fontDirectory + "/");
>         sb.append(AKZIDENT_GROTESK_BOLD_TTF);
>         return sb.toString();
>       }
> .......
> }
>       
> 
> class MainServlet() {
>       
> .....
> ....
> 
>   init() {
>  
> FontContainer.setFontDirectory(this.getServletContext().getRea
> lPath("/WE
> B-INF/fonts"));
>   }
> ......
> }
> 
> 
> Appreciate your feedback. 
> 
> Thanks 
> 
> Christian
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paulo
> Soares
> Sent: Tuesday, November 08, 2005 4:00 PM
> To: Schneider Christian S. (KBIB 21);
> [email protected]
> Subject: RE: [iText-questions] Font akzident_grotesk_bold.ttf
> 
> It works. I would like to see some code with all the paths and font
> names, the variables tell me nothing.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of Schneider Christian S. (KBIB 21)
> > Sent: Tuesday, November 08, 2005 1:44 PM
> > To: [email protected]
> > Subject: [iText-questions] Font akzident_grotesk_bold.ttf
> > 
> > Hi, 
> > 
> > I'm loading  two TTF  Fonts Akzidenz grotesk light and bold 
> > to generate a Pdf with i tex. 
> > Loading the Fonts works well but altough i do it all the same 
> > it converts only the light Font. 
> > The Bold text get displayd in arial bold and not as akzidenz bold. 
> > 
> > protected static Font HINTFONTBOLD = new 
> > Font(corporateFontBold, 9); works well 
> > protected static Font HEADERFONT1 = 
> > FontFactory.getFont(corporateFont, 12); dosn't work 
> > 
> > corporateFont is the path variable. 
> > 
> > Is the bold Font from Akzidenz not suported by itext or does 
> > somebody have an idea what could go wrong ? 
> > 
> > Appreciate your feedback. 
> > 
> > Thanks 
> > Christian 
> > 
> > 
> > 
> > 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to