ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How to get label font name? (https://www.esoui.com/forums/showthread.php?t=8787)

cloudor 10/02/19 08:09 PM

How to get label font name?
 
I want to get some labels' font name. But there is no such api provided. Any suggestions?

Kyoma 10/03/19 03:08 AM

Hmmm, don't believe there is a way to get the font. The only idea I'd have would be to get the text's height and width and then use a dummy label and loop over all fonts to get a match. But I doubt that would even be remotely accurate :/

cloudor 10/03/19 03:24 AM

Quote:

Originally Posted by Kyoma (Post 39345)
Hmmm, don't believe there is a way to get the font. The only idea I'd have would be to get the text's height and width and then use a dummy label and loop over all fonts to get a match. But I doubt that would even be remotely accurate :/

I want to change control's font to support translation. Or is there a way to change default values of MEDIUM_FONT,BOLD_FONT,etc ?

Baertram 10/03/19 06:49 AM

I don't think so but here is somethign I found about a combobox's font "ratio" which uses GetFontInfo() function:
https://github.com/esoui/esoui/blob/...ommon.lua#L574

Maybe you can adopt this code somehow if you get the label's font info in any way :confused:

Or, depending on your language, you could always overwrite the label's font with a selected one (LAM menu combobox with font entries e.g.) and le the user choose the font + size maybe.

Rhyono 10/03/19 08:14 AM

Is this your own label? You can make a Font, assign a default to it, then if you see someone is using another language, do FontName:SetFont(<font>)

ZOS_ChipHilseberg 10/03/19 08:20 AM

You can supply a .str file which will load with the language file and allow you to override strings or fonts. I'd take a look at the RuESO addon for an example.

cloudor 10/03/19 08:40 AM

Quote:

Originally Posted by Baertram (Post 39347)
I don't think so but here is somethign I found about a combobox's font "ratio" which uses GetFontInfo() function:
https://github.com/esoui/esoui/blob/...ommon.lua#L574

Maybe you can adopt this code somehow if you get the label's font info in any way :confused:

Or, depending on your language, you could always overwrite the label's font with a selected one (LAM menu combobox with font entries e.g.) and le the user choose the font + size maybe.

I want to traverse and replace all controls' fonts depending on their original font face name. I have modified the metatable of LabelControl but it only works for controls created and configured(SetFont) in lua after the metatable had been modified. Those already created before or created by xml file still remains old font. So I need either getting font info or replacing font variable values.

cloudor 10/03/19 08:49 AM

Quote:

Originally Posted by ZOS_ChipHilseberg (Post 39350)
You can supply a .str file which will load with the language file and allow you to override strings or fonts. I'd take a look at the RuESO addon for an example.

Many addons use font variable like "$(MEDIUM_FONT)|16|soft-shadow-thick", can I override MEDIUM_FONT?

Baertram 10/03/19 09:09 AM

You maybe could overwrite the font definitions in total if you need it to be exchanged:
https://github.com/esoui/esoui/blob/...s_keyboard.xml

Which overall would be the .str stuff Chip already said

cloudor 10/03/19 10:07 AM

Quote:

Originally Posted by Baertram (Post 39353)
You maybe could overwrite the font definitions in total if you need it to be exchanged:
https://github.com/esoui/esoui/blob/...s_keyboard.xml

Which overall would be the .str stuff Chip already said

But these are not enough for addons using fonts like MEDIUM_FONT, BOLD_FONT, etc.


All times are GMT -6. The time now is 08:18 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI