Thread Tools Display Modes
09-11-22, 02:06 PM   #1
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
SetFont - new parameter: textType

I received such a LUA error:

bad argument #1 to 'SetFont' (Usage: self:SetFont(textType, fontFile, height, flags))

Typically, the syntax for this function is:

self:SetFont(fontFile, height, [flags])

What data does textType take?
  Reply With Quote
09-11-22, 02:13 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
A guess is that SetFont might have changed accept either a table only ie. GameFontNormal OR font, size, flags.

Mind you, it IS just a guess. I can't find anywhere Blizz. uses anything other than font, size, flags
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-12-22, 06:38 AM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
I found mentions of textType in the SimpleHTML documentation from a beta export:

Lua Code:
  1. {
  2.     Name = "GetFont",
  3.     Type = "Function",
  4.  
  5.     Arguments =
  6.     {
  7.         { Name = "textType", Type = "string", Nilable = false },
  8.     },
  9.  
  10.     Returns =
  11.     {
  12.         { Name = "fontFile", Type = "string", Nilable = false },
  13.         { Name = "height", Type = "number", Nilable = false },
  14.         { Name = "flags", Type = "string", Nilable = false },
  15.     },
  16. },
  17. {
  18.     Name = "GetFontObject",
  19.     Type = "Function",
  20.  
  21.     Arguments =
  22.     {
  23.         { Name = "textType", Type = "string", Nilable = false },
  24.     },
  25.  
  26.     Returns =
  27.     {
  28.         { Name = "font", Type = "table", Nilable = false },
  29.     },
  30. },
  31. {
  32.     Name = "SetFont",
  33.     Type = "Function",
  34.  
  35.     Arguments =
  36.     {
  37.         { Name = "textType", Type = "string", Nilable = false },
  38.         { Name = "fontFile", Type = "string", Nilable = false },
  39.         { Name = "height", Type = "number", Nilable = false },
  40.         { Name = "flags", Type = "string", Nilable = false },
  41.     },
  42. },
  43. {
  44.     Name = "SetFontObject",
  45.     Type = "Function",
  46.  
  47.     Arguments =
  48.     {
  49.         { Name = "textType", Type = "string", Nilable = false },
  50.         { Name = "font", Type = "table", Nilable = false },
  51.     },
  52. },
  Reply With Quote
09-12-22, 07:30 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
It's a mystery. You have:

itemTexFrame.lua
Lua Code:
  1. ITEM_TEXT_FONTS = {
  2.     ["ParchmentLarge"] = {
  3.         ["P"]  = QuestFont,
  4.         ["H1"] = Fancy48Font,
  5.         ["H2"] = Game20Font,
  6.         ["H3"] = Fancy32Font
  7.     },
  8.     ["default"] = {
  9.         ["P"]  = QuestFont,
  10.         ["H1"] = QuestFont,
  11.         ["H2"] = QuestFont,
  12.         ["H3"] = QuestFont
  13.     }
  14. };

Lua Code:
  1. local fontTable = ITEM_TEXT_FONTS[material];
  2. if(fontTable == nil) then
  3.     fontTable = ITEM_TEXT_FONTS["default"];
  4. end
  5. for tag, font in pairs(fontTable) do
  6.     ItemTextPageText:SetFontObject(tag, font);
  7. end

But that signifies a change to SetFontObject so maybe something along the same lines
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-12-22 at 07:41 AM.
  Reply With Quote
09-12-22, 10:12 AM   #5
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
Thank Frizzlemizz, textType "P" is the solution for me.
But in this 4 parameter syntax, all 4 parameters must be used.

TextObject:SetFont(textType, fontFile, height, flags)
In normal 3-parameter syntax, the last parameter is optional.

TextObject:SetFont(fontFile, height, [flags])
Since I'm only changing the font file, my program now looks like this:

local a1, a2, a3 = ItemTextPageText:GetFont("P");
ItemTextPageText:SetFont("P", BT_Font, a2, a3);
  Reply With Quote

WoWInterface » PTR » PTR General Discussion » SetFont - new parameter: textType


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