There is one wrong assumption and an error in your code. You assume that 
times.ttf has the character and it may not have (if it's the same file as in 
Windows it doesn't have, try arialuni.ttf instead). The code error is in 
FontFactory.getFont("times") that defaults to the Winansi encoding which won't 
work even if the character exists in the font file. Use the encoding Identity-H 
instead.

Paulo

> -----Original Message-----
> From: Richard Thomas [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 19, 2008 7:22 PM
> To: [email protected]
> Subject: [iText-questions] Output special character - won't appear
> 
> Hi
> 
> I am trying to use iText to output a document containing the "LATIN
> SMALL LETTER OPEN O" character described here:
> http://www.fileformat.info/info/unicode/char/0254/index.htm
> 
> Every time I try and output this character, I get a blank where I
> would expect to see it. I have tried with different fonts, including
> those that I have confirmed contain the character I would like to
> print.
> 
> Here is the Java I am using on Ubuntu:
> 
>               Document document = new Document();
>               try {
>                       PdfWriter.getInstance(document, new 
> FileOutputStream("/home/rich/test.pdf"));
>                       document.open();
>                       Phrase instance = 
> Phrase.getInstance("Test: \u0254");
>                       
> FontFactory.register("times","/usr/share/fonts/truetype/msttco
> refonts/times.ttf");
>                       Font font = FontFactory.getFont("times");
>                       instance.setFont(font);
>                       document.add(instance);
>               } catch (DocumentException de) {
>                       System.err.println(de.getMessage());
>               } catch (IOException ioe) {
>                       System.err.println(ioe.getMessage());
>               }
>               document.close();
> 
> The test.pdf file gets created, but only contains "Test:". I have
> tried opening the same file on Vista, and get the same result.
> 
> Does anyone have any ideas what I might be doing incorrectly?
> 
> Thanks in advance for any help!
> 
> Rich


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.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to