private void paintTextRun(TextRun textRun, Graphics2D g2d,
GraphicsNodeRenderContext context) {
AttributedCharacterIterator runaci = textRun.getACI();
TextSpanLayout layout = textRun.getLayout();
runaci.first();
Composite opacity = (Composite)
runaci.getAttribute(GVTAttributedCharacterIterator.
TextAttribute.OPACITY);
if (opacity != null) {
g2d.setComposite(opacity);
}
boolean underline =
(runaci.getAttribute(GVTAttributedCharacterIterator.
TextAttribute.UNDERLINE) != null);
// paint over-and-underlines first, then layer glyphs over them
if (underline && !layout.isVertical()) {
paintUnderline(textRun, g2d);
}
boolean overline =
(runaci.getAttribute(GVTAttributedCharacterIterator.
TextAttribute.OVERLINE) != null);
if (overline && !layout.isVertical()) {
paintOverline(textRun, g2d);
}
layout.draw(g2d, context);
boolean strikethrough =
(runaci.getAttribute(GVTAttributedCharacterIterator.
TextAttribute.STRIKETHROUGH) ==
GVTAttributedCharacterIterator.
TextAttribute.STRIKETHROUGH_ON);
// paint strikethrough last
if (strikethrough && !layout.isVertical()) {
paintStrikethrough(textRun, g2d);
}
}