-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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.
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
+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.
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
@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.
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:
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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.
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.
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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.
Once, you have a NoesisFont, you need to register it in the provider:
This should be a starting point.
Code: Select all
public class NoesisFont: ScriptableObject
{
public string source;
public byte[] content;
}
Code: Select all
NoesisFontProvider.instance.Register(font);
- monstercho
- Posts: 20
- Joined:
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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.
Now I only have to find system font's ttf content at runtime, but this is not Noesis related.
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
You are in the right direction, keep us posted please!
- monstercho
- Posts: 20
- Joined:
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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.
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.
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
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:
Re: How to make NoesisGUI recognizes system-installed font (C++ SDK 2.0.2f2, Windows platform)
I think you can't access it without root.
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests