How do I use two fonts in one app? #4285
Replies: 3 comments 4 replies
-
The aim (and current limitation) is that you can have only 1 font for each text style (permutation if 8 I think between normal/bold/italic/monospace). |
Beta Was this translation helpful? Give feedback.
4 replies
-
this is good idea |
Beta Was this translation helpful? Give feedback.
0 replies
-
Maybe you will be interested in #4313 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I am trying to build and app for my CarPC, and what I would like to do is to use multiple fonts across my app, and I cant find a way to do that. From what I've managed to find during my research, I can create a custom theme and specify a custom font there, but only one, because there's only one field for fonts in theme struct. Am I missing something?
For now I use this crutch to make it work:
So I sacrifice default monospace and replace it with custom resource, so I get my custom font when setting Monospace flag.
Im new to Golang and what I've tried to do from my other languages experience is:
But It doesn't work as Theme constructor doesn't accept Font func with argument of type that is not fyne.TextStyle, because there's no inheritance in Go.
Another way to do It is to assign each font to specific combination of fyne.TextStyle parameters and then write a function that will take desired font name and return fyne.TextStyle with corresponding set of parameters. This allows to bring enough fonts into app, but... come on, that's insane.
Maybe there's a built-in solution I failed to find or a better workaround, maybe some way to extend fyne.TextStyle?
Appeciate any help, thanks.
Beta Was this translation helpful? Give feedback.
All reactions