@ Override public int getSize ( Paint paint , CharSequence text , int start , int end , Paint . FontMetricsInt fontMetrics ) { updateBounds ( ) ; if ( fontMetrics == null ) { return mWidth ; } int offsetAbove = getOffsetAboveBaseline ( fontMetrics ) ; int offsetBelow = mHeight + offsetAbove ; if ( offsetAbove < fontMetrics . ascent ) { fontMetrics . ascent = offsetAbove ; } if ( offsetAbove < fontMetrics . top ) { fontMetrics . top = offsetAbove ; } if ( offsetBelow > fontMetrics . descent ) { fontMetrics . descent = offsetBelow ; } if ( offsetBelow > fontMetrics . bottom ) { fontMetrics . bottom = offsetBelow ; } return mWidth ; }
Returns the width of the image span and increases the height if font metrics are available .