How do i scale font size to fit different screens sizes !?

Hello again, I really want help because I am tired of many failed attempts. I simply finished the design of my application, but I have been standing for a long time at this point. I want the font size of my application to match the sizes of different screens. What I specifically want is that the font size on different screens represent the same percentage that It is represented on my mobile screen. I want this to be done through an equation and with the same font sizes that i have specified on my mobile screen. Please, I need help. I have been sitting for a long time with this dilemma.

I think the solution is located here in DisplayMetrics extension but i do not know how to apply it ?

I tried to determine the percentage of each font size that I have on my mobile screen and then represent that percentage on the rest of the different screens, but it did not work


Did you find a solution? I am having the same problem looks good on a tablet but on a phone the fint is huge.

Would like to be able to automatically size depending on the screen size.