Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Use "exotic fonts" in templates

Yann

2005-06-10

Replies:

Hi,

How can I use "exotic fonts" (japanese, chinese...) in templates ?

I'd like to use the FontFactory but it doesn't seem to be possible :

template.beginText();
Font font = FontFactory.getFont("MS UI Gothic", BaseFont.IDENTITY_H,
BaseFont.EMBEDDED, 12);
// Unfortunatly impossible !
template.setFontAndSize(font , 12);
template.setTextMatrix(100, 100);
template.showText("\u304a\u3081");
template.endText();

After that I tried :

template.beginText();
BaseFont font = BaseFont.createFont("c:\\windows\\fonts\\msgothic.ttc",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
template.setFontAndSize(font, 12);
template.setTextMatrix(100, 100);
template.showText("\u304a\u3081");
template.endText();

But it throws an Exception :
Font 'c:\windows\fonts\msgothic.ttc' with 'Identity-H' is not recognized.

Is there a way to do that ?
Thanks.



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.