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

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

问题描述

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

Is there a way to read Open Type fonts in Java the same way as I do with TrueType fonts?

这对 TTF 非常有效,但我还没有弄清楚如何对 Open Type 字体做同样的事情.

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.

推荐答案

我认为 java 中没有 Open Type Font 支持(至少不是免费的),iText 声称有这种支持,几个月前尝试过它没有用,对我有用的是一个名为 FontForge 的程序,我曾经用它从我使用的 otf 创建一个 ttf.

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 中使用 Open Type 字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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