AS3 TextField设置文本的上边距,因为一些字符被删除

Dan*_*iel 5 flash margin actionscript-3 textfield

我想弄清楚为什么有些字母(比如挪威语Å(Å))在顶部"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;
Run Code Online (Sandbox Code Playgroud)

所以,我尝试了不同的东西,如设置高度硬编码和大于文本,但顶部我们再次削减,我尝试用CSS但没有成功.任何人都知道为什么这封信没有完全显示,为什么我放大swf(2-3放大)它显示正常(以及我试图实现的)像这样:

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

mia*_*elf 1

不确定这是否有帮助,但我使用 Verdana 字体测试了以下完整的、独立的代码,未嵌入,并且工作正常。也许您嵌入的字体本身有问题,或者嵌入由于某种原因导致了问题?

\n\n
package  {\n\n    import flash.display.MovieClip;\n    import flash.text.*;\n\n    public class TestText extends MovieClip {\n\n        public function TestText() {\n\n            var textSize = 20;\n\n            var titleFormat:TextFormat = new TextFormat();\n            titleFormat.size = textSize;\n            titleFormat.font = "Verdana";\n            titleFormat.color = 0xFF0000;\n\n            var titleText:TextField = new TextField();\n            titleText.defaultTextFormat = titleFormat;          \n            titleText.text = "\xc3\x85bcdefg";\n            titleText.backgroundColor = 0x000000;\n            titleText.background = true;\n            addChild(titleText);\n\n            titleText.autoSize = TextFieldAutoSize.LEFT;\n            titleText.selectable = false;           \n            titleText.wordWrap = true;          \n            titleText.width = 200;    \n\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n