can I specify a font type for a toga.Command? #2622
-
I'm experimenting with fontawesome which is an "Iconic" font. I installed the fontawesome package and it works great in linux but on android I also have to add a ttf resourse and do a toga.Font.register then I can use the fontawesome but I also have to add font_family="fontawesome" to Pack ( I don't have to do this on desktop linux apps ). The problem then comes with using the fontawesome with toga.Command( text= ... I tried with font= and style= but it looks like neither are supported by toga.Command I'm aware I could use a "real" Icon but fontawesome simplifies this whole process of finding and sizing icons .. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The Iconic font possibly does work on Linux without registration - if you've installed Iconic as a system font. If the font hasn't been installed, then font lookup won't work - you'll need to register it. Essentially this is what you should be doing for every font that isn't one of the system fonts. As for Command - no, there isn't any font or style options, because a Command is an abstract idea - it's a "thing that can be executed". It has a label, but how that label is rendered depends on what is doing the rendering. It could be a menu item, it could be a toolbar item, or it could be some other mechanism for triggering execution. So - you don't want to set the font on the Command - you want to set the font on where the command is used. And at least at present, those are all "system controlled" - apps don't change the fonts used in menus, or in toolbars, because they're part of the system chrome. If this is specifically about using a font glyph as an icon - that's a workaround that works for buttons, but toolbars aren't buttons. They're a completely separate UI mechanism. An image-based icon is your only option for toolbars at present. |
Beta Was this translation helpful? Give feedback.
The Iconic font possibly does work on Linux without registration - if you've installed Iconic as a system font. If the font hasn't been installed, then font lookup won't work - you'll need to register it. Essentially this is what you should be doing for every font that isn't one of the system fonts.
As for Command - no, there isn't any font or style options, because a Command is an abstract idea - it's a "thing that can be executed". It has a label, but how that label is rendered depends on what is doing the rendering. It could be a menu item, it could be a toolbar item, or it could be some other mechanism for triggering execution.
So - you don't want to set the font on the Command - you …