作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想弄清楚为什么有些字母(如挪威语 Å (Å))在顶部“o”的中间被剪掉了:
我的代码是这样的:
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
// this is embedded font, and exported for action script, declared
titleFormat.font = myFontBold.fontName;
titleFormat.bold = true;
titleFormat.color = parseInt("0x"+fontColor,16);
var titleText:TextField = new TextField();
titleText.defaultTextFormat = titleFormat;
titleText.embedFonts = true;
titleText.antiAliasType = AntiAliasType.ADVANCED;
titleText.text = "Å"+text;
addChild(titleText);
titleText.selectable = false;
titleText.wordWrap = true;
titleText.width = maskImg.width - 80;
// this should autosize to fit all text, but it doesn't the top of text
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.x = x;
titleText.y = y;
最佳答案
不确定这是否有帮助,但我使用 Verdana 字体测试了以下完整的自包含代码,未嵌入,并且工作正常。也许您嵌入的字体本身有问题,或者嵌入由于某种原因导致问题?
package {
import flash.display.MovieClip;
import flash.text.*;
public class TestText extends MovieClip {
public function TestText() {
var textSize = 20;
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
titleFormat.font = "Verdana";
titleFormat.color = 0xFF0000;
var titleText:TextField = new TextField();
titleText.defaultTextFormat = titleFormat;
titleText.text = "Åbcdefg";
titleText.backgroundColor = 0x000000;
titleText.background = true;
addChild(titleText);
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.selectable = false;
titleText.wordWrap = true;
titleText.width = 200;
}
}
}
关于flash - AS3 TextField 设置文本的上边距,因为一些字符被剪掉了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7951651/
我是一名优秀的程序员,十分优秀!