I am trying to get my broker display to properly display multiple icons with text mixed in. Here is what I have tried:
|T<path>:<width>[:<height>:<xOffset>:<yOffset>]|t
First I tried leaving width=0 which should make the icon the same size as the text but the icons seem considerably smaller than the text. On the plus side they stay lined up nicely though and don't seem to "climb".
Next I tried adding custom icon size and x/y offsets which makes the icon size controllable and they look better (to me) but if I add more icons and text they "climb" Seems like the text is attaching to the upper right of the icons instead of the center.
Using the y offset I can get the text and icons to line up but then they are higher on the display mod than other text (using dockingstation) So is there any way to change that attachment point or am I missing something?
Here is my function to update the broker text object:
function mod:UpdateBrokerText()
local icons
local text = ""
for _, itemid in ipairs(db.sortedtext) do
if ItemInfo[itemid] then
local data = ItemInfo[itemid]
text = text .. "|T" .. data.icon
if db.customicon then text = text .. ":" .. db.texticonsize .. ":" .. db.texticonsize .. ":" .. db.iconx .. ":" .. db.icony .. "|t"
else text = text .. ":0|t" end
local color
if data.count < data.max then color = "|c00FFFF00"
else color = "|c0000FF00" end
text = text .. color .. data.count .. "|r"
icons = true
end
end
if icons then
mod.obj.text = text
else
mod.obj.text = ""
end
end
If you want absolute control of the placement of the icons, you need to have them on a separate frame or set the height of the icons to the height of the text frame you're adding the text to.
P.S. In my opinion, there's nothing wrong with the first one.
Below is an excerpt from Blizzard's FrameXML/LFGFrame.lua:
local tankIcon = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:%d:64:64:0:19:22:41|t";
local healerIcon = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:%d:64:64:20:39:1:20|t";
local damageIcon = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:%d:64:64:20:39:22:41|t";
--[[ ... ]]
--Horrible hack to deal with a bug in embedded font strings. FIXME
--The more icons with absolute sizes in a certain fontstring, the higher up the text goes. This offsets it to make the icons be in line with the text.
local numRoles = (isTank and 1 or 0) + (isHealer and 1 or 0) + (isDamage and 1 or 0);
local yOffset = 2*(numRoles-1)-2; --Formula derived through testing.
local tankIcon = format(tankIcon, yOffset);
local healerIcon = format(healerIcon, yOffset);
local damageIcon = format(damageIcon, yOffset);
This hack really is horrible: sure text and icons are lined up, but then it's the whole thing that "climb". Unusable with LDB... Unless we push the hack further: adding a "fontstringOffsetY" attribute or something that display addons would use to relocate the fontstring on the frame/button. :p
|T<path>:<width>[:<height>:<xOffset>:<yOffset>]|t
First I tried leaving width=0 which should make the icon the same size as the text but the icons seem considerably smaller than the text. On the plus side they stay lined up nicely though and don't seem to "climb".
Next I tried adding custom icon size and x/y offsets which makes the icon size controllable and they look better (to me) but if I add more icons and text they "climb" Seems like the text is attaching to the upper right of the icons instead of the center.
Using the y offset I can get the text and icons to line up but then they are higher on the display mod than other text (using dockingstation) So is there any way to change that attachment point or am I missing something?
Here is my function to update the broker text object:
P.S. In my opinion, there's nothing wrong with the first one.
It seems the hack is related to your issue.