@Override
  public void draw(
      Canvas canvas,
      CharSequence text,
      int start,
      int end,
      float x,
      int top,
      int y,
      int bottom,
      Paint paint) {
    paint.getFontMetricsInt(mFontMetricsInt);
    int iconTop = getIconTop(y, mFontMetricsInt.ascent, mFontMetricsInt.descent, top, bottom);
    float iconLeft = x + mMargin.left;
    canvas.translate(iconLeft, iconTop);
    mDrawable.draw(canvas);
    canvas.translate(-iconLeft, -iconTop);
  }
A helper function to allow dropping in BetterImageSpan as a replacement to ImageSpan, and
allowing for center alignment if passed in.
fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java