Example usage for java.text AttributedCharacterIterator getBeginIndex

List of usage examples for java.text AttributedCharacterIterator getBeginIndex

Introduction

In this page you can find the example usage for java.text AttributedCharacterIterator getBeginIndex.

Prototype

public int getBeginIndex();

Source Link

Document

Returns the start index of the text.

Usage

From source file:org.apache.fop.svg.ACIUtils.java

/**
 * Dumps the contents of an ACI to System.out. Used for debugging only.
 * @param aci the ACI to dump//from   ww w. j  a  v a2  s  . c  o  m
 */
public static void dumpAttrs(AttributedCharacterIterator aci) {
    aci.first();
    Set<Entry<Attribute, Object>> entries = aci.getAttributes().entrySet();
    for (Map.Entry<Attribute, Object> entry : entries) {
        if (entry.getValue() != null) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }
    }
    int start = aci.getBeginIndex();
    System.out.print("AttrRuns: ");
    while (aci.current() != CharacterIterator.DONE) {
        int end = aci.getRunLimit();
        System.out.print("" + (end - start) + ", ");
        aci.setIndex(end);
        if (start == end) {
            break;
        }
        start = end;
    }
    System.out.println("");
}

From source file:org.apache.fop.svg.NativeTextPainter.java

/**
 * @param runaci an attributed character iterator
 * @param layout a text span layout//from w  w  w  .j av a2s  .c  om
 */
protected final void logTextRun(AttributedCharacterIterator runaci, TextSpanLayout layout) {
    if (log.isTraceEnabled()) {
        int charCount = runaci.getEndIndex() - runaci.getBeginIndex();
        log.trace("================================================");
        log.trace("New text run:");
        log.trace("char count: " + charCount);
        log.trace("range: " + runaci.getBeginIndex() + " - " + runaci.getEndIndex());
        log.trace("glyph count: " + layout.getGlyphCount()); //=getNumGlyphs()
    }
}