Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class TypefaceSpan extends MetricAffectingSpan {
  2.  
  3.   private Typeface mTypeface;
  4.   private float textSize;
  5.   private int textColor;
  6.  
  7.   public TypefaceSpan(Context context, Typeface typeface, float textSize, int color) {
  8.       this.textSize = textSize;
  9.       this.textColor = color;
  10.       this.mTypeface = typeface;
  11.   }
  12.  
  13.   @Override
  14.   public void updateMeasureState(TextPaint p) {
  15.       p.setTypeface(mTypeface);
  16.       p.setTextSize(textSize);
  17.       p.setColor(textColor);
  18.       p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
  19.   }
  20.  
  21.   @Override
  22.   public void updateDrawState(TextPaint p) {
  23.       p.setTypeface(mTypeface);
  24.       p.setTextSize(textSize);
  25.       p.setColor(textColor);
  26.       p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
  27.   }
  28. }