List of usage examples for java.text AttributedCharacterIterator getRunStart
public int getRunStart();
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfGraphics2D.java
/** * @see Graphics2D#drawString(AttributedCharacterIterator, float, float) *///from w w w . ja v a 2s . com @Override public void drawString(final AttributedCharacterIterator iter, float x, final float y) { /* * StringBuffer sb = new StringBuffer(); for(char c = iter.first(); c != AttributedCharacterIterator.DONE; c = * iter.next()) { sb.append(c); } drawString(sb.toString(),x,y); */ final StringBuilder stringbuffer = new StringBuilder(iter.getEndIndex()); for (char c = iter.first(); c != AttributedCharacterIterator.DONE; c = iter.next()) { if (iter.getIndex() == iter.getRunStart()) { if (stringbuffer.length() > 0) { drawString(stringbuffer.toString(), x, y); final FontMetrics fontmetrics = getFontMetrics(); x = (float) (x + fontmetrics.getStringBounds(stringbuffer.toString(), this).getWidth()); stringbuffer.delete(0, stringbuffer.length()); } doAttributes(iter); } stringbuffer.append(c); } drawString(stringbuffer.toString(), x, y); underline = false; }