views:

1326

answers:

2

Is there a way to read Open Type Fonts in Java the same way as i do it with TrueType Fonts ?

This works perfectly for TTF but i did not figure out yet how to do the same with Open Type Fonts.

Font f = Font.createFont( Font.TRUETYPE_FONT,
new FileInputStream("f.ttf") );

Please note i cannot relay on installed fonts. I provide the font with my program but don't want to install it systemwide.

+1  A: 

I don't think there is Open Type Font support in java (not free atleast), iText claimed to have such support, tried it a few month ago and it didn't work, what worked for me is a program called FontForge which I used to create a ttf from the otf which I then used.

MahdeTo
+2  A: 

Java OpenType font support depends on your OS and JDK version.

Prior to Java 6, you can only use TrueType flavored OpenType fonts. With Java 6 you can use all OpenType fonts but you won't benefit from advanced typographic features like ligatures.

Altherac