I am looking into options for setting text size for my textPaint dynamically. I would like to have setting textSize value increasing gradually until reaching screen center and decreasing gradually until screen bottom.

```
<H5>1</H5>
<H4>2</H4>
<H3>3</H3>
<H2>4</H2>
<H1>5</H1>
<H2>6</H2>
<H3>7</H3>
<H4>8</H4>
<H5>9</H5>

```

As of now, I am setting text size as the default value. I would like to have this set dynamically in my onDraw() method

is there Any method to achieve this?

**Update**: 
I tried setting the paint inside onDraw() method instead of constructor as shared below

```
Rect bounds = getBounds();
    float textX, textY;
    float pivotX, pivotY;

    Log.d("TAG", "canvas center point "+ canvas.getWidth() / 2 +", "+ canvas.getHeight() / 2);
    Log.d("TAG", "Bounds Center Point "+ bounds.centerX() + ", "+bounds.centerY());

    StaticLayout mTextLayout = new StaticLayout(text, paint, bounds.width() + 75, Layout.Alignment.ALIGN_CENTER, 1.0f, 1.0f, false);
    canvas.save();

    if (paint.getTextAlign() == Paint.Align.LEFT) {
        textX = bounds.centerX() + 50;
        textY = bounds.centerY() + 8;

    }
    else if (paint.getTextAlign() == Paint.Align.RIGHT) {
        textX = bounds.centerX() - 100;
        textY = bounds.centerY() + 10;
    }
    else
    {
        textX = bounds.centerX() + 8;
        textY = bounds.centerY() + 8;
     }

    canvas.translate( textX, textY - mTextLayout.getHeight() / 2);
    paint.setTextSize((bounds.centerY()) / 10); //Setting text size dynamically
     mTextLayout.draw(canvas);
    canvas.restore();

```