if (lineThrough || textDecoration == "underline")
{
// FTE doesn't render strikethroughs or underlines,
// but it can tell us where to draw them.
// You can't draw in a TextLine but it can have children,
// so we create a child Shape to draw them in.
var elementFormat:ElementFormat =
TextElement(textBlock.content).elementFormat;
var fontMetrics:FontMetrics;
if (embeddedFontContext)
fontMetrics = embeddedFontContext.callInContext(elementFormat.getFontMetrics, elementFormat, null);
else
fontMetrics = elementFormat.getFontMetrics();
var shape:Shape = new Shape();
var g:Graphics = shape.graphics;
if (lineThrough)
{
g.lineStyle(fontMetrics.strikethroughThickness,
elementFormat.color, elementFormat.alpha);
g.moveTo(0, fontMetrics.strikethroughOffset);
g.lineTo(textLine.textWidth, fontMetrics.strikethroughOffset);
}
if (textDecoration == "underline")
{
g.lineStyle(fontMetrics.underlineThickness,
elementFormat.color, elementFormat.alpha);
g.moveTo(0, fontMetrics.underlineOffset);
g.lineTo(textLine.textWidth, fontMetrics.underlineOffset);
}
textLine.addChild(shape);
}
{
// FTE doesn't render strikethroughs or underlines,
// but it can tell us where to draw them.
// You can't draw in a TextLine but it can have children,
// so we create a child Shape to draw them in.
var elementFormat:ElementFormat =
TextElement(textBlock.content).elementFormat;
var fontMetrics:FontMetrics;
if (embeddedFontContext)
fontMetrics = embeddedFontContext.callInContext(elementFormat.getFontMetrics, elementFormat, null);
else
fontMetrics = elementFormat.getFontMetrics();
var shape:Shape = new Shape();
var g:Graphics = shape.graphics;
if (lineThrough)
{
g.lineStyle(fontMetrics.strikethroughThickness,
elementFormat.color, elementFormat.alpha);
g.moveTo(0, fontMetrics.strikethroughOffset);
g.lineTo(textLine.textWidth, fontMetrics.strikethroughOffset);
}
if (textDecoration == "underline")
{
g.lineStyle(fontMetrics.underlineThickness,
elementFormat.color, elementFormat.alpha);
g.moveTo(0, fontMetrics.underlineOffset);
g.lineTo(textLine.textWidth, fontMetrics.underlineOffset);
}
textLine.addChild(shape);
}