Hi Somesh,
You can use the length of the text to determine the size of the font.
Take a look at an example:

In this example, if the expression has a length below 20, the font-size will be 16px, otherwise it will be 12px.
You can adapt to the values of your use case.
Hope it helps.
Cheers,
João