The appropriate font size for devices

How can I make a variable font size by changing the size of the device

Well there are a few ways to do it.

First you need to determine the size of the screen. This is one way to do it.

Then you use a function to test screen size and set your font size to a variable,

Be careful. Playing with font sizes can make things look very strange. I would not modify your fontsizes by any more than +/- 25% .