for example if device size is 4 inch i need 12-dot per inch size and if size of the screen is 5 or more need 15-dot per inch size for text and how to change all text size with one method i know how to change size text.
if any idea write it
thanks in advance.
You can say small, medium and large text appearance and android will manage according to screen sizes.
Like this for medium and large
If this didn't solve your problem. Then you have to give different values for different dimensions.
Read this google documentation for managing multiple screen sizes.