That's not the way it's done. You need something like this:

DefaultFontMapper mapper = new DefaultFontMapper();
//read all the fonts in the directory
mapper.insertDirectory("c:\\winnt\\fonts");
//change the encoding of font "MS PGothic"
DefaultFontMapper.BaseFontParameters pp = mapper.getBaseFontParameters("MS
PGothic");
if (pp != null)
    pp.encoding = BaseFont.IDENTITY_H;

Use your font names. You can get the list of registered names with
mapper.getMapper().
If you are using localized names you may need to register an alias with
mapper.putAlias().

Best Regards,
Paulo Soares

> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
> Sent: Monday, June 02, 2003 8:35
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] CJK font problem?
> 
> Hi all:
>  
>     In my program ,my code like this:
>  
>     document = new Document(new Rectangle(400,400) , 0,0,0,0);
>  
>     writer =  PdfWriter.getInstance(document,new
> FileOutputStream("C:/test.pdf"));
>     pdfContentByte = writer.getDirectContent();
>     document.open();
>     tp = pdfContentByte.createTemplate(400,400);
>     Graphics2D g2 = tp.createGraphics(400,400,new DefaultFontMapper{
>         public BaseFont awtToPdf(java.awt.Font font) {
>             return
> BaseFont.createFont("C:/WINNT/FONTS/simsun.ttc",BaseFont.IDENTITY_H,
> BaseFont.NOT_EMBEDDED);                
>         }
>     });    
>  
>     java.awt.Font awtFont = new java.awt.font("宋体
> ",java.awt.Font.BOLD,14);  // *****
>  
>     g2.setFont(awtFont);
>  
> g2.drawString(10,10,"\u53d6\u6e96\u53d7\u4fdd\u4eba\u5728\u6211\u56fd\u7ec
> f\u6d4e\u7ed3\u6784");
>  
>     When I run mark line,but there haven't any result happened ,the font
> still be plain,is it a bug? 
>     
>     Who can help me... pls
>  
>  
>  
> duke.chen


-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to