Thread Tools Display Modes
09-05-15, 11:59 PM   #1
Beastwithin
A Deviate Faerie Dragon
Join Date: Sep 2015
Posts: 13
SetFont

Hello all! I am attempting a re-color of wow and as part of that I need to change the font color for most of the default UI.

(Side bar quest text that is yellow needs to change!!!!!)

To avoid needing my hand held through the whole process is there a way that from within the game I can identify the name of the text so that it can be changed? From google search I located a posting where someone wanted the spell book text changed and was provided:

Code:
SpellBookPageText:SetColor(1,1,1)
SubSpellFont:SetTextColor(1,1,1)
I put that code into my .lua and nothing changed so I'm not sure if it's outdated or there is a mistake.
  Reply With Quote
09-06-15, 01:05 AM   #2
Beastwithin
A Deviate Faerie Dragon
Join Date: Sep 2015
Posts: 13
Ok so I've been poking around a bit - and I located the Fonts.xml and FontStyles.xml file in the Interface/FrameXML folder.

I attempted to simply edit the color values in them and save them in that file location however nothing changed and when I went back to the folder it was renamed FrameXML.old

This makes me think that I'll have to create an addon and call the XML file to change the font no? With how easy it is to change the font type in this game it is sure proving to be a PITA to change the system font color :/

aside: I'm really surprised at how few posts or requests on google I can find about this. Changing text color seems like it would be a pretty standard part of UI modding? Perhaps I'm just an uberr mod noob and everyone else just knows how it's done lol!

Any help is appreciated.
  Reply With Quote
09-06-15, 03:00 AM   #3
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
A quick search suggests blizzard recolours the SubSpellFont in an update function so you need to hook it to change it back to your preference each time that happens:

Lua Code:
  1. SpellBookPageText:SetTextColor(1, 1, 1)
  2. hooksecurefunc('SpellButton_UpdateButton', function()
  3.     for i = 1, SPELLS_PER_PAGE do    -- setup a loop that finds each instance of a spell book button
  4.         _G['SpellButton'..i..'SubSpellName']:SetTextColor(1, 1, 1)    -- colour button text
  5.     end
  6. end

note also that the text is a child of the buttons of the spellbook.
  Reply With Quote
09-06-15, 07:58 AM   #4
Beastwithin
A Deviate Faerie Dragon
Join Date: Sep 2015
Posts: 13
Ok thank you for the update. I want to change more than the spellbook text but since we've isolated that let's keep talking about until I can get it to work. So I made a folder named FontColor inside the Addons folder of WoW.

In my new folder I have FontColor.toc which contains the following:

Code:
## Interface: 60000
## Title: FontColor
FontColor.lua
I also have FontColor.lua which contains the following:

Code:
SpellBookPageText:SetTextColor(1, 1, 1)

hooksecurefunc('SpellButton_UpdateButton', function()

    for i = 1, SPELLS_PER_PAGE do    -- setup a loop that finds each instance of a spell book button

        _G['SpellButton'..i..'SubSpellName']:SetTextColor(1, 1, 1)    -- colour button text
    end

end
When I load WoW it recognizes the Addon however does not change the spellbook font color. Am I doing something wrong? (A redundant question as clearly I am :P)
  Reply With Quote
09-06-15, 08:30 AM   #5
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
okay, i just tested it and this will work:

Lua Code:
  1. hooksecurefunc('SpellBookFrame_UpdateSpells', function()
  2.     for i = 1, SPELLS_PER_PAGE do    -- setup a loop that finds each instance of a spell book button
  3.         _G['SpellButton'..i..'SpellName']:SetTextColor(1, 1, 1)         -- colour button text
  4.         _G['SpellButton'..i..'SubSpellName']:SetTextColor(1, 1, 1)      --
  5.     end
  6. end)

I missed a closing parenthesis on the hook which is why the subspellname wasn't changing. Whoops!

The SpellName also doesn't change in my previous function though, which is why i've added it in to the update for a more robust check.

I also switched the function we're hooking since i noticed in testing that it only fires once for each button, as opposed to SpellButton_UpdateButton's multiple fires.

Last edited by ObbleYeah : 09-06-15 at 08:33 AM.
  Reply With Quote
09-07-15, 10:07 AM   #6
Beastwithin
A Deviate Faerie Dragon
Join Date: Sep 2015
Posts: 13
Ok that's wonderful! I got it to work. So how did you go about identifying the object name for that spell book text?

I would like to isolate the quest text on the right hand side of the screen as well as a bunch of other ui text within the game. Rather than ask other people to just tell me what it is I'd like to be able to find out how you find out :P

Cheers
  Reply With Quote
09-07-15, 12:17 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Either the UI source code or /framestack
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-07-15, 01:30 PM   #8
Beastwithin
A Deviate Faerie Dragon
Join Date: Sep 2015
Posts: 13
So when I use /fstack on the quest objectives it returns the following:

ObjectiveTrackerBlocksFrame.(Random Alphanumeric Number).HeaderText

I assume the large number is individually assigned to each quest due to its size. I am guess something like:

Code:
/run ['ObjectiveTrackerBlocksFrame']..i..['HeaderText']:SetTextColor(1,1,1)
Would work? But I'm horrible with LUA and trying that hasn't worked so far.

I've just been trying to run this as a macro before I put it into my addon folder.

Can someone point out where I'm going wrong?

Cheers
  Reply With Quote
09-07-15, 09:12 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
No, dots (.) mean table entries.

Lua Code:
  1. /run ObjectiveTrackerBlocksFrame[thenumberhere].HeaderText]:SetTextColor(1,1,1)

/edit: go through these here - http://lua-users.org/wiki/TutorialDirectory
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetFont


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