Click here to Skip to main content
16,016,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My app UI scales great between different screen resolutions except for the font sizes which don't scale at all. So for example, when I set the font size that looks correct at 768x1366 and display the app at 1080x1920 the UI rescales but all the text ends up small. The same effect applies to devices such as the Windows Phone 8. I've tried using Theme font size values and changed to Segoe UI font but there's no difference. I could write an iValueConverter to change the fontsize based on display resolution but that would be a clumsy method for doing something that surely should be taken care of by the framework?

Has anyone an answer as to how font scaling can be controlled?
Posted
Updated 29-Nov-14 4:56am
v2

1 solution

Here's an imperfect solution I'm using at the moment:

For the moment I've resorted to an iValueConverter for the FontSize that uses the following logic:

(FontSize that looks Ok at 1366x768 resolution) / (Screen Height at 1366x768 resolution) x (Screen Height at Runtime) => var newFontSize = (int)Math.Round((oldFontSize / 768.0) * screenHeight, 0);

I'm using VS with the design view resolution or 1366x768. Running the App on my Laptop at 1920x1080 resolution the fonts where fine using the iValueConverter to enlarge them. Today, I found that on testing the app on a friends PC with a resolution somewhere between 1366x768 and 1920x1080 the fonts where much too large. So it seems, either my logic needs to be more complicated to take account of different scaling at other display resolutions or the iValueConverter approach is not the correct one!

Has anyone got a better solution?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900