-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font size doesn't seem to scale well when specifying as a percentage. #75
Comments
@LukasZvikas the idea of using percentages is to have the same percentage for all the devices. Otherwise it doesn't make sense; just go use DP. If you can't make a specific percentage to work properly, then it probably means that the rest of your app is not as responsive. In this case set your break points as you have done above and use DP. |
@marudy I was going to create an issue for what I'm experiencing but this seems like a relevant issue to add it to (please let me know if you'd like me create a new one). It may be I'm just not fully understanding something, but following a couple of vertically-responsive issues we're having I did a deep-dive into the code and calcuated %:pixel accuracy of all our elements. I can confirm that all heights have been specified using your So as an example, in our app's common header we have a text element called HeaderText, which has the following style property set: Using two devices to calculate for a minute, the iPhone SE and the iPhone 8 Plus, I would expect the font to come out as follows:
However, instead the fonts come out as:
Now I know there is rounding to the nearest pixel done, so the decimals don't bother me, but these but the % of the screen height is actually roughly twice what I asked it to provide. I would understand if this is because the SE has a render scale of 2x, but the 8+ is a 3x render scale. So, if I want a text element to take up 2.8% of the screen's height, what do I set the font size to? NB: Apologies if I've made a glaring mistake - I'm still newish to the whole display scaling/DP thing |
@jcush - are you able to determine where the discrepancy comes in? Is it that I am not entirely sure that iOS states unequivocally that fontSize is a function of screen height, which is what your test seems to expect. Do you know if they do? Have a link? |
Anyone can help me, in my app i set the fontSize with hp it looks nice in my phone but it does'nt look like in other phones when i run, please help me |
I'm trying to autoscale font sizes in my app, however, it's hard to find a percentage that works for all the devices. For example, I have percentages specified like this:
This looks fine on an iPhone 8+, but is too big on iPhone Xs for example. What would be the best solution to make this work? Help would be appreciated. Thanks.
The text was updated successfully, but these errors were encountered: