Thread Tools Display Modes
12-10-09, 12:22 AM   #1
Blooblahguy
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 18
Font help

I've looked everywhere I can and have tried everything I know. This is my first oUF layout and i've been taking bits and pieces and writing bits and pieces.

Right now my issue is that when ever I try to set the font or change it I get the following error:

Code:
Message: Interface\AddOns\oUF\elements\tags.lua:417: <unnamed>:SetFormattedText(): Font not set
Time: 12/09/09 23:21:38
Count: 1
Stack: [C]: in function `SetFormattedText'
Interface\AddOns\oUF\elements\tags.lua:417: in function `UpdateTag'
Interface\AddOns\oUF\elements\tags.lua:287: in function `func'
Interface\AddOns\oUF\ouf.lua:316: in function <Interface\AddOns\oUF\ouf.lua:311>
(tail call): ?

Locals: (*temporary) = <unnamed> {
 parent = <unnamed> {
 }
 UpdateTag = <function> defined @Interface\AddOns\oUF\elements\tags.lua:409
 0 = <userdata>
}
(*temporary) = "%s | %s%%"
(*temporary) = "26.8k"
(*temporary) = 100

This is my layout:
Code:
local bartexture = 'Interface\\AddOns\\oUF_bloo\\media\\bartexture'
local bufftexture = 'Interface\\AddOns\\oUF_bloo\\media\\buff'
local fontlol = 'Interface\\AddOns\\oUF_bloo\\media\\font.ttf'

-- [[ Menu ]] --
local menu = function(self)
	local unit = self.unit:sub(1, -2)
	local cunit = self.unit:gsub('(.)', string.upper, 1)

	if(unit == 'party' or unit == 'partypet') then
		ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor', 0, 0)
	elseif(_G[cunit..'FrameDropDown']) then
		ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], "cursor", 0, 0)
	end
end

--[[ short hp value ]]--
local function shorthpval(value)
	if(value >= 1e6) then
		return string.format('%.1fm', value / 1e6)
	elseif(value >= 1e4) then
		return string.format('%.1fk', value / 1e3)
	elseif value >= 1e3 then
		return string.format('%.1fk', value / 1e3)
	else
		return value
	end
end

--[[ colors ]]--
oUF.colors.power["MANA"] = { 26/255, 139/255, 255/255 };
oUF.colors.power["RAGE"] = { 255/255, 26/255, 48/255 };
oUF.colors.power["FOCUS"] = { 255/255, 150/255, 26/255 };
oUF.colors.power["ENERGY"] = { 255/255, 225/255, 26/255 };
oUF.colors.power["HAPPINESS"] = { 0.00, 1.00, 1.00 };
oUF.colors.power["RUNES"] = { 0.50, 0.50, 0.50 };
oUF.colors.power["RUNIC_POWER"] = { 0.00, 0.82, 1.00 };
oUF.colors.power["AMMOSLOT"] = { 0.80, 0.60, 0.00 };
oUF.colors.power["FUEL"] = { 0.0, 0.55, 0.5 }; 

--[[ tags ]]--
oUF.Tags['[shortcurhp]'] = function(u) return shorthpval(UnitHealth(u)) end
oUF.TagEvents['[shortcurhp]'] = 'UNIT_HEALTH'

oUF.Tags['[shortcurpp]'] = function(u) return shorthpval(UnitPower(u)) end
oUF.TagEvents['[shortcurpp]'] = 'UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE'

--[[ aura icon skin ]]--
local auraIcon = function(self, button, icons)
	icons.showDebuffType = true
	
	button.icon:SetTexCoord(.07, .93, .07, .93)
	button.icon:SetPoint('TOPLEFT', button, 'TOPLEFT', 1, -1)
	button.icon:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -1, 1)
	
	button.overlay:SetTexture(bufftexture)
	button.overlay:SetTexCoord(0,1,0,1)
	button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end
	
	button.cd:SetReverse()
	button.cd:SetPoint('TOPLEFT', button, 'TOPLEFT', 2, -2) 
	button.cd:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2)     
end

--[[ castbar format ]]--
local lolCastBarTime = function(self, duration)
	if self.channeling then
		self.Time:SetFormattedText("%.1f|cff357EC7s|r", duration)
	elseif self.casting then
		self.Time:SetFormattedText("%.1f|cff357EC7s|r", self.max - duration)
	end
end

------------------------------------------------------------------------
--      Layout
------------------------------------------------------------------------
local function layout(self, unit)

	self.menu = menu
	self:RegisterForClicks('AnyDown')
	self:SetScript('OnEnter', UnitFrame_OnEnter)
	self:SetScript('OnLeave', UnitFrame_OnLeave)
	self:SetAttribute('*type2', 'menu')
    self:SetFormattedText(fontlol, 14)
  
-----------------------------------------------------------------------
--      Health / Power
-----------------------------------------------------------------------
    -- Health --
	self.Health = CreateFrame('StatusBar', nil, self)
	self.Health:SetStatusBarTexture(bartexture)
    
    self.Health:SetParent(self)
    self.Health:SetPoint'TOP'
	self.Health:SetPoint'LEFT'
	self.Health:SetPoint'RIGHT'
    
    local healthbg = self.Health:CreateTexture(nil, 'BORDER')
	healthbg:SetPoint('CENTER', self.Health, 'CENTER', 0, 0)
	healthbg:SetTexture(bartexture)
	healthbg:SetVertexColor(0.16,0.16,0.16,1)
    
	self.Health.colorClass = true
	self.Health.colorTapping = true
	self.Health.colorReaction = true
	self.Health.frequentUpdates = true

    -- Power --
	self.Power = CreateFrame('StatusBar', nil, self)
	self.Power:SetStatusBarTexture(bartexture)
	self.Power:SetHeight(3)
    self.Power:SetPoint("TOP", self.Health, "BOTTOM", 0, 29)
  
    
    local powerbg = self.Power:CreateTexture(nil, 'BORDER')
	powerbg:SetPoint('CENTER', self.Power, 'CENTER', 0, 0)
	powerbg:SetTexture(bartexture)
	powerbg:SetWidth(220)
	powerbg:SetHeight(3)
	powerbg:SetVertexColor(0.16,0.16,0.16,1)
    
    self.Power:SetParent(self)
	self.Power:SetPoint'LEFT'
	self.Power:SetPoint'RIGHT'

	self.Power.colorPower = true
	self.Power.frequentUpdates = true
    
    
-- [[ Backgrounds ]] --
    if unit=='player' then
	    self.Health:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}})
	    self.Health:SetBackdropColor(0, 0, 0, 1)
        
        self.Power:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -3, right = -3}})
	    self.Power:SetBackdropColor(0, 0, 0, 1)
    end
    
    if unit=='target' then
	    self.Health:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}})
	    self.Health:SetBackdropColor(0, 0, 0, 1)
        
        self.Power:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -3, right = -3}})
	    self.Power:SetBackdropColor(0, 0, 0, 1)
    end
    
    if unit=='targettarget' then
	    self.Health:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -3, left = -2, bottom = -2, right = -2}})
	    self.Health:SetBackdropColor(0, 0, 0, 1)
    end
    
    if unit=='focus' then
	    self.Health:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -3, left = -2, bottom = -2, right = -2}})
	    self.Health:SetBackdropColor(0, 0, 0, 1)
    end
    
    
-----------------------------------------------------------------------
--      Texts
-----------------------------------------------------------------------
-- [[ Health Text ]] --
	local curhealth = self.Health:CreateFontString(nil, 'OVERLAY')
    curhealth:SetFont(fontlol, 14)
    self:Tag(curhealth,'[shortcurhp] | [perhp]%')  
	self.curhealth = curhealth
    
-- [[ Power Text ]] --
	local curpower = self.Power:CreateFontString(nil, 'OVERLAY')
    curpower:SetFont(fontlol, 14)
	self:Tag(curpower,'[shortcurpp]')
    self.curpower = curpower
    
-- [[ Name Text ]] --
	local unitName = self.Health:CreateFontString(nil, 'OVERLAY')
    unitName:SetFont(fontlol, 14)
	self:Tag(unitnames,'[name]')
    self.unitName = unitName

--[[ raid icon ]]--
	self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
	self.RaidIcon:SetHeight(16)
	self.RaidIcon:SetWidth(16)
	self.RaidIcon:SetPoint('TOP', self, 0, 9)
	self.RaidIcon:SetTexture'Interface\\TargetingFrame\\UI-RaidTargetingIcons'

-----------------------------------------------------------------------
--      Buffs / Debuffs
-----------------------------------------------------------------------
    --[[ buffs ]]--
	self.Buffs = CreateFrame("Frame", nil, self)
	self.Buffs.size = 22
	self.Buffs:SetHeight(self.Buffs.size)
	self.Buffs:SetWidth(self.Buffs.size * 5)
	self.Buffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -2, 13)
	self.Buffs.initialAnchor = 'BOTTOMLEFT'
	self.Buffs["growth-y"] = 'TOP'
	self.Buffs.num = 20
	self.Buffs.spacing = 2

    --[[ debuffs ]]--
	self.Debuffs = CreateFrame("Frame", nil, self)
	self.Debuffs.size = 22
	self.Debuffs:SetHeight(self.Debuffs.size)
	self.Debuffs:SetWidth(self.Debuffs.size * 4)
	self.Debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 119, 35)
	self.Debuffs.initialAnchor = 'BOTTOMLEFT'
	self.Debuffs["growth-y"] = 'TOP'
	self.Debuffs.num = 20
	self.Debuffs.spacing = 3
    
-----------------------------------------------------------------------
--      Cast Bars
-----------------------------------------------------------------------
    --[[ player cast bar ]]--
	if unit=='player' then
		self.Castbar = CreateFrame('StatusBar', nil, self)
		self.Castbar:SetWidth(220)
		self.Castbar:SetHeight(12)
		self.Castbar:SetPoint('CENTER', oUF.units.player, 'CENTER', 0, -22)
		self.Castbar:SetStatusBarTexture(bartexture)
		self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7)

        self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}})
	    self.Castbar:SetBackdropColor(0, 0, 0, 1)

		self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
		self.Castbar.bg:SetAllPoints(self.Castbar)
		self.Castbar.bg:SetTexture(bartexture)
		self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1)
		
		self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
		self.Castbar.Text:SetPoint('LEFT', self.Castbar, 0, -13)
		self.Castbar.Text:SetTextColor(1, 1, 1)
	
		self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
		self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, -13)
		self.Castbar.Time:SetTextColor(1, 1, 1)
		self.Castbar.CustomTimeText = lolCastBarTime

		self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
		self.Castbar.Icon:SetHeight(20)
		self.Castbar.Icon:SetWidth(20)
		self.Castbar.Icon:SetTexCoord(0,1,0,1)
		self.Castbar.Icon:SetPoint("LEFT", -28, 0)

		self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
		self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT")
		self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT")
		self.IconOverlay:SetTexture(bufftexture)
		self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25)

	end

--[[ target cast bar ]]--
	if unit=='target' then
		self.Castbar = CreateFrame('StatusBar', nil, self)
		self.Castbar:SetWidth(220)
		self.Castbar:SetHeight(12)
		self.Castbar:SetPoint('CENTER', oUF.units.target, 'CENTER', 0, -22)
		self.Castbar:SetStatusBarTexture(bartexture)
		self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7)
        
        self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}})
	    self.Castbar:SetBackdropColor(0, 0, 0, 1)

		self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
		self.Castbar.bg:SetAllPoints(self.Castbar)
		self.Castbar.bg:SetTexture(bartexture)
		self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1)

		self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')
		self.Castbar.Text:SetPoint('LEFT', self.Castbar, 0, -13)
		self.Castbar.Text:SetTextColor(1, 1, 1)
	
		self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
		self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, -13)
		self.Castbar.Time:SetTextColor(1, 1, 1)
		self.Castbar.CustomTimeText = lolCastBarTime

		self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK")
		self.Castbar.Icon:SetHeight(20)
		self.Castbar.Icon:SetWidth(20)
		self.Castbar.Icon:SetTexCoord(0,1,0,1)
		self.Castbar.Icon:SetPoint("RIGHT", 28, 0)

		self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY")
		self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT")
		self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT")
		self.IconOverlay:SetTexture(bufftexture)
		self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25)
	end

--[[ focus castbar ]]--
	if unit=='focus' then
		self.Castbar = CreateFrame('StatusBar', nil, self)
		self.Castbar:SetWidth(100)
		self.Castbar:SetHeight(10)
		self.Castbar:SetPoint('CENTER', oUF.units.focus, 'CENTER', 0, 19)
		self.Castbar:SetStatusBarTexture(bartexture)
		self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7)
        
        self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -2}})
	    self.Castbar:SetBackdropColor(0, 0, 0, 1)

		self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
		self.Castbar.bg:SetAllPoints(self.Castbar)
		self.Castbar.bg:SetTexture(bartexture)
		self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1)

		self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')
		self.Castbar.Text:SetPoint('CENTER', self.Castbar, 0, 14)
		self.Castbar.Text:SetTextColor(1, 1, 1)
		self.Castbar.Text:SetWidth(100)
		self.Castbar.Text:SetHeight(8)
	end

--[[ combo points ]]--
	if unit=='target' then
		self.CPoints = {}
		self.CPoints.unit = 'player'
			for i = 1, 5 do
				self.CPoints[i] = self.Power:CreateTexture(nil, 'OVERLAY')
				self.CPoints[i]:SetHeight(12)
				self.CPoints[i]:SetWidth(12)
				self.CPoints[i]:SetTexture(combotexture)
				if (i == 1) then
					self.CPoints[i]:SetPoint('BOTTOMRIGHT', self, 3, -20)
				else
					self.CPoints[i]:SetPoint('RIGHT', self.CPoints[i-1], 'LEFT', 1)
				end
			end
		end

-----------------------------------------------------------------------
--      Frame Settings
-----------------------------------------------------------------------
    
    if unit=='player' then
		self:SetAttribute('initial-height', 20)
	    self:SetAttribute('initial-width', 220)
		self.Power:Show()
		unitName:SetPoint('RIGHT', self, -230, 0)
		curhealth:Show()
		curpower:Show()
        curhealth:SetPoint('LEFT', self, 230, 0)
        curpower:SetPoint('LEFT', self, 230, 17)
        healthbg:SetWidth(220)
	    healthbg:SetHeight(20)
    end

	if unit == 'target' then
		self:SetAttribute('initial-height', 20)
	    self:SetAttribute('initial-width', 220)
		self.Power:Show()
		unitName:SetPoint('LEFT', self, 230, 0)
		curhealth:Show()
		curpower:Show()
        curhealth:SetPoint('Right', self, -230, 0)
        curpower:SetPoint('Right', self, -230, 17)
        curpower.colorPower = true
        healthbg:SetWidth(220)
	    healthbg:SetHeight(20)
	end

	if unit ~= 'target' then
		self.Buffs:Hide()
		self.Debuffs:Hide()
	end
	
	if unit=='focus' then
	    self:SetAttribute('initial-height', 16)
	    self:SetAttribute('initial-width', 100)
		self.Power:Hide()
	    unitName:SetPoint('RIGHT', self, -110, 2)
		curhealth:Hide()
		curpower:Hide()
        healthbg:SetWidth(100)
	    healthbg:SetHeight(16)
	end
    
    if unit=='targettarget' then
	    self:SetAttribute('initial-height', 16)
	    self:SetAttribute('initial-width', 100)
		self.Power:Hide()
	    unitName:SetPoint('LEFT', self, 110, 0)
		unitName:SetWidth(90)
		unitName:SetHeight(6)
		curhealth:Hide()
		curpower:Hide()
        healthbg:SetWidth(100)
	    healthbg:SetHeight(16)
	end

	if unit=='pet' then
		self:SetAttribute('initial-height', 12)
	    self:SetAttribute('initial-width', 100)
		self.Power:Hide()
	    unitName:Hide()
		curhealth:Hide()
		curpower:Hide()
	end
		self.PostCreateAuraIcon = auraIcon
	
		return self
	end

    oUF:RegisterStyle('oUF_bloo', layout)
    oUF:SetActiveStyle('oUF_bloo')
	
	oUF:Spawn('player'):SetPoint('CENTER', -200, -300)
	oUF:Spawn('focus'):SetPoint('TOPLEFT', oUF.units.player, 0, 31)
	oUF:Spawn('target'):SetPoint('CENTER', 200, -300)
	oUF:Spawn('targettarget'):SetPoint('TOPRIGHT', oUF.units.target, 0, 31)
	oUF:Spawn('pet'):SetPoint('BOTTOMLEFT', oUF.units.player, 0, -40)
If you have any idea what is happening PLEASE let me know. I've been trying to change the font on my layout for weeks.
  Reply With Quote
12-10-09, 12:39 AM   #2
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Change the font variable. Obviously it can't load the font. Try without .ttf in the string?
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Font help


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