protected int calculateLineWidthAndFontHeight(Paint.FontMetricsInt fontMetrics) {
    int offsetAbove = getOffsetAboveBaseline(fontMetrics.ascent, fontMetrics.descent);
    int offsetBelow = mHeight + offsetAbove;

    if (mAlignment == ALIGN_CENTER) {
      offsetAbove -= mMargin.top;
      offsetBelow += mMargin.bottom;
    } else {
      offsetAbove -= mMargin.top;
    }

    updateFontHeight(fontMetrics, offsetAbove, offsetBelow);

    return mWidth;
  }
Returns the width of the image span and increases the height if font metrics are available.
fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java