Is there any way to get two different fonts displayed in a gui button?
I've tried placing a button with a label in it, but the label appears outside the button (below bottom right corner of button).
Reason: I want to use a scalable icon font for buttons, and give user an option to choose between "icon only" or "icon and text" for buttons.
gui button with two fonts?
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
gui button with two fonts?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: gui button with two fonts?
Create a couple of styles in in data.lua then have your script change the element.style as needed. might have to destory() and recreate but I am not sure on that.
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: gui button with two fonts?
Hrm, but there's no way to show two different fonts - for that I need two labels in a button (or the button caption in font A and then a label in the button with font B).
The icon would be font A, the caption would be font B (for example).
I could place two buttons side by side, but there's no way to sync the hover state over both buttons. And I want to avoid using sprites (can they even have labels?) for icons because I want the ability to implement 'themes' (ie. change color simply by using the font color setting).
I'm thinking I might have to ditch the "icon + caption" mode and limit to just icon display, maybe putting caption in tooltip.
FYI: It's part of a rewrite of EvoGUI that I'm attempting... I'm adding a toolbar (and corresponding API for mods to use) so that we can start getting a much nicer, cleaner and easier to use gui.top toolbar for mods. I'm also looking to use it for tabs on the reworked gui.left sidebar API (actually the sidebar is also going in gui.top so opening it can shift the HUD displays, like sensors, to the right - or hide the HUDS - thus providing more vertical height for sidebars).
The icon would be font A, the caption would be font B (for example).
I could place two buttons side by side, but there's no way to sync the hover state over both buttons. And I want to avoid using sprites (can they even have labels?) for icons because I want the ability to implement 'themes' (ie. change color simply by using the font color setting).
I'm thinking I might have to ditch the "icon + caption" mode and limit to just icon display, maybe putting caption in tooltip.
FYI: It's part of a rewrite of EvoGUI that I'm attempting... I'm adding a toolbar (and corresponding API for mods to use) so that we can start getting a much nicer, cleaner and easier to use gui.top toolbar for mods. I'm also looking to use it for tabs on the reworked gui.left sidebar API (actually the sidebar is also going in gui.top so opening it can shift the HUD displays, like sensors, to the right - or hide the HUDS - thus providing more vertical height for sidebars).
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.