Thread Tools Display Modes
02-15-17, 08:17 PM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Changing Blizzard default fonts

Hi all,

The title says pretty much all.

With some in-built constants(?) like

DAMAGE_TEXT_FONT
UNIT_NAME_FONT
NAMEPLATE_FONT
STANDARD_TEXT_FONT

I know we can switch a Blizzard defaults fonts to others, but those four lists do not cover some frames like, QuestFrame, ChatFrame and so on.
(If I remember correctly, one of those four variables did not work when I tested it early last year.
Guess it was NAMEPLATE_FONT)

So, I've manually switched their fonts with :SetFont() function which I think is absolutely stupid(?).

e.g:
Lua Code:
  1. for i=1, 5 do
  2.     local f = _G["ChatFrame" .. i];
  3.  
  4.     if f then
  5.         f:SetFont(font, size, flags);
  6.     end
  7. end
Please note that reference to the frame might be wrong, but this is basically how I've done.


I'm asking this as I'm trying to avoid using Fonts folder which we can make on top path of WoW.

Would there be any simpler tricks to achieve this?

Thank you always!

Last edited by Layback_ : 02-15-17 at 08:32 PM.
  Reply With Quote
02-15-17, 09:58 PM   #2
Tosaido
A Fallenroot Satyr
 
Tosaido's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 23
It's best to tackle the font object itself, rather then each font frame.

this is code from an addon update i have yet to release. It contains, if i'm not mistaken, all the font objects in the game (they can be found in Interface/FrameXML/Fonts.xml and Interface/SharedXML/SharedFonts.xml)

Lua Code:
  1. local function Init_Fonts()
  2.     local newFont = "My custom font path"
  3.  
  4.     STANDARD_TEXT_FONT          = newFont
  5.     UNIT_NAME_FONT              = newFont
  6.     DAMAGE_TEXT_FONT            = newFont
  7.     NAMEPLATE_FONT              = newFont
  8.     NAMEPLATE_SPELLCAST_FONT    = newFont
  9.  
  10.     local ForcedFontSize = {10, 14, 20, 64, 64}
  11.  
  12.     local BlizFontObjects = {
  13.  
  14.         -- Fonts.xml
  15.  
  16.         -- These five fonts use the fixedSize argument, causing an incorrent font size return, so input our own sizes (ForcedFontSize)
  17.         SystemFont_NamePlateCastBar, SystemFont_NamePlateFixed, SystemFont_LargeNamePlateFixed, SystemFont_World, SystemFont_World_ThickOutline,
  18.  
  19.         SystemFont_Outline_Small, SystemFont_Outline, SystemFont_InverseShadow_Small, SystemFont_Med2, SystemFont_Med3, SystemFont_Shadow_Med3,
  20.         SystemFont_Huge1, SystemFont_Huge1_Outline, SystemFont_OutlineThick_Huge2, SystemFont_OutlineThick_Huge4, SystemFont_OutlineThick_WTF,
  21.         NumberFont_GameNormal, NumberFont_Shadow_Small, NumberFont_OutlineThick_Mono_Small, NumberFont_Shadow_Med, NumberFont_Normal_Med,
  22.         NumberFont_Outline_Med, NumberFont_Outline_Large, NumberFont_Outline_Huge, Fancy22Font, QuestFont_Huge, QuestFont_Outline_Huge,
  23.         QuestFont_Super_Huge, QuestFont_Super_Huge_Outline, SplashHeaderFont, Game11Font, Game12Font, Game13Font, Game13FontShadow,
  24.         Game15Font, Game18Font, Game20Font, Game24Font, Game27Font, Game30Font, Game32Font, Game36Font, Game48Font, Game48FontShadow,
  25.         Game60Font, Game72Font, Game11Font_o1, Game12Font_o1, Game13Font_o1, Game15Font_o1, QuestFont_Enormous, DestinyFontLarge,
  26.         CoreAbilityFont, DestinyFontHuge, QuestFont_Shadow_Small, MailFont_Large, SpellFont_Small, InvoiceFont_Med, InvoiceFont_Small,
  27.         Tooltip_Med, Tooltip_Small, AchievementFont_Small, ReputationDetailFont, FriendsFont_Normal, FriendsFont_Small, FriendsFont_Large,
  28.         FriendsFont_UserText, GameFont_Gigantic, ChatBubbleFont, Fancy16Font, Fancy18Font, Fancy20Font, Fancy24Font, Fancy27Font, Fancy30Font,
  29.         Fancy32Font, Fancy48Font, SystemFont_NamePlate, SystemFont_LargeNamePlate,
  30.  
  31.         -- SharedFonts.xml
  32.  
  33.         SystemFont_Tiny2, SystemFont_Tiny, SystemFont_Shadow_Small, SystemFont_Small, SystemFont_Small2, SystemFont_Shadow_Small2, SystemFont_Shadow_Med1_Outline,
  34.         SystemFont_Shadow_Med1, QuestFont_Large, SystemFont_Large, SystemFont_Shadow_Large_Outline, SystemFont_Shadow_Med2, SystemFont_Shadow_Large,
  35.         SystemFont_Shadow_Large2, SystemFont_Shadow_Huge1, SystemFont_Huge2, SystemFont_Shadow_Huge2, SystemFont_Shadow_Huge3, SystemFont_Shadow_Outline_Huge3,
  36.         SystemFont_Shadow_Outline_Huge2, SystemFont_Med1, SystemFont_WTF2, SystemFont_Outline_WTF2,
  37.         GameTooltipHeader, System_IME,
  38.     }
  39.  
  40.     for i, FontObject in pairs(BlizFontObjects) do
  41.         local _, oldSize, oldStyle  = FontObject:GetFont()
  42.         FontObject:SetFont(newFont, ForcedFontSize[i] or oldSize, oldStyle)
  43.     end
  44.  
  45.     BlizFontObjects = nil
  46. end
  Reply With Quote
02-15-17, 10:05 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You can also just manually override the font files by placing your desired font (renamed to the default file names) in a Fonts folder in the WoW directory.
__________________
"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-15-17, 10:10 PM   #4
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Hi Tosaido,

Thank you SO SO SO and SO MUCH!!!!!!!

God!!! That's exactly what I have been looking for!!
  Reply With Quote
02-15-17, 10:12 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by Seerah View Post
You can also just manually override the font files by placing your desired font (renamed to the default file names) in a Fonts folder in the WoW directory.
Hi Seerah,

Thank you for your reply!

Yeah, I am aware of that method as I have stated on my OP
(Sorry, if my words did not make sense )

But, I am willing to avoid that approach haha!
  Reply With Quote
02-16-17, 12:05 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Your OP did not give me any inclination that you knew what the manual override method is. There are 5 font files to replace. You can read about it here: http://vranx.com/font.htm
__________________
"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-16-17, 01:25 PM   #7
Kkthnx
A Cobalt Mageweaver
 
Kkthnx's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2011
Posts: 247
Originally Posted by Seerah View Post
Your OP did not give me any inclination that you knew what the manual override method is. There are 5 font files to replace. You can read about it here: http://vranx.com/font.htm
Originally Posted by Layback_ View Post
I'm asking this as I'm trying to avoid using Fonts folder which we can make on top path of WoW.
This is where he referred to it.
__________________
Success isn't what you've done compared to others. Success is what you've done compared to what you were made to do.
  Reply With Quote
02-16-17, 03:50 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Ah... Apparently I totally skipped over that.
__________________
"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-16-17, 04:48 PM   #9
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
haha! all good!!

Thanks again
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Changing Blizzard default fonts


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