Page 1 of 2

System fonts in Android

Posted: 24 Mar 2019, 17:41
by ivan_b
I am trying to use the system fonts in Android, specifically the Noto Sans CJK but Noesis was not able to find it.
The fonts is in the folder /system/fonts but the font is a TrueType Collection.
I wanted to know if this could be the reason for not being able to find it?

Re: System fonts in Android

Posted: 24 Mar 2019, 23:32
by nokola
Just curious - have you tried using just "Noto Sans" and the CJK characters? I assume in that cause it will "just work".

Re: System fonts in Android

Posted: 25 Mar 2019, 12:50
by sfernandez
We use the family name specified in the ttf tables to perform the FontFamily matching.
I downloaded from here https://www.google.com/get/noto/ the version for JP and the family name used in the file was: "Noto Sans CJK JP", using that works fine in Noesis:
<TextBlock FontFamily="Fonts/#Noto Sans CJK JP" .../>

Re: System fonts in Android

Posted: 25 Mar 2019, 20:06
by ivan_b
@nokola
I have tried with Noto Sans but it can't find the Noto Sans font at all.
This is the way I am using it
<FontFamily x:Key="DeafultFont">#Arial, #Heiti SC, #Noto Sans</FontFamily>
@sfernandez
I wanted to use the system installed fonts as it would save memory.
When I add the Noto Sans fonts to my project it works as expected.

Re: System fonts in Android

Posted: 25 Mar 2019, 20:40
by jsantos
TrueType Collection (.ttc) are supported and scanned. Are the rest of system fonts working properly? What sfernandez is suggesting is using '#Noto Sans CJK JP' as the family name. I don't have an Android right now to check but probably what's happening is a mismatch in the font family name.

Re: System fonts in Android

Posted: 26 Mar 2019, 10:10
by ivan_b
I will try this. I have tried with the "regular" Noto sans but it was not able to find it but the font is located in the /system/fonts folder.
For now the only font family that I was able to use on Android is Roboto.

Re: System fonts in Android

Posted: 27 Mar 2019, 08:47
by ivan_b
Hi
Thank you for your help. I tried the example that @sfernandez suggested before but on an older android device and that is the reason why it didn't work.
On a newer one works great.

If it is not a problem could you explain what is the difference between the system fonts and the fonts included in the project?
The main thing that I am interested in is what is the reason that sytsem fonts occupy less memory.

Re: System fonts in Android

Posted: 27 Mar 2019, 13:54
by jsantos
If it is not a problem could you explain what is the difference between the system fonts and the fonts included in the project?
The main thing that I am interested in is what is the reason that sytsem fonts occupy less memory.
Exactly, System fonts are not included in your application so the size of the redistributable is reduced. But you have the extra problem that depending on the operating system version the used system font may be available or not, so you need to use fallback fonts (as you are doing) to cover all cases.

Please, let me know if this answers your question.

Re: System fonts in Android

Posted: 28 Mar 2019, 09:59
by ivan_b
My concern was not about the application size but about the runtime memoery usage.
In the changelog you wrote "Support for system fonts. Improved memory usage of fonts." and my assumption was that this is an improvement of the runtime memory usage.
Have I misunderstand this?

Re: System fonts in Android

Posted: 30 Mar 2019, 16:35
by jsantos
Yes, 2.2 brings an improvement in memory usage when using local fonts (also system fonts but less).