MD5browns MD5browns - 1 year ago 85
Android Question

Samsung phones override font for unicode chars

I am developing a chess app that utilizes unicode chars for representing chess pieces. I am drawing to a canvas (custom view) and setting the typeface for the paint I am drawing with by using this code:

Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/robotolight.ttf");
piecePaint.setTypeface(tf);


I have placed robotolight.ttf in assets/fonts. I have also tried using an .otf version.

This is how it looks on all nexus devices I have tested

And this is how it looks on all Samsung devices I have tested

As you can see the Samsung phones use the correct font until they hit a unicode char and then the font is overridden. I have placed a unicode char at the end of the "Waiting for input" string to illustrate this in the screenshots.

I have searched the internet for countless hours and while there are multiple issues with Samsung and custom fonts, I could not find a solution for this.

Any help is greatly appreciated.

Answer Source

Got around it by using a different font (Segoe UI Symbol). If someone reads this who knows why Samsung phones aren't displaying those characters with Roboto please let me know.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download