如何在Java中使用OpenType字体? [英] How to use Open Type Fonts in Java?

查看:190
本文介绍了如何在Java中使用OpenType字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以像使用TrueType字体一样阅读Java中的Open Type字体?



这对于TTF是完美的,但是我没有弄清楚但是如何做与Open Type字体一样的。

  Font f = Font.createFont(Font.TRUETYPE_FONT,
新的FileInputStream(f.ttf));

请注意,我无法在安装的字体上进行中继。我提供的字体与我的程序,但不希望安装系统范围。

解决方案

我不认为有在java中打开类型字体的支持(不是免费的atleast),iText声称有这样的支持,几个月前试过了,它不起作用,对我来说是一个叫做FontForge的程序,我用它来创建一个ttf otf,然后我用。$ ​​b $ b

Is there a way to read Open Type fonts in Java the same way as I do 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 system wide.

解决方案

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.

这篇关于如何在Java中使用OpenType字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆