AndreN
Topic Author
Posts: 11
Joined: 01 Sep 2015, 08:28

How to do hot reloading of fonts?

04 Oct 2021, 20:02

Hello

I'm working with Noesis GUI 3.1.1 and Monogames engine. Currently I try to implement the hot reloading of resource files. Hot reloading for XAML is very is easy to solve, but now I struggle a little bit with hot reloading for fonts. The problem for fonts is, that the corresponding method RaiseFontChanged for the hot reloading takes a lot of arguments, like font name, weight, stretch and style. All these information are unknown to the font provider, since the only information the font provider has is the folder and filename. Those infos, which has been provided to OpenFont. But I guess those information are available

What is the recommended way to implement hot reloading of fonts? Should the font provider not only open the font-file, but also parse it to read those information? Or is there any way to receive this information from the Noesis GUI API, after the file stream has been processed?

I would be happy for a hint in the right direction.

Best regards
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to do hot reloading of fonts?

05 Oct 2021, 11:52

The API for hot-reloading fonts should be changed because as you discovered it is not very easy to use. You need to reload "families" and that's definitely painful.

Font reloading is rare though so for now I would leave it unimplemented till we fix this. Could you please create a ticket about it?
 
AndreN
Topic Author
Posts: 11
Joined: 01 Sep 2015, 08:28

Re: How to do hot reloading of fonts?

05 Oct 2021, 19:32

Thanks for you confirmation, that I did not oversee something. You are right, changing fonts is a rare use-case and I think not implementing hot reloading for fonts for now is ok.

As you suggested, I created a ticket: https://www.noesisengine.com/bugs/view.php?id=2137 I hope the text of the ticket is clear and when you changed the API for this, I will implement the advance font provider according to the new API.

Thanks a lot and best regards.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: How to do hot reloading of fonts?

06 Oct 2021, 11:52

Thank you very much!

Who is online

Users browsing this forum: Semrush [Bot] and 5 guests