最后一个字符的文本字段的autoSize +斜体削减 [英] TextField autoSize+italics cuts of last character

查看:94
本文介绍了最后一个字符的文本字段的autoSize +斜体削减的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ActionScript 3中,我的文本字段有:

In actionscript 3, my TextField has :

  • 在CSS样式
  • 嵌入字体
  • 设置textAlign:中心
  • 的autoSize:中心

...当使用斜体非常正确的字符被稍稍切去(特别是盖)。 它基本上看来,它没有检测到合适的尺寸。

... when italics are used the very right character gets slightly cut off (specially caps). It basically seems that it fails detecting the right size.

我以前有这个问题,但只是想知道有没有一个很好的解决方法(而不是检查输出textWidth 或偏移文本等)?

I've had this problem before but just wondered is there a nice workaround (instead of checking textWidth or offsetting text etc.)?

推荐答案

初始化你的 textField的为你总是这样,采用多线,自动调整,的htmlText ...

Initialize your textField as you always do, using multiline, autosize, htmlText...

然后做这个小动作:

// saving wanted width and height plus 1px to get some space for last char
var savedWidth = myTextField.width + 1;
var savedHeight = myTextField.height + 1;

// removing autoSize, wich is the origin of the problem i think                 
myTextField.autoSize = "none";      

// now manually autoSizing the textField with saved values          
myTextField.width = savedWidth;
myTextField.height = savedHeight;

这篇关于最后一个字符的文本字段的autoSize +斜体削减的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆