gpt4 book ai didi

flash - AS3 TextField 设置文本的上边距,因为一些字符被剪掉了

转载 作者:行者123 更新时间:2023-12-04 21:49:17 26 4
gpt4 key购买 nike

我想弄清楚为什么有些字母(如挪威语 Å (​​Å))在顶部“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;

所以,我尝试了不同的事情,比如设置硬编码的高度和大于文本的高度,但是我们又被削减了,我已经尝试过使用 css 但没有成功。任何人都知道为什么这封信没有完全显示,以及为什么如果我放大 swf(2-3 放大)它会像这样显示正常(以及我试图实现的目标):



我认为这与 topMargin 有关,但不幸的是我在 as3 文档中没有找到类似的东西。

最佳答案

不确定这是否有帮助,但我使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com