FTE's textLine.textWidth value does not change if text ends with SPACE character
Hi all FTE users,
Here is a simplest code sample to create a single FTE textLine filled with a SAMPLE_TEXT const content
package {
import flash.display.Sprite;
import flash.text.engine.TextBlock;
import flash.text.engine.TextElement;
import flash.text.engine.TextLine;
import flash.text.engine.ElementFormat;
public class FTETextLineExample extends Sprite {
private const SAMPLE_TEXT:String = "Sample";
public function FTETextLineExample():void {
var format:ElementFormat = new ElementFormat(null, 12, 0xCC0000);
var textElement:TextElement = new TextElement(SAMPLE_TEXT, format);
var textBlock:TextBlock = new TextBlock();
textBlock.content = textElement;
createLine(textBlock);
}
private function createLine(textBlock:TextBlock):void {
var yPos:Number = 20;
var textLine:TextLine = textBlock.createTextLine (null, 1000);
textLine.x = 15;
yPos += textLine.textHeight + 2;
textLine.y = yPos;
addChild(textLine);
trace ("textLine.textWidth=", textLine.textWidth);
}
}
}
In my testing, trace ("textLine.textWidth=", textLine.textWidth) outputs 35 for the textLine.textWidth value, which is fine.
But whenever I add a few spaces at the end of the SAMPLE_TEXT string, e.g
private const SAMPLE_TEXT:String = "Sample ";
and run the test code, textLine.textWidth will continue to output the same 35 value.
Why is that?
The string is getting larger by the char count, but textLine.textWidth is not changing.
