User avatar
sfernandez
Site Admin
Posts: 1915
Joined: 22 Dec 2011, 19:20

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

16 Aug 2017, 11:59

We will investigate what are the options we can provide now, but I think that at the end we should allow to specify several fonts in the FontFamily, as that was the intention of the font family.
 
nokola
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

21 Sep 2017, 17:40

+1 for native support of System Fonts in Noesis. We just realized Roboto doesn't have Chinese characters and the Google Noto fonts https://www.google.com/get/noto/ that do are 937MB total. This means we'll have to rely on the system fonts on Android since we don't want to bloat our app from 60MB to hundreds. Much better to use the user's preferred font they have installed on their system. This is for Unity btw. We'll investigate what it takes to make a font provider in Unity.
 
nikobarli
Topic Author
Posts: 178
Joined: 26 Apr 2017, 06:23

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

22 Sep 2017, 05:36

@nokola,

For C++, implementing a custom provider that can reads System fonts was easy by reusing the CachedFontProvider (see previous answer in this thread). Not sure about the C#/Unity one though.
 
monstercho
Posts: 20
Joined: 26 Jan 2016, 19:54

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

22 Sep 2017, 11:09

Also interested in using system font with Noesis under Unity and Android.
Isn't it true that all fonts used by xamls must be available during xaml import (in case of Unity)?

NoesisFontProvider.Register() is called during import. NoesisPostprocessor.ImportFont() creates/reads font assets.
Maybe xamls should not refer to any fonts and font can be assigned runtime?
For now I can't find how to use font that's available only runtime.
Another issue could be getting system font's binary content runtime under Android (for NoesisFont.content).

I see Unity has Font.CreateDynamicFontFromOSFont():
https://docs.unity3d.com/ScriptReferenc ... SFont.html
But I guess it cannot help with Noesis using OS font.
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

22 Sep 2017, 14:23

For Unity, the solution would be creating a NoesisFont for each system font you need. NoesisFont is just a byte array with the contents of the TTF or OTF file. So if you can get access to the stream of the installed font, it should be trivial.
public class NoesisFont: ScriptableObject
{
    public string source;
    public byte[] content;
}
Once, you have a NoesisFont, you need to register it in the provider:
NoesisFontProvider.instance.Register(font);
This should be a starting point.
 
monstercho
Posts: 20
Joined: 26 Jan 2016, 19:54

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

22 Sep 2017, 15:50

Thanks! I should not care about fonts referred in the xamls - better not specify any if I want to use system font at runtime. I should create and assign the font runtime - tried it with font from StreamingAssets.

Now I only have to find system font's ttf content at runtime, but this is not Noesis related.
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

23 Sep 2017, 13:49

You are in the right direction, keep us posted please!
 
monstercho
Posts: 20
Joined: 26 Jan 2016, 19:54

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

23 Sep 2017, 16:36

I underestimated the finding of ttf content - googling since yesterday, but seems that only FaceType object is accessible under Android :(

Read that it's similar under iOS but supposedly ttf can be reconstructed from a table included in the CGFont object:
https://gist.github.com/Jyczeal/1892760 (from: https://stackoverflow.com/questions/369 ... s-ttf-file)
It's old info, maybe not valid anymore.
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

26 Sep 2017, 21:02

I didn't find time to investigate this yet but couldn't you access the .TTF directly at the system directory? (wherever Android and iOS store them...).
 
monstercho
Posts: 20
Joined: 26 Jan 2016, 19:54

Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)

26 Sep 2017, 23:23

I think you can't access it without root.

Who is online

Users browsing this forum: Google [Bot] and 1 guest