简体   繁体   English

Java中的字体字形突破

[英]Font glyph fallthrough in Java

Does anyone know of an existing solution for font glyph fallthrough in Java? 有没有人知道Java中字体字形的现有解决方案? For example, our designers have decided that Calibri is the font that mostly fits our needs, but if I specify Calibri, it can naturally not render characters that do not have a matching glyph in that font. 例如,我们的设计师已经确定Calibri是最符合我们需求的字体,但是如果我指定Calibri,它自然不能渲染那些字体中没有匹配字形的字符。 In that case, I would need it to fall through to a second specified font, and if all else fails - use one of Java's logical fonts. 在这种情况下,我需要它到第二个指定的字体,如果所有其他都失败 - 使用Java的逻辑字体之一。

Has anyone come up with a solution for this, which can be plugged into existing Swing components without having to write custom Swing components for the entire project? 有没有人想出一个解决方案,可以插入现有的Swing组件,而无需为整个项目编写自定义Swing组件?

This is a very old project already, and building custom graphical components is not a feasible solution. 这是一个非常古老的项目,构建自定义图形组件不是一个可行的解决方案。

This isn't a code-based solution and probably won't be of much help, since it requires each user to install a file locally, but just in case... 这不是一个基于代码的解决方案,可能没有多大帮助,因为它要求每个用户在本地安装一个文件,但以防万一......

You can add fallback fonts in a special directory within the JRE installation. 您可以在JRE安装中的特殊目录中添加后备字体。 From the Java documentation : Java文档

Users can add a physical font as a fallback font to logical fonts used in Java 2D rendering by installing it in the lib/fonts/fallback directory within the JRE. 用户可以将物理字体作为后备字体添加到Java 2D渲染中使用的逻辑字体,方法是将其安装在JRE中的lib/fonts/fallback目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM