Thread Tools Display Modes
10-15-17, 04:09 PM   #1
Mandraxon
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2009
Posts: 21
some font code.

Hey hello.
since there are some things that cant be done without an addon i am working on a small addon that will ad functions and make changes to the default ui to the way i want it.
the default fonts on wow is just meh and i am using the classic Font folder trick to change some fonts..
however i want to change the font and size of Key-binds and i need Lua code to change it.
anyone have a nice way to do this?

i also want to be able to change the chat font so the Gap is 6,7,8,9,10,11,12 and so on not like the default setting is.. is this possible to do?

Thanks for any aid u can give.
/M
  Reply With Quote
10-15-17, 08:30 PM   #2
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
To add/change the font heights

Code:
for i = 1, 23 do
    CHAT_FONT_HEIGHTS[i] = i+5
end

I haven't tested this for the hotkey stuff...

Code:
local FONTPATH = "Interface\\AddOn\\YOURADDON\\Media\\FONT.ttf"
local FONTSIZE = 10
local FONTFLAGS = "None"


local function UpdateHK(btn)

   if not btn then return end

   local action = btn.action
   local name = btn:GetName()
   local hk  = _G[name.."HotKey"]

   hk:SetFont(FONTPATH, FONTSIZE, FONTFLAGS)

end

local function AlterHotKeys()

   for i = 1, NUM_ACTIONBAR_BUTTONS do
      UpdateHK(_G["ActionButton"..i])
      UpdateHK(_G["MultiBarBottomLeftButton"..i])
      UpdateHK(_G["MultiBarBottomRightButton"..i])
      UpdateHK(_G["MultiBarRightButton"..i])
      UpdateHK(_G["MultiBarLeftButton"..i])
   end

end

local HKF = CreateFrame("Frame")
HKF:RegisterEvent("PLAYER_ENTERING_WORLD")
HKF:SetScript("OnEvent", AlterHotKeys)

Last edited by Tim : 10-16-17 at 03:48 AM.
  Reply With Quote
10-15-17, 08:45 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You'll get an "attempt to call global 'UpdateHK'" error because

local function UpdateHK(btn)

is declared after

local function AlterHotKeys()
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-16-17, 03:48 AM   #4
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
That's what happens when you code something right before bed. :P
  Reply With Quote
10-16-17, 10:39 AM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
It happens to me any time of the day or night
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » some font code.

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