Thread Tools Display Modes
02-26-11, 10:20 AM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
GameFontBlack

Is there any way to change this font? color? :<

i've tryed and not working

Code:
for _, font in pairs({

             _G["GameFontBlack"],

}) do
    font:SetFont('Fonts\\ARIALN.ttf', 14, 'THINOUTLINE')
    font:SetTextColor(1, 1, 1)
end
  Reply With Quote
02-26-11, 11:43 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Is this snippet part of something? What is _G["GameFontBlack"]? Are you sure it contains FontString objects?

Does
Code:
for _, font in pairs({

             _G["GameFontBlack"],

}) do
    print(font:GetTextColor(1, 1, 1))
end
prints anything?

You can't recolor black textures. If the fonts textures are black font:SetTextColor(1, 1, 1) won't work. But the fonts path is 'Fonts\\ARIALN.ttf' - which is imho a wow standard font. So this can't be the problem.
  Reply With Quote
02-26-11, 03:37 PM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Duugu View Post
Is this snippet part of something? What is _G["GameFontBlack"]? Are you sure it contains FontString objects?

Does
Code:
for _, font in pairs({

             _G["GameFontBlack"],

}) do
    print(font:GetTextColor(1, 1, 1))
end
prints anything?

You can't recolor black textures. If the fonts textures are black font:SetTextColor(1, 1, 1) won't work. But the fonts path is 'Fonts\\ARIALN.ttf' - which is imho a wow standard font. So this can't be the problem.
It didn't print.. anyways this no i need that to change fontsize + fontflag, else it wont work (I guess)
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_022611_223435.jpg
Views:	726
Size:	1.61 MB
ID:	5799  
  Reply With Quote
02-26-11, 03:43 PM   #4
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
GameFontBlack isn't a Font it's a FontStyle.
  Reply With Quote
02-26-11, 03:52 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Right. You'll have to change anything that uses GameFontBlack.
__________________
"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
02-26-11, 05:40 PM   #6
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Try this.

lua Code:
  1. local function SetFont(obj, font, size, style, alpha, r, g, b, sr, sg, sb, sox, soy, spacing)
  2.     obj:SetFont(font, size, style)
  3.     if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
  4.     if sox and soy then obj:SetShadowOffset(sox, soy) end
  5.     if r and g and b then obj:SetTextColor(r, g, b) end
  6.     if alpha then obj:SetAlpha(r) end
  7.     if spacing then obj:SetSpacing(spacing) end
  8. end
  9.  
  10. local f = CreateFrame("Frame")
  11. f:RegisterEvent("ADDON_LOADED")
  12. f:SetScript("OnEvent", function()
  13.  
  14. SetFont(GameFontBlack, font, fontsize, outline, 1, 1, 1, 1, 0, 0, 0, 0, 0);
__________________

  Reply With Quote
02-26-11, 06:40 PM   #7
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by sacrife View Post
Try this.

lua Code:
  1. local function SetFont(obj, font, size, style, alpha, r, g, b, sr, sg, sb, sox, soy, spacing)
  2.     obj:SetFont(font, size, style)
  3.     if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
  4.     if sox and soy then obj:SetShadowOffset(sox, soy) end
  5.     if r and g and b then obj:SetTextColor(r, g, b) end
  6.     if alpha then obj:SetAlpha(r) end
  7.     if spacing then obj:SetSpacing(spacing) end
  8. end
  9.  
  10. local f = CreateFrame("Frame")
  11. f:RegisterEvent("ADDON_LOADED")
  12. f:SetScript("OnEvent", function()
  13.  
  14. SetFont(GameFontBlack, font, fontsize, outline, 1, 1, 1, 1, 0, 0, 0, 0, 0);
Didn't work :< thanks anyways.
  Reply With Quote
02-27-11, 02:47 AM   #8
hankthetank
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2009
Posts: 64
Right. You'll have to change anything that uses GameFontBlack.
Nope. Changing a font like GameFontNormal via SetFont and the like has effect on all FontStrings that use it as their FontObject. Idk where the rub lies with changing that specific font. Going ingame, opening the spellbook and typing "/script GameFontBlack:SetFont("Fonts\\ARIALN.ttf", 20, "THICKOUTLINE")" worked perfectly fine for me.

That's how I replace fonts in my UI:

lua Code:
  1. local function SetFont(fontObject, font, size, flags)
  2.     local _, oldSize, oldFlags = fontObject:GetFont()
  3.     font = string.find(font or "", "\\") ~= nil and font or media.font[font]
  4.         or (string.find(fonts.masterfont or "", "\\") ~= nil and fonts.masterfont or media.font[fonts.masterfont])
  5.     fontObject:SetFont(font, size or oldSize, flags or oldFlags)
  6. end
  7.  
  8. fonts = {
  9.     -- Master font typeface: Media reference (media.lua) or file path
  10.     masterfont = "Tahoma Regular",
  11.     -- Ignored fonts
  12.     exceptions = {
  13.         "UFFontSmall", -- oUF_Hank
  14.         "UFFontMedium",
  15.         "UFFontBig",
  16.     },
  17.     -- Specific font overrides (typeface, size, flags)
  18.     -- Set a parameter to nil to retain the default value.
  19.     --   Typeface: Media reference or file path
  20.     --   Flags: "MONOCHROME", "OUTLINE", "THICKOUTLINE"
  21.     overrides = setmetatable({
  22.         AchievementCriteriaFont = {nil, 10, ""},
  23.     }, {
  24.         -- Whenever a font is added to the collection immediately apply it
  25.         __newindex = function(tbl, key, val)
  26.             local font, size, flags = unpack(val)
  27.             rawset(tbl, key, val)
  28.             if not _G[key] then CreateFont(key) end
  29.             SetFont(_G[key], font or fonts.masterfont, size or 12, flags)
  30.         end
  31.     })
  32. }
  33.  
  34. AddCallback("PLAYER_LOGIN", function()
  35.     for _, v in pairs(_G) do
  36.         if type(v) == "table" then
  37.             local meta = getmetatable(v)
  38.             if meta and meta.__index and type(meta.__index) == "table" and meta.__index.GetFont and v:GetObjectType() == "Font" then
  39.                 if not tContains(fonts.exceptions, v:GetName()) then
  40.                     SetFont(v, unpack((fonts.overrides[v:GetName()] or {fonts.masterfont, nil, nil})))
  41.                 end
  42.             end
  43.         end
  44.     end
  45. end)
  46.  
  47. -- *****************************************************
  48. -- ** Some special fonts. Size and flags are fixed
  49. -- *****************************************************
  50. CallAfter("hankui", function()
  51.     -- Overhead font (no nameplate shown)
  52.     _G.UNIT_NAME_FONT = media.font["DIN 1451 Engschrift"]
  53.     -- Floating combat text font
  54.     _G.DAMAGE_TEXT_FONT = media.font["DIN 1451 Engschrift"]
  55.     -- Chat bubbles
  56.     _G.NAMEPLATE_FONT = media.font["Tahoma Regular"]
  57.     -- Unused / obsolete (?)
  58.     _G.STANDARD_TEXT_FONT = STANDARD_TEXT_FONT
  59. end)

You'd need to replace media.font[...] references (name / filepath pairs) and AddCallback with your own PLAYER_LOGIN event handler.

Last edited by hankthetank : 02-27-11 at 10:30 AM.
  Reply With Quote
02-27-11, 08:54 AM   #9
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
I've wrestled with the same issue as the OP. The FontObjects used in some of the Quest Log & Acheivements pane text (GameFontBlack, SystemFont_Small, QuestFont) will respond to all of the SetFont arguments, but do not respond to SetTextColor. This results in the unhappy, and mostly illegible, dark text with dark outline.

To my understanding, SetTextColor doesn't override anything; it only affects text not being colored by something else. I've being poking around the FrameXML files for what might be coloring SystemFont_Small text dark brown.

My workaround in the meantime is to remove the outline flag from the dark colored FontObjects. I use the method sacrife posted above, from Tukui, which lets you use different settings per object:

Lua Code:
  1. -- author: Tukz
  2.  
  3. local eventframe = CreateFrame("Frame", nil, UIParent)
  4.    
  5. local SetFont = function(obj, font, size, style, r, g, b, sr, sg, sb, sox, soy)
  6.     obj:SetFont(font, size, style)
  7.     if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
  8.     if sox and soy then obj:SetShadowOffset(sox, soy) end
  9.     obj:SetShadowOffset(1,-2)
  10.     obj:SetShadowColor(0, 0, 0, .4)
  11.     if r and g and b then obj:SetTextColor(r, g, b)
  12.     elseif r then obj:SetAlpha(r) end
  13. end
  14.  
  15. eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
  16. eventframe:SetScript("OnEvent", function(self, event, addon)
  17.    
  18.     local NORMAL     = "Fonts\\ARIALN.ttf"
  19.     local COMBAT     = "Fonts\\ARIALN.ttf"
  20.     local NUMBER     = "Fonts\\ARIALN.ttf"
  21.     local fSize      = 14
  22.  
  23.     UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 8
  24.     CHAT_FONT_HEIGHTS = {8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20}
  25.  
  26.     UNIT_NAME_FONT     = NORMAL
  27.     NAMEPLATE_FONT     = NORMAL
  28.     DAMAGE_TEXT_FONT   = COMBAT
  29.     STANDARD_TEXT_FONT = NORMAL
  30.  
  31.     -- Base fonts
  32.     SetFont(GameFontBlack,                      NORMAL, fSize, "", 1, 0, 0, 1, 0, 0, 0, 0, 0);
  33.     SetFont(GameFontHighlight,                  NORMAL, fSize, "THINOUTLINE", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  34.     SetFont(GameTooltipHeader,                  NORMAL, fSize, "THINOUTLINE")
  35.     SetFont(NumberFont_OutlineThick_Mono_Small, NUMBER, fSize, "THINOUTLINE")
  36.     SetFont(NumberFont_Outline_Huge,            NUMBER, 28, "THINOUTLINE", 28)
  37.     SetFont(NumberFont_Outline_Large,           NUMBER, fSize+3, "THINOUTLINE")
  38.     SetFont(NumberFont_Outline_Med,             NUMBER, fSize, "THINOUTLINE")
  39.     SetFont(NumberFont_Shadow_Med,              NORMAL, fSize, "THINOUTLINE")
  40.     SetFont(NumberFont_Shadow_Small,            NORMAL, fSize, "THINOUTLINE")
  41.     SetFont(QuestFont,                          NORMAL, fSize+2, "", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  42.     SetFont(QuestFont_Large,                    NORMAL, fSize+2, "THINOUTLINE", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  43.     SetFont(SystemFont_Large,                   NORMAL, fSize+2, "THINOUTLINE")
  44.     SetFont(SystemFont_Med1,                    NORMAL, fSize-1, "THINOUTLINE")
  45.     SetFont(SystemFont_Med3,                    NORMAL, fSize-1, "THINOUTLINE")
  46.     SetFont(SystemFont_OutlineThick_Huge2,      NORMAL, fSize+7, "THICKOUTLINE")
  47.     SetFont(SystemFont_Outline_Small,           NUMBER, fSize, "THINOUTLINE")
  48.     SetFont(SystemFont_Shadow_Large,            NORMAL, fSize+2, "THINOUTLINE")
  49.     SetFont(SystemFont_Shadow_Med1,             NORMAL, fSize, "THINOUTLINE")
  50.     SetFont(SystemFont_Shadow_Med3,             NORMAL, fSize, "THINOUTLINE")
  51.     SetFont(SystemFont_Shadow_Outline_Huge2,    NORMAL, fSize+7, "THINOUTLINE")
  52.     SetFont(SystemFont_Shadow_Small,            NORMAL, fSize, "THINOUTLINE")
  53.     SetFont(SystemFont_Small,                   NORMAL, fSize, "", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  54.     SetFont(SystemFont_Tiny,                    NORMAL, fSize, "THINOUTLINE")
  55.     SetFont(Tooltip_Med,                        NORMAL, fSize, "THINOUTLINE")
  56.     SetFont(Tooltip_Small,                      NORMAL, fSize, "THINOUTLINE")
  57.     SetFont(CombatTextFont,                     COMBAT, 25, "THINOUTLINE")
  58.     SetFont(SystemFont_Shadow_Huge1,            NORMAL, 20, "THINOUTLINE")
  59.     SetFont(ZoneTextString,                     NORMAL, 32, "THINOUTLINE")
  60.     SetFont(SubZoneTextString,                  NORMAL, 25, "THINOUTLINE")
  61.     SetFont(PVPInfoTextString,                  NORMAL, 22, "THINOUTLINE")
  62.     SetFont(PVPArenaTextString,                 NORMAL, 22, "THINOUTLINE")
  63.     SetFont(ChatFrame1,                         NORMAL, fSize, "THINOUTLINE")  
  64.  
  65.     SetFont = nil
  66.     self:SetScript("OnEvent", nil)
  67.     self:UnregisterAllEvents()
  68.     self = nil
  69. end)

BTW, are "OUTLINE" & "THINOUTLINE" the same thing, and if so have they always been?
  Reply With Quote
02-27-11, 09:45 AM   #10
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Aprikot View Post
I've wrestled with the same issue as the OP. The FontObjects used in some of the Quest Log & Acheivements pane text (GameFontBlack, SystemFont_Small, QuestFont) will respond to all of the SetFont arguments, but do not respond to SetTextColor. This results in the unhappy, and mostly illegible, dark text with dark outline.

To my understanding, SetTextColor doesn't override anything; it only affects text not being colored by something else. I've being poking around the FrameXML files for what might be coloring SystemFont_Small text dark brown.

My workaround in the meantime is to remove the outline flag from the dark colored FontObjects. I use the method sacrife posted above, from Tukui, which lets you use different settings per object:

Lua Code:
  1. -- author: Tukz
  2.  
  3. local eventframe = CreateFrame("Frame", nil, UIParent)
  4.    
  5. local SetFont = function(obj, font, size, style, r, g, b, sr, sg, sb, sox, soy)
  6.     obj:SetFont(font, size, style)
  7.     if sr and sg and sb then obj:SetShadowColor(sr, sg, sb) end
  8.     if sox and soy then obj:SetShadowOffset(sox, soy) end
  9.     obj:SetShadowOffset(1,-2)
  10.     obj:SetShadowColor(0, 0, 0, .4)
  11.     if r and g and b then obj:SetTextColor(r, g, b)
  12.     elseif r then obj:SetAlpha(r) end
  13. end
  14.  
  15. eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
  16. eventframe:SetScript("OnEvent", function(self, event, addon)
  17.    
  18.     local NORMAL     = "Fonts\\ARIALN.ttf"
  19.     local COMBAT     = "Fonts\\ARIALN.ttf"
  20.     local NUMBER     = "Fonts\\ARIALN.ttf"
  21.     local fSize      = 14
  22.  
  23.     UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 8
  24.     CHAT_FONT_HEIGHTS = {8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20}
  25.  
  26.     UNIT_NAME_FONT     = NORMAL
  27.     NAMEPLATE_FONT     = NORMAL
  28.     DAMAGE_TEXT_FONT   = COMBAT
  29.     STANDARD_TEXT_FONT = NORMAL
  30.  
  31.     -- Base fonts
  32.     SetFont(GameFontBlack,                      NORMAL, fSize, "", 1, 0, 0, 1, 0, 0, 0, 0, 0);
  33.     SetFont(GameFontHighlight,                  NORMAL, fSize, "THINOUTLINE", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  34.     SetFont(GameTooltipHeader,                  NORMAL, fSize, "THINOUTLINE")
  35.     SetFont(NumberFont_OutlineThick_Mono_Small, NUMBER, fSize, "THINOUTLINE")
  36.     SetFont(NumberFont_Outline_Huge,            NUMBER, 28, "THINOUTLINE", 28)
  37.     SetFont(NumberFont_Outline_Large,           NUMBER, fSize+3, "THINOUTLINE")
  38.     SetFont(NumberFont_Outline_Med,             NUMBER, fSize, "THINOUTLINE")
  39.     SetFont(NumberFont_Shadow_Med,              NORMAL, fSize, "THINOUTLINE")
  40.     SetFont(NumberFont_Shadow_Small,            NORMAL, fSize, "THINOUTLINE")
  41.     SetFont(QuestFont,                          NORMAL, fSize+2, "", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  42.     SetFont(QuestFont_Large,                    NORMAL, fSize+2, "THINOUTLINE", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  43.     SetFont(SystemFont_Large,                   NORMAL, fSize+2, "THINOUTLINE")
  44.     SetFont(SystemFont_Med1,                    NORMAL, fSize-1, "THINOUTLINE")
  45.     SetFont(SystemFont_Med3,                    NORMAL, fSize-1, "THINOUTLINE")
  46.     SetFont(SystemFont_OutlineThick_Huge2,      NORMAL, fSize+7, "THICKOUTLINE")
  47.     SetFont(SystemFont_Outline_Small,           NUMBER, fSize, "THINOUTLINE")
  48.     SetFont(SystemFont_Shadow_Large,            NORMAL, fSize+2, "THINOUTLINE")
  49.     SetFont(SystemFont_Shadow_Med1,             NORMAL, fSize, "THINOUTLINE")
  50.     SetFont(SystemFont_Shadow_Med3,             NORMAL, fSize, "THINOUTLINE")
  51.     SetFont(SystemFont_Shadow_Outline_Huge2,    NORMAL, fSize+7, "THINOUTLINE")
  52.     SetFont(SystemFont_Shadow_Small,            NORMAL, fSize, "THINOUTLINE")
  53.     SetFont(SystemFont_Small,                   NORMAL, fSize, "", 1, 1, 1, 1, 0, 0, 0, 0, 0)
  54.     SetFont(SystemFont_Tiny,                    NORMAL, fSize, "THINOUTLINE")
  55.     SetFont(Tooltip_Med,                        NORMAL, fSize, "THINOUTLINE")
  56.     SetFont(Tooltip_Small,                      NORMAL, fSize, "THINOUTLINE")
  57.     SetFont(CombatTextFont,                     COMBAT, 25, "THINOUTLINE")
  58.     SetFont(SystemFont_Shadow_Huge1,            NORMAL, 20, "THINOUTLINE")
  59.     SetFont(ZoneTextString,                     NORMAL, 32, "THINOUTLINE")
  60.     SetFont(SubZoneTextString,                  NORMAL, 25, "THINOUTLINE")
  61.     SetFont(PVPInfoTextString,                  NORMAL, 22, "THINOUTLINE")
  62.     SetFont(PVPArenaTextString,                 NORMAL, 22, "THINOUTLINE")
  63.     SetFont(ChatFrame1,                         NORMAL, fSize, "THINOUTLINE")  
  64.  
  65.     SetFont = nil
  66.     self:SetScript("OnEvent", nil)
  67.     self:UnregisterAllEvents()
  68.     self = nil
  69. end)

BTW, are "OUTLINE" & "THINOUTLINE" the same thing, and if so have they always been?
Didn't work that well

@ hank haven't tried it yet, so ^^
  Reply With Quote
02-27-11, 10:14 AM   #11
hankthetank
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2009
Posts: 64
If a FontString inherits from a font set by SetFontObject() and overrides, say the color via SetFontColor() I'm pretty sure that your changes to the FontObject's color won't affect the FontString. Maybe that's the reason or the FontString uses inline color codes (|c.....|r)

Last edited by hankthetank : 02-27-11 at 10:25 AM.
  Reply With Quote
02-27-11, 10:23 AM   #12
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Originally Posted by Game92 View Post
Didn't work that well
What didn't work?
  Reply With Quote
02-27-11, 10:49 AM   #13
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Aprikot View Post
What didn't work?
The code, didnt work.
  Reply With Quote
02-27-11, 10:54 AM   #14
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
The code does work. Not sure what you're talking about.
  Reply With Quote
02-27-11, 11:09 AM   #15
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Aprikot View Post
The code does work. Not sure what you're talking about.
Nop, it didnt :<
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_022711_180743.jpg
Views:	673
Size:	1.96 MB
ID:	5803  
  Reply With Quote
02-27-11, 12:06 PM   #16
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
If you mean recolor doesn't work, I know. As I said these FontObjects don't appear to respond SetTextColor.

In your case the quest text color is yellow, and appears to be a lesser strata than its parent window. Is the addon that retextures the window also coloring the text?

Here's mine w/code I posted:
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_022711_105355.jpg
Views:	666
Size:	538.8 KB
ID:	5804  
  Reply With Quote
02-27-11, 01:52 PM   #17
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
It appears the text is set up for "Parchment" material by default and makes a call to GetMaterialTextColors() to get new colors if a different material is to be used.

Here are the related XML objects and Lua code you should look at for making that specific modification.



QuestInfo.xml:282
xml Code:
  1. <Frame name="QuestInfoFrame" hidden="true">
  2.     <Size>
  3.         <AbsDimension x="300" y="100"/>
  4.     </Size>
  5.     <Layers>
  6.         <Layer level="BACKGROUND">
  7.             <FontString name="QuestInfoTitleHeader" inherits="QuestTitleFont" justifyH="LEFT" text="Quest title">
  8.                 <Size>
  9.                     <AbsDimension x="285" y="0"/>
  10.                 </Size>
  11.             </FontString>
  12.             <FontString name="QuestInfoObjectivesText" inherits="QuestFont" justifyH="LEFT">
  13.                 <Size>
  14.                     <AbsDimension x="285" y="0"/>
  15.                 </Size>
  16.             </FontString>
  17.             <FontString name="QuestInfoRewardText" inherits="QuestFont" justifyH="LEFT">
  18.                 <Size>
  19.                     <AbsDimension x="285" y="0"/>
  20.                 </Size>
  21.             </FontString>
  22.             <FontString name="QuestInfoRequiredMoneyText" inherits="QuestFontNormalSmall" text="REQUIRED_MONEY" />
  23.             <FontString name="QuestInfoGroupSize" inherits="QuestFont" />
  24.             <FontString name="QuestInfoAnchor" inherits="QuestFont" />
  25.             <FontString name="QuestInfoDescriptionHeader" inherits="QuestTitleFont" justifyH="LEFT" text="QUEST_DESCRIPTION">
  26.                 <Size>
  27.                     <AbsDimension x="285" y="0"/>
  28.                 </Size>
  29.             </FontString>
  30.             <FontString name="QuestInfoObjectivesHeader" inherits="QuestTitleFont" text="QUEST_OBJECTIVES"  justifyH="LEFT">
  31.                 <Size>
  32.                     <AbsDimension x="285" y="0"/>
  33.                 </Size>
  34.             </FontString>
  35.             <FontString name="QuestInfoDescriptionText" inherits="QuestFont" justifyH="LEFT">
  36.                 <Size>
  37.                     <AbsDimension x="285" y="0"/>
  38.                 </Size>
  39.             </FontString>
  40.         </Layer>
  41.     </Layers>
  42.     <Frames>
  43.         <Frame name="QuestInfoFadingFrame">                            
  44.             <Size>
  45.                 <AbsDimension x="1" y="1"/>
  46.             </Size>
  47.             <Scripts>
  48.                 <OnUpdate function="QuestInfoFadingFrame_OnUpdate"/>
  49.             </Scripts>
  50.         </Frame>
  51.         <Frame name="QuestInfoSpacerFrame">
  52.             <Size>
  53.                 <AbsDimension x="5" y="5"/>
  54.             </Size>
  55.         </Frame>           
  56.     </Frames>
  57.     <Scripts>
  58.         <OnLoad>
  59.             self.material = "Parchment";
  60.         </OnLoad>
  61.     </Scripts>
  62. </Frame>



QuestInfo.lua:29
lua Code:
  1. function QuestInfo_Display(template, parentFrame, acceptButton, material)
  2.     local lastFrame, shownFrame, bottomShownFrame; 
  3.     local elementsTable = template.elements;
  4.     local bottomShownFrame;
  5.    
  6.     QuestInfoFrame.questLog = template.questLog;
  7.     QuestInfoFrame.chooseItems = template.chooseItems;
  8.     QuestInfoFrame.tooltip = template.tooltip; 
  9.     QuestInfoFrame.acceptButton = acceptButton;
  10.    
  11.     if ( QuestInfoFrame.material ~= material ) then
  12.         QuestInfoFrame.material = material;
  13.         local textColor, titleTextColor = GetMaterialTextColors(material); 
  14.         -- headers
  15.         QuestInfoTitleHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  16.         QuestInfoDescriptionHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  17.         QuestInfoObjectivesHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  18.         QuestInfoRewardsHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  19.         -- other text
  20.         QuestInfoDescriptionText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  21.         QuestInfoObjectivesText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  22.         QuestInfoGroupSize:SetTextColor(textColor[1], textColor[2], textColor[3]);
  23.         QuestInfoRewardText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  24.         -- reward frame text
  25.         QuestInfoItemChooseText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  26.         QuestInfoItemReceiveText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  27.         QuestInfoSpellLearnText:SetTextColor(textColor[1], textColor[2], textColor[3]);    
  28.         QuestInfoXPFrameReceiveText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  29.     end
  30.    
  31.     for i = 1, #elementsTable, 3 do
  32.         shownFrame, bottomShownFrame = elementsTable[i]();
  33.         if ( shownFrame ) then
  34.             shownFrame:SetParent(parentFrame);
  35.             if ( lastFrame ) then
  36.                 shownFrame:SetPoint("TOPLEFT", lastFrame, "BOTTOMLEFT", elementsTable[i+1], elementsTable[i+2]);
  37.             else
  38.                 shownFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", elementsTable[i+1], elementsTable[i+2]);        
  39.             end
  40.             lastFrame = bottomShownFrame or shownFrame;
  41.         end
  42.     end
  43. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
02-27-11, 04:07 PM   #18
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by SDPhantom View Post
It appears the text is set up for "Parchment" material by default and makes a call to GetMaterialTextColors() to get new colors if a different material is to be used.

Here are the related XML objects and Lua code you should look at for making that specific modification.



QuestInfo.xml:282
xml Code:
  1. <Frame name="QuestInfoFrame" hidden="true">
  2.     <Size>
  3.         <AbsDimension x="300" y="100"/>
  4.     </Size>
  5.     <Layers>
  6.         <Layer level="BACKGROUND">
  7.             <FontString name="QuestInfoTitleHeader" inherits="QuestTitleFont" justifyH="LEFT" text="Quest title">
  8.                 <Size>
  9.                     <AbsDimension x="285" y="0"/>
  10.                 </Size>
  11.             </FontString>
  12.             <FontString name="QuestInfoObjectivesText" inherits="QuestFont" justifyH="LEFT">
  13.                 <Size>
  14.                     <AbsDimension x="285" y="0"/>
  15.                 </Size>
  16.             </FontString>
  17.             <FontString name="QuestInfoRewardText" inherits="QuestFont" justifyH="LEFT">
  18.                 <Size>
  19.                     <AbsDimension x="285" y="0"/>
  20.                 </Size>
  21.             </FontString>
  22.             <FontString name="QuestInfoRequiredMoneyText" inherits="QuestFontNormalSmall" text="REQUIRED_MONEY" />
  23.             <FontString name="QuestInfoGroupSize" inherits="QuestFont" />
  24.             <FontString name="QuestInfoAnchor" inherits="QuestFont" />
  25.             <FontString name="QuestInfoDescriptionHeader" inherits="QuestTitleFont" justifyH="LEFT" text="QUEST_DESCRIPTION">
  26.                 <Size>
  27.                     <AbsDimension x="285" y="0"/>
  28.                 </Size>
  29.             </FontString>
  30.             <FontString name="QuestInfoObjectivesHeader" inherits="QuestTitleFont" text="QUEST_OBJECTIVES"  justifyH="LEFT">
  31.                 <Size>
  32.                     <AbsDimension x="285" y="0"/>
  33.                 </Size>
  34.             </FontString>
  35.             <FontString name="QuestInfoDescriptionText" inherits="QuestFont" justifyH="LEFT">
  36.                 <Size>
  37.                     <AbsDimension x="285" y="0"/>
  38.                 </Size>
  39.             </FontString>
  40.         </Layer>
  41.     </Layers>
  42.     <Frames>
  43.         <Frame name="QuestInfoFadingFrame">                            
  44.             <Size>
  45.                 <AbsDimension x="1" y="1"/>
  46.             </Size>
  47.             <Scripts>
  48.                 <OnUpdate function="QuestInfoFadingFrame_OnUpdate"/>
  49.             </Scripts>
  50.         </Frame>
  51.         <Frame name="QuestInfoSpacerFrame">
  52.             <Size>
  53.                 <AbsDimension x="5" y="5"/>
  54.             </Size>
  55.         </Frame>           
  56.     </Frames>
  57.     <Scripts>
  58.         <OnLoad>
  59.             self.material = "Parchment";
  60.         </OnLoad>
  61.     </Scripts>
  62. </Frame>



QuestInfo.lua:29
lua Code:
  1. function QuestInfo_Display(template, parentFrame, acceptButton, material)
  2.     local lastFrame, shownFrame, bottomShownFrame; 
  3.     local elementsTable = template.elements;
  4.     local bottomShownFrame;
  5.    
  6.     QuestInfoFrame.questLog = template.questLog;
  7.     QuestInfoFrame.chooseItems = template.chooseItems;
  8.     QuestInfoFrame.tooltip = template.tooltip; 
  9.     QuestInfoFrame.acceptButton = acceptButton;
  10.    
  11.     if ( QuestInfoFrame.material ~= material ) then
  12.         QuestInfoFrame.material = material;
  13.         local textColor, titleTextColor = GetMaterialTextColors(material); 
  14.         -- headers
  15.         QuestInfoTitleHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  16.         QuestInfoDescriptionHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  17.         QuestInfoObjectivesHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  18.         QuestInfoRewardsHeader:SetTextColor(titleTextColor[1], titleTextColor[2], titleTextColor[3]);
  19.         -- other text
  20.         QuestInfoDescriptionText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  21.         QuestInfoObjectivesText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  22.         QuestInfoGroupSize:SetTextColor(textColor[1], textColor[2], textColor[3]);
  23.         QuestInfoRewardText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  24.         -- reward frame text
  25.         QuestInfoItemChooseText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  26.         QuestInfoItemReceiveText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  27.         QuestInfoSpellLearnText:SetTextColor(textColor[1], textColor[2], textColor[3]);    
  28.         QuestInfoXPFrameReceiveText:SetTextColor(textColor[1], textColor[2], textColor[3]);
  29.     end
  30.    
  31.     for i = 1, #elementsTable, 3 do
  32.         shownFrame, bottomShownFrame = elementsTable[i]();
  33.         if ( shownFrame ) then
  34.             shownFrame:SetParent(parentFrame);
  35.             if ( lastFrame ) then
  36.                 shownFrame:SetPoint("TOPLEFT", lastFrame, "BOTTOMLEFT", elementsTable[i+1], elementsTable[i+2]);
  37.             else
  38.                 shownFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", elementsTable[i+1], elementsTable[i+2]);        
  39.             end
  40.             lastFrame = bottomShownFrame or shownFrame;
  41.         end
  42.     end
  43. end
Thanks,

local QuestInfo_Display = function(template, parentFrame, acceptButton, material)

QuestInfoDescriptionText:SetTextColor(1, 1, 1)
QuestInfoObjectivesText:SetTextColor(1, 1, 1)
QuestInfoGroupSize:SetTextColor(1, 1, 1)
QuestInfoRewardText:SetTextColor(1, 1, 1)

QuestInfoTitleHeader:SetTextColor(0.95, 0.95, 0)
QuestInfoDescriptionHeader:SetTextColor(0.95, 0.95, 0)
QuestInfoObjectivesHeader:SetTextColor(0.95, 0.95, 0)
QuestInfoRewardsHeader:SetTextColor(0.95, 0.95, 0)

QuestInfoItemChooseText:SetTextColor(1, 1, 1)
QuestInfoItemReceiveText:SetTextColor(1, 1, 1)
QuestInfoSpellLearnText:SetTextColor(1, 1, 1)
QuestInfoXPFrameReceiveText:SetTextColor(1, 1, 1)

end
hooksecurefunc('QuestInfo_Display', QuestInfo_Display) worked perfect.
  Reply With Quote
02-27-11, 05:54 PM   #19
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
I tried it too and it works! I wonder if other font colors are set with a secure function?

@hankthetank: your font object "getter" is awesome...had no idea it could be done that way. I haven't used it yet to set my fonts, but was able to pull a huge list of font objects with:

lua Code:
  1. for i, v in pairs(_G) do
  2.     if type(v) == "table" then
  3.         local meta = getmetatable(v)
  4.         if meta and meta.__index and type(meta.__index) == "table" and meta.__index.GetFont and v:GetObjectType() == "Font" then
  5.             print(i, v)
  6.         end
  7.     end
  8. end

ty!
  Reply With Quote
02-27-11, 08:44 PM   #20
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Nothing indicates that it's secure code. You should be able to just replace if you want to.

Perhaps just set the text color the way you want it and recode the function so it doesn't bother with it, something like this

lua Code:
  1. -- Set once and forget it
  2. QuestInfoDescriptionText:SetTextColor(1, 1, 1)
  3. QuestInfoObjectivesText:SetTextColor(1, 1, 1)
  4. QuestInfoGroupSize:SetTextColor(1, 1, 1)
  5. QuestInfoRewardText:SetTextColor(1, 1, 1)
  6.  
  7. QuestInfoTitleHeader:SetTextColor(0.95, 0.95, 0)
  8. QuestInfoDescriptionHeader:SetTextColor(0.95, 0.95, 0)
  9. QuestInfoObjectivesHeader:SetTextColor(0.95, 0.95, 0)
  10. QuestInfoRewardsHeader:SetTextColor(0.95, 0.95, 0)
  11.  
  12. QuestInfoItemChooseText:SetTextColor(1, 1, 1)
  13. QuestInfoItemReceiveText:SetTextColor(1, 1, 1)
  14. QuestInfoSpellLearnText:SetTextColor(1, 1, 1)
  15. QuestInfoXPFrameReceiveText:SetTextColor(1, 1, 1)
  16.  
  17. -- Replace existing UI function
  18. function QuestInfo_Display(template, parentFrame, acceptButton, material)
  19.     local lastFrame, shownFrame, bottomShownFrame; 
  20.     local elementsTable = template.elements;
  21.     local bottomShownFrame;
  22.    
  23.     QuestInfoFrame.questLog = template.questLog;
  24.     QuestInfoFrame.chooseItems = template.chooseItems;
  25.     QuestInfoFrame.tooltip = template.tooltip; 
  26.     QuestInfoFrame.acceptButton = acceptButton;
  27.  
  28.     for i = 1, #elementsTable, 3 do
  29.         shownFrame, bottomShownFrame = elementsTable[i]();
  30.         if ( shownFrame ) then
  31.             shownFrame:SetParent(parentFrame);
  32.             if ( lastFrame ) then
  33.                 shownFrame:SetPoint("TOPLEFT", lastFrame, "BOTTOMLEFT", elementsTable[i+1], elementsTable[i+2]);
  34.             else
  35.                 shownFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", elementsTable[i+1], elementsTable[i+2]);        
  36.             end
  37.             lastFrame = bottomShownFrame or shownFrame;
  38.         end
  39.     end
  40. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GameFontBlack

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