App Using Wrong Font

Nathan Sokalski 4,111 Reputation points
2021-12-26T03:37:01.587+00:00

I have an Android Class Library Project that contains several font resources. This includes the following xml file (which is marked as an Android Resource)

<font-family xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
    <font android:font="@font/arial" android:fontStyle="normal" android:fontWeight="400" app:font="@font/arial" app:fontStyle="normal" app:fontWeight="400"/>
    <font android:font="@font/arialbd" android:fontStyle="normal" android:fontWeight="700" app:font="@font/arialbd" app:fontStyle="normal" app:fontWeight="700"/>
    <font android:font="@font/ariali" android:fontStyle="italic" android:fontWeight="400" app:font="@font/ariali" app:fontStyle="italic" app:fontWeight="400"/>
    <font android:font="@font/arialbi" android:fontStyle="italic" android:fontWeight="700" app:font="@font/arialbi" app:fontStyle="italic" app:fontWeight="700"/>
</font-family>

The font directory also includes ttf files for the files specified above. In one of my styles (which is also in the Android Class Library), I include the following:

<item name="android:fontFamily">@font/arialfamily</item>

In many places in my UI in the apps that reference this class library, I use this style for Button views. These Button(s) appear as desired in the designer as well as when I debug the app on my Surface Duo or the emulator, but when I debug it on my Samsung Galaxy S10e, the text does not appear correctly (it is the same text, but it is definitely a different font). I think the font is not being copied when I debug the app, but I am not sure what I am doing wrong. What can I do to insure that the font is copied when I build the app?

Developer technologies .NET Xamarin
{count} votes

1 answer

Sort by: Most helpful
  1. Nathan Sokalski 4,111 Reputation points
    2022-01-04T17:23:45.757+00:00

    It sounds like some (almost) Android devices don't want to let you use all the features of the Android OS, so for now I am going to resort to drawing the 1 character in which it is required for my app's appearance using a drawable; luckily it is just a simple multiplication character (just a rotated +). Thank you for your help in learning what can & can't be done with fonts.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.