TT-Chocolates font not rendering properly in small sizes - android

I've started using the font TT-Chocolates font in an Android app, but with font sizes < 16sp the font is being rendered uneven/inconsistently (e.g. TT-Chocolates-Regular 14sp, full resolution screenshot taken with android studio 1080x2400 Poco X3):
As you can see e.g. the "r" letters is drawn differently in two different textviews (list of elements with the exact same style and font size). In iOS, with the same size this problem does not occur.
Any thoughts? Thank you very much in advance!

Related

Responsive font size in Android

We can make positioning of widgets 'responsive' by using bias/weight etc, but how do we make the font sizes responsive? By 'responsive' I mean the font size that changes according to size of device - i.e for large device the font size will be large, and for small device the font size will be small.
I tried using the library for ssp/sdp, but that didn't solve the issue.
Another suggested way is to create different font sizes in dimens.xml for different device size, and use them, but that would require calculating the different font sizes for the fonts used in the entire app.
Is there any other way?
you can use this library for font size :
implementation 'com.intuit.ssp:ssp-android:1.0.6'

Scale button icons in Qt on Android?

I created some icons for buttons in my application. I think this search field looks nice:
Or does it? This is what you get on Samsung Galaxy S6 with that crazy-ass DPI screen:
Qt did scale font size and field size as I wanted, but the button icon is exactly the same size on both pictures. Here's full scale image for comparison:
I used Qt Designer to add the icon from resources:
So what I need is to get Qt to properly make my icons larger or smaller so that they fit the button. I actually expected that it will happen automatically, silly me.

Font size in XML for Android Wear resolutions

How can I have different xml font sizes for different Android Wear Watches?
Currently there are 280/320/360/400/480 resolution watches. I adjust my fonts programmatically after I detect the screen size with onSurfaceChanged();
Can I have different .xml for different resolution and how should I define it? It will be a lot more better solution and it will cut my code a lot.

Android font size in pt

I'm working on a Android project where I need to build my layouts based on a JSON layout file. This same file is also being used on an iOS app. So there is 1 file which will render the same layout on the Android as well as on the iOS.
The JSON layout file defines its font sizes based on the default iOS font unit.
From the Android docs:
Points - 1/72 of an inch based on the physical size of the screen.
And as far as I can find, iOS font sizes are also defined as 1/72 of an inch.
So based on this info, I'd say the following should be enough:
view.setTextSize(TypedValue.COMPLEX_UNIT_PT, fontSizeInIosUnit)
This however results in the text being too large. And it also seems to differ per device (which is weird since points should always appear in the same physical size).
If you want fonts to resize properly according to screen size you should use dp/dip instead.
So try this instead:
view.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSizeInIosUnit);
Now this might not be exacly the same but in my experience this gives the best results. If it doesn't have the proper size then figure out what size you need on Android as the base size and then go with that instead.

trouble with font size for different screen size/resolution

I know this has been answered in other questions, but nothing is working for me. I have a text view where I want the text to appear the same size in a variety of density/screen size combinations. I have tried specifying
android:textSize="30dp"
and
android:textSize="30sp"
and have also used
TextView text = (TextView) findViewById(R.id.text);
text.setTextSize(30 * (getResources().getDisplayMetrics().density));
30 is my font size *****
the text doesn't scale properly. It becomes way too small at lower densities and as screen size increases. Are there additional techniques I can use to scale my font?
create layout-large, layout-small, layout-xlarge etc.. versions of your layout xml file.
You can set the size differently in each so that the font will look right across a variety of screen sizes.
After years of constantly having everything slightly off on different devices, I recently discovered that the inches and cm measurements for dimensions are literally that.
So even on devices where 160dp isn't quite an inch, specifying 1inch will give exactly that, on everything, even if they have a custom scaled ROM.
I now specify anything I want very tight control over with these.
If you just want to have separate font sizes for separate screens, you can create dimens in your value.xml for sw600dp and sw720dp folder too and put different values there. You don't need to create separate xml layout for each, if you just need to change font sizes.

Categories

Resources