Quantcast How to get label font name? - ESOUI
Thread Tools Display Modes
10/02/19, 08:09 PM   #1
cloudor
 
cloudor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 23
How to get label font name?

I want to get some labels' font name. But there is no such api provided. Any suggestions?
  Reply With Quote
10/03/19, 03:08 AM   #2
Kyoma
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 97
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 :/
  Reply With Quote
10/03/19, 03:24 AM   #3
cloudor
 
cloudor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 23
Originally Posted by Kyoma View Post
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 ?
  Reply With Quote
10/03/19, 06:49 AM   #4
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,534
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

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.
  Reply With Quote
10/03/19, 08:14 AM   #5
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 561
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>)
  Reply With Quote
10/03/19, 08:20 AM   #6
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
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.
  Reply With Quote
10/03/19, 08:40 AM   #7
cloudor
 
cloudor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 23
Originally Posted by Baertram View Post
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

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.
  Reply With Quote
10/03/19, 08:49 AM   #8
cloudor
 
cloudor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 23
Originally Posted by ZOS_ChipHilseberg View Post
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?
  Reply With Quote
10/03/19, 09:09 AM   #9
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,534
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
  Reply With Quote
10/03/19, 10:07 AM   #10
cloudor
 
cloudor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 23
Originally Posted by Baertram View Post
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.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to get label font name?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off