如何实现字体管理器的“安装/加载字体”功能爪哇语
我正在参与一个字体管理器 Java 项目。现在我想在其中实现“安装字体”功能。安装字体,以我的理解,就是将第三方字体复制或移动到系统目录中,例如Windows中的Windows/Fonts。
然而,当我使用正常的 Java 复制例程来完成此作业时,我收到了“访问被拒绝”异常,因为目标是系统目录。
问题是,首先,有人可以验证我对“安装字体”的理解吗?那么我们如何在Java中实现“安装字体”呢?
I am on a Font Manager Java project. Now I want to implement the "install Font" functionality in it. Installing a font, in my understanding, is to copy or move a third party font into the system directory such as Windows/Fonts in Windows.
When I used the normal Java copy routine for this job, however, I received "Access Denied" exception since the destination is a system directory.
The questions are, first, can anyone verify my understanding about "installing a font"? And how do we implement "installing a font" in Java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是平台相关的并且需要一些权限,因此 Java 不是最好的解决方案。
This is platform-dependant and requires some privileges, so Java is not the best solution.
看来你可以使用
java.awt.Font.createFont()
方法...我希望它有帮助...请参考http://download.oracle.com/javase/tutorial/2d/text/fonts.html
It seems that you can use
java.awt.Font.createFont()
methods...I hope it helps...Please refer to http://download.oracle.com/javase/tutorial/2d/text/fonts.html
在Windows上,它不仅仅是将字体复制到目录中(就像在资源管理器中执行此操作时看起来的那样),而且还调用一些注册函数来注册字体。
On Windows, it is not just copying the font into the directory (like it seems when doing this in explorer), but also calling some registration functions to register the font.
交叉发布
http://forums.oracle.com/forums/thread.jspa?threadID=2188576
数据库
Cross posted
http://forums.oracle.com/forums/thread.jspa?threadID=2188576
db