What font family is used by default if not specified explicitly for each platform?

JohnHardmanJohnHardman modGBUniversity mod

One of the things that @TheRealJasonSmith mentioned in his performance presentation at Evolve 2016, was to not explicitly set properties on XF objects, where the value used is the same as the default.

This reminded me of something I have been meaning to look into for a while, where different device behave differently when the default is used.

Where a FontFamily is not explicitly set, what font is actually used on each platform (I am building for Android (including Fire OS), iOS, WinPhone 8.1 SL, WinPhone 8.1 RT, Windows 8.1 RT, Windows UWP) ?

In particular, I know that my Amazon Fire device behaves very differently to all my other Android devices:
(a) on my Amazon Fire tablet (running Fire OS 4.5.5.1), I seem to get what I think is Droid Sans Mono if I don't explicitly set a value. Droid Sans Mono is horrible, so an explicit value is required on Amazon Fire (setting Roboto gets a good appearance)
(b) on my Moto E phone (running Android 5.1), my Asus tablet (running Android 4.4.2) and my Huawei phone (running Android 4.2.2), whatever I set explicitly seems to make no difference, which is just plain confusing

Is this what is expected on Fire OS and Android?

Answers

  • ThomasBurkhartThomasBurkhart ✭✭✭✭ DEMember ✭✭✭✭
    edited April 2016

    Android has amost none other fonts installed besides Droid Sans Mon. You have to add it to your project and use a CustomRenderer to set it in your Labels.

    If you need an example I can send you one, but not today.

  • JohnHardmanJohnHardman mod GBUniversity mod
    edited April 2016

    @ThomasBurkhart - I'm not sure that's correct anymore. It looks like Roboto is the standard on Android 4.0 and later for western and some asian languages, and Noto the standard for other languages.

    When, using Xamarin.Forms, I try setting FontFamily to Droid Sans Mono, Droid Sans, or Droid Serif, the only one of my devices that shows them (without me doing any additional work such as bundling fonts in the resources) is my Amazon Fire. However, the Amazon Fire does also support Roboto, so that's common across all of my devices the way they are currently configured.

    I think for the Android build of my app, I'll code it to support Roboto and Noto based on which language is being used. However, as per @TheRealJasonSmith talking about performance at Evolve, I only want to set the FontFamily property if the default doesn't do the desired thing. If it were documented what the default FontFamily is (and whether it switches between Roboto and Noto based on the language specified in the device settings), it might be possible to avoid explicitly setting FontFamily.

    If would also be useful if the default FontFamily were documented on the other platforms too - iOS, WinPhone 8.1 SL, WinPhone 8.1 RT, Windows 8.1 RT, Windows UWP. Without that documented, setting the FontFamily explicitly seems unavoidable.

  • JohnHardmanJohnHardman mod GBUniversity mod

    [ an edited version of the above, that I was slightly too slow posting to be able to actually replace the above :-) ]

    @ThomasBurkhart - I'm not sure that's correct anymore. It looks like Roboto is the standard on Android 4.0 and later for western and some asian languages, and Noto the standard for other languages.

    When, using Xamarin.Forms, if I try setting FontFamily to Droid Sans Mono, Droid Sans, or Droid Serif, the only one of my Android devices that shows them (without me doing any additional work such as bundling fonts in the resources) is my Amazon Fire.

    BTW - I think I was mistaken in my original post when I said that the Android Fire seems to use Droid Sans Mono by default. I think that was a leftover from some code provided in an old post.

    I've just had a very quick look at the XF source code, and for Android what happens if FontFamily is not explicitly specified seems to come down to whatever Typeface.Create(Typeface.Default, style) does. I'll dig out my Android books at some point to see what they say about that.

    My question for Android now is really, if FontFamily is not explicitly specified, is the choice of Roboto or Noto made by that Typeface.Create(Typeface.Default, style) call based on language settings on the device, or does the app need to specify Roboto or Noto to handle different languages. As per @TheRealJasonSmith talking about performance at Evolve, I only want to explicitly set the FontFamily property if the default doesn't do the desired thing.

    It would also be useful if the default FontFamily were documented on the other platforms too - iOS, WinPhone 8.1 SL, WinPhone 8.1 RT, Windows 8.1 RT, Windows UWP. Without that documented and without searching through the XF source code, setting the FontFamily explicitly seems unavoidable.

  • Matthew.4307Matthew.4307 ✭✭✭ USMember ✭✭✭

    While more documentation on fonts would be good, and the fact you only seem to have one on Android when using Forms is annoying.
    I'd like to touch on the reason the OP asked the question, avoiding setting properties to their defaults for performance gains. In the grand scheme worrying about the font isn't going to make a perceptible difference, there are so many other factors that will have far more effect than changing font unnecessarily.

    Yes we should have the documentation, but it's not going to make our apps go faster when we do.

  • JohnHardmanJohnHardman mod GBUniversity mod

    @Matthew.4307 - You are correct that setting the FontFamily is going to make such a tiny difference in performance that it will be imperceptible to the user. However, setting it unnecessarily on multiple items on a page, combined with explicitly setting other properties to what turns out to be their default values in the same way, results in a cumulative effect. To avoid cumulative inefficiencies, knowing what is actually the default for each property is useful information. For most properties, it's pretty clear what the defaults are (or at least easy to work it out). For FontFamily, the property is null by default, which gives no useful information as to what font is actually used on each platform.

Sign In or Register to comment.