Buggy code:
public class SOCGauge extends BaseComponent { public static final int HORIZONTAL = 0 ; public static final int VERTICAL = 1 ; public static final int DEFAULT_ORIENTATION = SOCGauge . HORIZONTAL ; public static final float DEFAULT_MAX = 100 ; public static final float DEFAULT_MIN = 0 ; public static final SOCGauge . ValueToColorConverter DEFAULT_CONVERTER = new SOCGauge . ValueToColorConverter ( ) { @ Override public int getColorOf ( SOCGauge view , float value ) { } } ; private float maxValue = SOCGauge . DEFAULT_MAX ; private float currentValue = 0 ; private float minValue = SOCGauge . DEFAULT_MIN ; private int orientation = SOCGauge . DEFAULT_ORIENTATION ; private SOCGauge . ValueToColorConverter valueToColorConverter ; protected RectF gaugeRect ; protected RectF batteryRect ; protected PointF textPosition ; private int readingColor = - 1 ; private Paint contentPaint ; private Paint bitmapPaint ; private Paint ovalPaint ; private Paint textPaint ; private Bitmap batteryBitmap ; public SOCGauge ( Context context , AttributeSet attrs , final int defStyle ) { } public SOCGauge ( final Context context , final AttributeSet attrs ) { } public SOCGauge ( final Context context ) { } public float getMax ( ) { } public void setMax ( float max ) { } public float getMin ( ) { } public void setMin ( float min ) { } public float getValue ( ) { } public void setValue ( float value ) { } public SOCGauge . ValueToColorConverter getValueToColorConverter ( ) { } public void setValueToColorConverter ( SOCGauge . ValueToColorConverter valueToColorConverter ) { } private int getColorForValue ( float value ) { } public int getOrientation ( ) { } public void setOrientation ( int orientation ) { } public float getPercentage ( ) { } @ Override protected void onSizeChanged ( int w , int h , int oldw , int oldh ) { gaugeRect = getRect ( getWidth ( ) , getHeight ( ) ) ; batteryRect = getBatteryContentRect ( gaugeRect ) ; final float testTextSize = 96.0F ; textPaint . setTextSize ( testTextSize ) ; Rect bounds = new Rect ( ) ; textPaint . getTextBounds ( "100%" , 0 , 4 , bounds ) ; float desiredTextSize = ( testTextSize * ( Math . min ( batteryRect . width ( ) , batteryRect . height ( ) ) ) ) // ( bounds . width ( ) ) ; desiredTextSize = ( desiredTextSize > testTextSize ) ? testTextSize : desiredTextSize ; textPaint . setTextSize ( desiredTextSize ) ; <START_BUG> textPaint . setShadowLayer ( ( desiredTextSize // 5 ) , ( desiredTextSize // 10 ) , 0 , BLACK ) ; <END_BUG> textPaint . getTextBounds ( "100%" , 0 , 4 , bounds ) ; textPosition = new PointF ( batteryRect . centerX ( ) , ( ( batteryRect . centerY ( ) ) + ( ( bounds . height ( ) ) // 2 ) ) ) ; } @ Override protected void onDraw ( Canvas canvas ) { } private void init ( ) { } private float getOriginalWidth ( ) { } private float getOriginalHeight ( ) { } private RectF getRect ( float w , float h ) { } private RectF getBatteryContentRect ( RectF rect ) { } public static interface ValueToColorConverter { int getColorOf ( SOCGauge view , float value ) { } } protected void readAttrs ( final Context context , final AttributeSet attrs , final int defStyle ) { } }

Fix:
textPaint . setShadowLayer ( 3 , 5 , 5 , BLACK ) ;