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.
Go into the Stuf folder, open core.lua and look for this..
Below it add 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")
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 Cyraxe; 2013-01-27 at 07:18 PM.
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
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.
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.
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
I believe the menu anchor is handled by Blizzard code, not StUF's code, but I could be wrong.
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
"PlayerFrame" is the name of the parent the dropdown menu will be anchored to.Code:player = "PlayerFrame", target = "TargetFrame", pet = "PetFrame", focus = "FocusFrame", party1 = "PartyMemberFrame1", party2 = "PartyMemberFrame2", party3 = "PartyMemberFrame3", party4 = "PartyMemberFrame4", }
Doing a search for 'dropdown' you will find this function on line 1291
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.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
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
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.
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.
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.
If I understand it correctly, you basically want the topleft of the menu to touch the bottomleft of the unit frame:
I added some fancy colouring that should somewhat explain the way the SetPoint() function works with anchoring.Code:DropDownList1:SetPoint("TOPLEFT", this, "BOTTOMLEFT", 0, 0 )
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?
turned into:Code:smed:Register("font", "Myriad Condensed Web", "PATH\\TO\\YOUR\\FONT.ttf")
If you're wondering, the web and the condensed is flipped because that's how the name is spelled on my PC.Code:smed:Register("font", "Myriad Web Condensed", "C:\\Windows\\Fonts\\myriadwebcondensed.ttf")
Not an expert, but copy your font into the addons folder and make the path to your font starting with Interface\Addons\addonfolder?
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.