如果您可以访问 Flash 10,请查看新的 文本引擎类,尤其是 TextLine.I'm learning ActionScript/Flash. I love to play with text, and have done a lot of that kind of thing with the superb Java2D API.One of the things I like to know is "where, exactly, are you drawing that glyph?" The TextField class provides the methods getBounds and getCharBoundaries, but these methods return rectangles that extend far beyond the actual bounds of the whole text object or the individual character, respectively.var b:Sprite = new Sprite();b.graphics.lineStyle(1,0xFF0000);var r:Rectangle = text.getCharBoundaries(4);r.offset(text.x, text.y);b.graphics.drawRect(r.x,r.y,r.width,r.height);addChild(b);b = new Sprite();b.graphics.lineStyle(1,0x00FF00);r = text.getBounds(this);b.graphics.drawRect(r.x,r.y,r.width,r.height);addChild(b);Is there any way to get more precise information about the actual visual bounds of text glyphs in ActionScript? 解决方案 Not reasonably possible in Flash 9 -- Richard's answer is a clever work-around, though probably completely unsuitable for production code (as he mentions) :)If you have access to Flash 10, check out the new text engine classes, particularly TextLine. 这篇关于有没有办法在 ActionScript 中获取字形的实际边界框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!