public int getCharOffsetXElem ( int pos ) { if ( text != null ) { FontMetrics fm = g . getFontMetrics ( ) ; if ( pos <= textStart ) return 0 ; else if ( pos > textStart && pos < textEnd ) return stringWidth ( fm , text . substring ( textStart , pos ) ) ; else return stringWidth ( fm , text . substring ( textStart , textEnd ) ) ; } else return 0 ; }
Computes the X pixel offset of the given character of the box text . The character position is specified within the whole source text node .