TradeSkillMaster_Crafting

407 - ZoneTextFont returning negative values in CraftingUils.lua when used with Fonter?

What steps will reproduce the problem?
1. Use TradeSkillMaster_Crafting with Fonter.
2. Attempt to open a crafting profession.
3. Get lua error about a font size < 0.

What is the expected output? What do you see instead?

I get an lua error about the fontsize on line 140 of CraftingUtils.lua being less than zero.  Doing some debugging, I think I figured out the issue.  It seems to be an issue when TradeSkillMaster_Crafting is used with Fonter:

The function on line 145 of CraftingUtils.lua is passing ZoneTextFont to Crafting:CreateButton as shown below:

    local btn = Crafting:CreateButton(parent, text, ZoneTextFont, fontSize, buttonName, inheritsFrame)

For some reason, this value is coming back negative when using Fonter (usually -20 or -16 but sometimes -1 - this may be due to Fonter doing something silly).  This causes the line 140 to throw an error if tSize < - abs(fontSize) :

    btn:GetFontString():SetFont(tFile, tSize + fontSize, "OUTLINE")

I made two changes to CraftingUtils.lua (not found on your svn/repository or anything) so it doesn't blow up with Fonter:

- I pass GameFontNormal instead of ZoneTextFont to Crafting:CreateButton on line 145 in CraftingUtils.lua

    local btn = Crafting:CreateButton(parent, text, GameFontNormal, fontSize, buttonName, inheritsFrame)

- I then simply use the font from GameFontNormal instead of adding the local function parameter fontSize to it on line 140:

    btn:GetFontString():SetFont(tFile, tSize, "OUTLINE")

Doing both of those things maintains a valid font size and prevents the error described above.

What version of the product are you using (put the actual number - never say "latest")?

v1.1.13

Do you have an error log of what happened?

Ticket 386 has the error in full.  That user is also using Fonter as well.

Please provide any additional information below.

While I understand that Fonter is not longer being updated currently, I would hope that this simple workaround could be implemented in TradeSkillMaster_Crafting to prevent this issue.  In the meanwhile, keep up the excellent work with TSM.  It is the only reason I have 1.7 million gold among my alts. :)

User When Change
sapu94 Jul 29, 2013 at 03:41 UTC
SmuvMoney Dec 23, 2012 at 20:41 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of sapu94 sapu94 Jul 29, 2013 at 03:41 UTC - 0 likes

    Closing as TSM 2.0 is now in public beta (via TSM forums).

    Lead Developer and Director of TradeSkillMaster | @Sapu94 on Twitter

    "A good programmer is someone who always looks both ways before crossing a one-way street." Doug Linder

  • 1 comment

Facts

Last updated
Jul 29, 2013
Reported
Dec 23, 2012
Status
Declined - We decided not to take action on this ticket.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees