问题描述
哇,这个真的很奇怪.
我有以下设置:
舞台上的两个文本字段,均嵌入了普通 Arial 和 Arial 粗体.然后我有另一个文本字段,我像这样设置:
Two textfields on the stage with Arial normal and Arial bold, both embedded. I then have another textfield which I am setting like so:
tb.htmlText = "Test <b>Test</b>";
出于某种原因,粗体文本未显示为粗体,而是显示为常规粗细.我尝试将字体嵌入库中,使用 [Embed] 元标记,甚至诉诸使用 CSS 来强制 fontFamily.奇怪的是,我可以使用 Font.enumurateFonts 并看到两种字体都被嵌入,但是文本字段拒绝使用 < 中的粗体版本.b > 标签.
For some reason, the bold text is not displaying as bold, but as regular weight. I have tried embedding the fonts in the library, using the [Embed] meta tag and even resorted to using CSS to force the fontFamily. Weirdly, I can use Font.enumurateFonts and see both fonts are embedded, but the textfield refused to use the bold version inside the < b > tags.
有人告诉我这是 Mac 上 Flash CS4 的问题,但它可以在 PC 上运行.然而,我拒绝相信这是事实.Adobe 现在肯定会解决这个问题吗?
I've been told this is a problem with Flash CS4 on a mac and that it will work on PC. I refuse to believe this is the case, however. Surely Adobe would have fixed this by now?
任何帮助将不胜感激.
推荐答案
您必须在字体列表中使用粗体"字体(嵌入在相同或其他文本字段中):
You've gotta have the 'bold' font in the Font list ( embbed in the same or in other textfield ) :
var fonts:Array = ( Font.enumerateFonts() );
for each( var fo in fonts ){
trace ( fo.fontName ,":", fo.fontStyle )
}
我认为,如果您将字体样式返回为粗体,它可能应该可以正常工作.这是一个解决方案:
I think that if you had the fontstyle returning as bold it probably should work with no prob.Here's a solution:
var css:StyleSheet = new StyleSheet()
css.setStyle( "bold" , { fontFamily:"Myriad Pro Bold" } ) // you can catch the fontname in the list that was printed by the code above...
txtfield.styleSheet = css;
txtfield.htmlText = "regular or<bold>bold font</bold>."
这篇关于闪存 CS4 <b>用 htmlText 标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!