View Single Post
10-14-20, 02:37 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
API Changed in SetFont ?

Hi all,

the next error I am trying to fix is this.

This happens when I try to change fonts attributes calling the function in this way:


Lua Code:
  1. ....
  2.     gmfontset["Roboto"] = {"Roboto-Regular.ttf", "Roboto-Bold.ttf", "Roboto-Italic.ttf", "Roboto-BoldItalic.ttf"}
  3.    
  4.         ....
  5.  
  6.     GMFONTS["N"]    = fontpath .. gmfontset[text][1]
  7.     GMFONTS["B"]    = fontpath .. gmfontset[text][2]
  8.     GMFONTS["BI"]   = fontpath .. gmfontset[text][3]
  9.     GMFONTS["I"]    = fontpath .. gmfontset[text][4]
  10.     GMFONTS["NR"]   = fontpath .. gmfontset[text][1]
  11.  
  12. ......
  13.  
  14. local function SetFont(obj, font, size, style, r, g, b, sr, sg, sb, sox, soy)  
  15.     obj:SetFont(font, size, style)
  16.     if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
  17.     if sox and soy then obj:SetShadowOffset(sox, soy) end
  18.     if r and g and b then obj:SetTextColor(r, g, b)
  19.     elseif r then obj:SetAlpha(r) end
  20. end
  21. .....
  22.  
  23.     SetFont("AchievementFont_Small",GMFONTS["B"], 12)
  24.     SetFont("FriendsFont_Large",GMFONTS["N"], 15, nil, nil, nil, nil, 0, 0, 0, 1, -1)
  25.        .... a lot of fonts names here and down :) ....

The error is this:

Lua Code:
  1. 40x gmFonts\core.lua:40: attempt to call method 'SetFont' (a nil value)
  2. [string "@gmFonts\core.lua"]:40: in function <gmFonts\core.lua:39>
  3. [string "@gmFonts\core.lua"]:61: in function <gmFonts\core.lua:47>
  4. [string "@gmFonts\core.lua"]:92: in function <gmFonts\core.lua:79>
  5.  
  6. Locals:
  7. obj = "AchievementFont_Small"
  8. font = "Addons\gmFonts\fonts\Candarab.ttf"
  9. size = 12
  10. style = nil
  11. r = nil
  12. g = nil
  13. b = nil
  14. sr = nil
  15. sg = nil
  16. sb = nil
  17. sox = nil
  18. soy = nil
  19. (*temporary) = nil
  20. (*temporary) = "AchievementFont_Small"
  21. (*temporary) = "Addons\gmFonts\fonts\Candarab.ttf"
  22. (*temporary) = 12
  23. (*temporary) = nil
  24. (*temporary) = "attempt to call method 'SetFont' (a nil value)"

It should be that the fonts names are not global anymore ?

Thanks for any advices
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote