使用 TextLayoutFormat 将嵌入字体应用于 Spark textArea 中的特殊字符
通过将 fontfamily 直接设置为 mxml 中的 textarea,字体将应用于特殊字符。但使用 tlf 并设置 fontfamily 它不适用。
style.css ::
@font-face
{
src: URL("/Assets/Fonts/GandhariUnicode-Bold.otf");
fontFamily: "GandhariUnicode-Bold";
embedAsCFF: true;
}
源代码片段 ::
textArea.textFlow.interactionManager.selectRange(beginIndex, endIndex);
var textLayoutFormat:TextLayoutFormat = getTextLayoutFormat();
textLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF;
textLayoutFormat.fontFamily ="GandhariUnicode-Bold";
textLayoutFormat.renderingMode = RenderingMode.CFF;
By setting fontfamily directly to textarea in mxml fonts get applied to special characters. But using tlf and setting fontfamily it does not apply.
style.css ::
@font-face
{
src: URL("/Assets/Fonts/GandhariUnicode-Bold.otf");
fontFamily: "GandhariUnicode-Bold";
embedAsCFF: true;
}
snippet of source code ::
textArea.textFlow.interactionManager.selectRange(beginIndex, endIndex);
var textLayoutFormat:TextLayoutFormat = getTextLayoutFormat();
textLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF;
textLayoutFormat.fontFamily ="GandhariUnicode-Bold";
textLayoutFormat.renderingMode = RenderingMode.CFF;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过仅设置 fontFamily 就这样?还添加正常的字体粗细定义,看看有什么变化。
Have you tried just setting the fontFamily and that's it? Add the normal font weight definition as well and see what changes.
嵌入字体的行为可能会很奇怪。我看到您使用的是粗体字体,您是否尝试在嵌入字体或/和 TextLayoutFormat 对象时将字体粗细明确设置为粗体?
另外,我发现这个线程可能有用:http://forums.adobe.com/thread/ 635711
Embedded fonts can behave strangely. I see you're using a bold font, have you tried also setting explicitely font weight to bold when embedding you font or/and on the TextLayoutFormat object?
Also, I've found this thread wich migh be useful : http://forums.adobe.com/thread/635711