gui button with two fonts?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

gui button with two fonts?

Post by aubergine18 »

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.
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.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: gui button with two fonts?

Post by Nexela »

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.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: gui button with two fonts?

Post by aubergine18 »

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).
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.

Post Reply

Return to “Modding help”