Page 1 of 1

gui button with two fonts?

Posted: Tue Aug 30, 2016 11:36 am
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.

Re: gui button with two fonts?

Posted: Tue Aug 30, 2016 12:55 pm
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.

Re: gui button with two fonts?

Posted: Tue Aug 30, 2016 1:02 pm
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).