在我的ActionScript 3项目中,我使用了嵌入字体设置为true和isHTML设置为true的TextField。当我显示拉丁字符时,一切正常。
但是当我想要显示日语字符时,它们不会出现。实际上它应该是这样的,因为没有嵌入日文字体。
如果嵌入式字体没有某些字符的字形,有没有办法退回到系统字体?
发布于 2014-05-06 00:28:36
尝试在Font实例上使用hasGlyphs("...");。我在使用它时遇到了一些问题,但总的来说它工作得很好,希望它也适用于日语。然后,如果没有日语字形,则可以简单地使用_sans。
编辑:我现在没有办法测试它,但我假设这样的东西会起作用:
import flash.text.Font;
var myFont:Font = new MyFont(); // Embedded font in library, linkage set to 'MyFont'
if(myFont.hasGlyphs("Hello!")) {
field.embedFonts = true; // Not sure whether this is necessary in case of HTML text
field.htmlText = "<p><font color='#ff0000' face='" + myFont.fontName + "'>Hello!</font></p>";
}
else {
field.embedFonts = false;
field.htmlText = "<p><font color='#ff0000' face='_sans'>Hello!</font></p>";
}https://stackoverflow.com/questions/23477223
复制相似问题