WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Hotkey/stack text with bartender4 (https://www.wowinterface.com/forums/showthread.php?t=50419)

feraldrood 11-09-14 04:34 PM

Hotkey/stack text with bartender4
 
local nfns, font, size = NumberFontNormalSmall
font, size = NumberFontNormalSmall:GetFont()
nfns:SetFont("Fonts\\CharriotDeluxe.ttf", 8, "OUTLINE, MONOCHROME")
nfns:SetShadowColor(0, 0, 0, 0)

Using this code in every imaginable .lua file- even ones not pertaining to bartender (cleanhotkey)

Font for hot-key is still set to about size 10 and is not mono-chromed. The stack text isn't even the font I have specified let alone sizing. What am I doing wrong here?

If anyone is having any luck with monochrome/outline fonts for stack and hotkey in bartender, or any other addon
Tell me how you are doing it!!

also operating off of a freeui base, have messed with all the scripts in that, I was able to get the fonts rendered correctly when I enabled the bars. I am invested in keeping bartender however, so let me know if you have a fix for this.

MoonWitch 11-09-14 06:30 PM

If you look through FrameXML/ActionButtonTemplate.xml; you'll see
Hotkey text uses : NumberFontNormalSmallGray
Count text uses : NumberFontNormal
Macro name text uses: GameFontHighlightSmallOutline

If you then search the FrameXML/FontStyles.xml file, you'll find which fonts are inherited into those.

Hotkey -> NumberFontNormalSmallGray -> GameFontNormalSmall -> SystemFont_Shadow_Small ->Fonts\FRIZQT__.TTF
Count -> NumberFontNormal -> NumberFont_Outline_Med -> Fonts\ARIALN.TTF
Macro -> GameFontHighlightSmallOutline -> GameFontHighlightSmall -> GameFontNormalSmall -> SystemFont_Shadow_Small -> Fonts\FRIZQT__.TTF

Just wanted to comment on the long tracking list; this is insane, inherited on inherited and so on.

So what you do is:
Create an add-on with just a frame created that does this:
Lua Code:
  1. local frame = CreateFrame("Frame")
  2. frame:SetScript("OnEvent", function()
  3. SystemFont_Shadow_Small:SetFont("Fonts\\CharriotDeluxe.ttf", 8, "OUTLINE, MONOCHROME")
  4. NumberFont_Outline_Med:SetFont("Fonts\\CharriotDeluxe.ttf", 8, "OUTLINE, MONOCHROME")
  5. end)
  6.  
  7. frame:RegisterEvent("PLAYER_LOGIN")

This could help you.
http://addon.bool.no

Ps. Just quick half-asleep post, not even tested.

Phanx 11-09-14 06:43 PM

However, this likely will not affect Bartender's buttons, because it doesn't just inherit from a font object; it also explicitly sets a font:

Code:

        -- adjust hotkey style for better readability
        button.HotKey:SetFont(button.HotKey:GetFont(), 13, "OUTLINE")
        button.HotKey:SetVertexColor(0.75, 0.75, 0.75)

        -- adjust count/stack size
        button.Count:SetFont(button.Count:GetFont(), 16, "OUTLINE")

I use the following code to "fix" the fonts on Bartender buttons:

Code:

local LAB = LibStub("LibActionButton-1.0", true)
if LAB then
        -- Bartender4
        LAB.RegisterCallback("FixFonts", "OnButtonCreated", function(_, self)
                --print("OnButtonCreated", self:GetName())
                local scale = self:GetParent():GetScale()
                local hotkey = _G[self:GetName() .. "HotKey"]
                if hotkey then
                        local font, size = NumberFontNormal:GetFont()
                        hotkey:SetFont(font, size / scale, "OUTLINE")
                end
                local count = _G[self:GetName() .. "Count"]
                if count then
                        local font, size = NumberFontNormal:GetFont()
                        count:SetFont(font, size / scale, "OUTLINE")
                end
                local macro = _G[self:GetName() .. "Name"]
                if macro then
                        local font, size = GameFontHighlight:GetFont()
                        macro:SetFont(font, size / scale, "OUTLINE")
                end
        end)
end

My primary aim is to scale down the fonts, because I've scaled up my buttons a lot, but you could easily adjust the SetFont lines to do whatever you want.

MoonWitch 11-09-14 07:07 PM

Quote:

Originally Posted by Phanx (Post 300033)
However, this likely will not affect Bartender's buttons, because it doesn't just inherit from a font object; it also explicitly sets a font:

[[snipp]]

My primary aim is to scale down the fonts, because I've scaled up my buttons a lot, but you could easily adjust the SetFont lines to do whatever you want.

Thanks for correcting me :)

feraldrood 11-09-14 08:18 PM

Glorious!

thank you MoonWitch, and thanks for the revision Phanx, code is perfect.

Am such a noob with coding, the help is greatly appreciated.


All times are GMT -6. The time now is 12:17 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI