Page 1 of 2
1
2
LastLast
  1. #1

    How to add fonts to addons?

    I'm trying to add the font "Myriad Condensed Web" to an addon, how is this done? If needed, the addon is Stuf Unit Frames. I want to use Myriad Condensed Web with the unit frames.
    Sig by Listrata

  2. #2
    High Overlord
    Join Date
    Mar 2008
    Location
    MD
    Posts
    108
    Go into the Stuf folder, open core.lua and look for this..

    Code:
    -- LibSharedMedia-3.0 register media files
    local smed = LibStub("LibSharedMedia-3.0")
    smed:Register("statusbar", "Flat Smooth", "Interface\\AddOns\\Stuf\\media\\flatsmooth.tga")
    smed:Register("statusbar", "Curved Bar", "Interface\\AddOns\\Stuf\\media\\curvedbar.tga")
    smed:Register("statusbar", "Steel", "Interface\\AddOns\\Stuf\\media\\Steel.tga")
    smed:Register("font", "Franklin Gothic Medium", "Interface\\AddOns\\Stuf\\media\\font1.ttf")
    smed:Register("border", "Square Outline", "Interface\\AddOns\\Stuf\\media\\squareline.tga")
    Below it add this..

    Code:
    smed:Register("font", "Myriad Condensed Web", "PATH\\TO\\YOUR\\FONT.ttf")

    Of course change PATH\\TO\\YOUR\\FONT.ttf to the path of the font you desire.
    Last edited by Cirax; 2013-01-27 at 07:18 PM.
    oUF_DHUD - Download - Old School Twin Dragon HUD!
    cTools - Download - Datatext | Chat Filter | Tank/Heal CD Announcer | BuffReminder | ++ More
    Carbide 500R | i5-4670k 3.4ghz | ASUS Z97-A | Gigabyte GTX780 | G.Skill Sniper 8gb 2133mhz | Crucial MX100 256gb | WD 2TB | be quiet! Dark Rock 3 | Antec 620w

  3. #3
    Thanks, one more thing, how do I change the anchor for the dropdown rightclick menu in stuf? It's opening on top of my player frame instead of on the bottom.
    Sig by Listrata

  4. #4
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    Also, that will enable the font for all addons that use LibSharedMedia-3.0 - which is most of the addons that actually give you the option to change fonts.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  5. #5
    High Overlord
    Join Date
    Mar 2008
    Location
    MD
    Posts
    108
    I don't use Stuf so I am unaware of the menu options. There's way too much to look through in the files not knowing what you're looking for.
    oUF_DHUD - Download - Old School Twin Dragon HUD!
    cTools - Download - Datatext | Chat Filter | Tank/Heal CD Announcer | BuffReminder | ++ More
    Carbide 500R | i5-4670k 3.4ghz | ASUS Z97-A | Gigabyte GTX780 | G.Skill Sniper 8gb 2133mhz | Crucial MX100 256gb | WD 2TB | be quiet! Dark Rock 3 | Antec 620w

  6. #6
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    I believe the menu anchor is handled by Blizzard code, not StUF's code, but I could be wrong.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  7. #7
    Quote Originally Posted by Taryble View Post
    I believe the menu anchor is handled by Blizzard code, not StUF's code, but I could be wrong.
    Darn, that sucks. My unitframes would've been perfect without this issue.
    Sig by Listrata

  8. #8
    High Overlord
    Join Date
    Mar 2008
    Location
    MD
    Posts
    108
    The default menu for units and what not is handled by Blizzard but you can override it and set it up how you want. If the questioning is about that menu then you'll need to direct your attention to core.lua.

    At line 67 you will find this
    Code:
    	player = "PlayerFrame", target = "TargetFrame", pet = "PetFrame", focus = "FocusFrame",
    	party1 = "PartyMemberFrame1", party2 = "PartyMemberFrame2", party3 = "PartyMemberFrame3", party4 = "PartyMemberFrame4",
    }
    "PlayerFrame" is the name of the parent the dropdown menu will be anchored to.

    Doing a search for 'dropdown' you will find this function on line 1291

    Code:
    local function MainPostClick(this, a1)
    	if a1 == "RightButton" and UIDROPDOWNMENU_OPEN_MENU == _G[dropdown[this.unit].."DropDown"] and DropDownList1:IsShown() then
    		DropDownList1:ClearAllPoints()
    		if (this:GetBottom() * (this.dbf.scale or 1)) < (GetScreenHeight() * 0.45) then
    			DropDownList1:SetPoint("BOTTOMLEFT", this, "TOPLEFT", 60, 0 )
    		else
    			DropDownList1:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 60, 0 )
    		end
    	end
    end
    To fiddle around with positioning you will want to alter BOTTOMLEFT/TOPLEFT, these are the anchors. All valid anchors would be BOTTOMLEFT/TOPLEFT/TOP/LEFT/RIGHT/CENTER/BOTTOMRIGHT/TOPRIGHT. The number 60 is the x-axis offset and the 0 is the y-axis offset. Adjust all of them to change the positioning for all the menus.
    oUF_DHUD - Download - Old School Twin Dragon HUD!
    cTools - Download - Datatext | Chat Filter | Tank/Heal CD Announcer | BuffReminder | ++ More
    Carbide 500R | i5-4670k 3.4ghz | ASUS Z97-A | Gigabyte GTX780 | G.Skill Sniper 8gb 2133mhz | Crucial MX100 256gb | WD 2TB | be quiet! Dark Rock 3 | Antec 620w

  9. #9
    Small problem: Got the dropdown for the playerframe working but now, for the target frame, this happens:

    http://gyazo.com/57253824e035a026b081dfb013018f74.

    If the tooltip is short (like the tooltip for a monster), it becomes short.I changed the coords to 60, -280, changed all anchors to BOTTOMLEFT.
    Last edited by ShadowTitan; 2013-01-28 at 01:32 AM.
    Sig by Listrata

  10. #10
    If you set the anchor to the bottomleft, your x and y values are telling to then move right 60 pixels and down 280 from the bottomleft. That could be the issue.
    Last edited by bOOURNS; 2013-01-28 at 12:11 AM.

  11. #11
    Quote Originally Posted by bOOURNS View Post
    If you set the anchor to the bottomleft, your x and y values are telling to then move right 60 pixels and down 280 from the bottomleft. That could be the issue.
    What should I set it to to match blizzard default? (Anchor)
    Last edited by ShadowTitan; 2013-01-28 at 01:32 AM.
    Sig by Listrata

  12. #12
    Well in your screenshot you can clearly see that the menu is 60 pixels to the right and 280 pixels down from the bottomleft anchor point that you've set. So obviously you need to change those numbers accordingly to where you want it to be from the bottomleft. I can't tell you exact numbers, that's for you to deside because I don't know where exactly you want it.

  13. #13
    If I understand it correctly, you basically want the topleft of the menu to touch the bottomleft of the unit frame:
    Code:
    DropDownList1:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, 0 )
    I added some fancy colouring that should somewhat explain the way the SetPoint() function works with anchoring.

  14. #14
    Quote Originally Posted by Sakpoth View Post
    If I understand it correctly, you basically want the topleft of the menu to touch the bottomleft of the unit frame:
    Code:
    DropDownList1:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, 0 )
    I added some fancy colouring that should somewhat explain the way the SetPoint() function works with anchoring.
    Worked like a friggin charm. Thanks man! Didn't even have to change coords, left them as default just changed the anchoring placement as you said.

    The fonts didn't end up working and I got an LUA error. Here is what I added to core.lua as the second poster instructed, did I do it wrong?

    Code:
    smed:Register("font", "Myriad Condensed Web", "PATH\\TO\\YOUR\\FONT.ttf")
    turned into:

    Code:
    smed:Register("font", "Myriad Web Condensed", "C:\\Windows\\Fonts\\myriadwebcondensed.ttf")
    If you're wondering, the web and the condensed is flipped because that's how the name is spelled on my PC.
    Sig by Listrata

  15. #15
    Brewmaster Gotai's Avatar
    Join Date
    Apr 2010
    Location
    Zaltbommel - Netherlands
    Posts
    1,361
    Not an expert, but copy your font into the addons folder and make the path to your font starting with Interface\Addons\addonfolder?

  16. #16
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    Quote Originally Posted by ShadowTitan View Post
    Worked like a friggin charm. Thanks man! Didn't even have to change coords, left them as default just changed the anchoring placement as you said.

    The fonts didn't end up working and I got an LUA error. Here is what I added to core.lua as the second poster instructed, did I do it wrong?

    Code:
    smed:Register("font", "Myriad Condensed Web", "PATH\\TO\\YOUR\\FONT.ttf")
    turned into:

    Code:
    smed:Register("font", "Myriad Web Condensed", "C:\\Windows\\Fonts\\myriadwebcondensed.ttf")
    If you're wondering, the web and the condensed is flipped because that's how the name is spelled on my PC.
    You have to copy the font file somewhere into the WoW Interface folder, and then use the path to it there instead - WoW can only load files that are in the WoW folder or subfolders.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  17. #17
    Quote Originally Posted by Gotai View Post
    Not an expert, but copy your font into the addons folder and make the path to your font starting with Interface\Addons\addonfolder?
    That didn't work either, the first time, the myriad shows up on the font list but it shows up looking like Arial, font doesn't switch, decided to reloadui and it gave me LUA error.
    Last edited by ShadowTitan; 2013-01-29 at 12:30 AM.
    Sig by Listrata

  18. #18
    Quote Originally Posted by ShadowTitan View Post
    That didn't work either, the first time, the myriad shows up on the font list but it shows up looking like Arial, font doesn't switch, decided to reloadui and it gave me LUA error.
    Is shows up in the list and looks like another font because you need to completely close wow and relaunch. WoW loads textures and fonts when launched, reloading UI doesn't. The lua error you got was more than likely because you told it to use the new font but when you reloaded UI it had no clue what the font actually is because it was never properly loaded.

  19. #19
    Quote Originally Posted by bOOURNS View Post
    Is shows up in the list and looks like another font because you need to completely close wow and relaunch. WoW loads textures and fonts when launched, reloading UI doesn't. The lua error you got was more than likely because you told it to use the new font but when you reloaded UI it had no clue what the font actually is because it was never properly loaded.
    Refuses to work :/.
    Sig by Listrata

  20. #20
    Quote Originally Posted by ShadowTitan View Post
    Refuses to work :/.
    Post where you have placed the font file and also post the line added in the lua that loads the font.

    It's pretty obvious you done one or both of those steps wrong.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •