Thread Tools Display Modes
05-11-10, 10:33 AM   #1
Sedh
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Jul 2008
Posts: 3
specific font api

hi there,

got a question to ask: i'm using Nice Damage (font)

but this addon only modifies the font of the dmg i and my pet deal, not the one i recieve. the core lua looks like this:

NiceDamage = CreateFrame("Frame", "NiceDamage");

local damagefont_FONT_NUMBER = "Interface\\AddOns\\NiceDamage\\font.ttf";

function NiceDamage:ApplySystemFonts()

DAMAGE_TEXT_FONT = damagefont_FONT_NUMBER;

end

NiceDamage:SetScript("OnEvent",
function()
if (event == "ADDON_LOADED") then
NiceDamage:ApplySystemFonts()
end
end);
NiceDamage:RegisterEvent("ADDON_LOADED");

NiceDamage:ApplySystemFonts()
now, i want to add the incoming dmg/heal font so it looks the same way the outgoing font does. what lines do i have to add?

i tired similiar addons like clearfont and fontain etc. but they are completly overloeded with features i dont't use.
never done lua coding, but it seems possible to enable this feature just by adding like two lines.

thanks in advance,
sedh

p.s. i also changed the fonts in wow's font folder, adapted their names etc. but that way also the unitframe healthnumber changed (i don't want that to happen)
__________________
http://prpg.wordpress.com/
  Reply With Quote
05-11-10, 11:06 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
You would have to hunt down which font is applied to the incoming damage text rather than the outgoing text.

What that addon does is a quick and dirty way of changing the fonts to another font. However, the same fonts are used in other elements of the game so sometimes it will affect those too.

I'm not a font expert but while working with my own font changes in my own addons I have noticed there are 2 different ways of dealing with unique font changes.

SetFontObject - This will set a specific font already set up as useable by that text object.

GetFontObject - This will get the font used by that text object which you can change but will affect that object wherever else it is used in game.

SetFont - This will allow you to change the file, size and/or style of any text object without affecting the fontobject assuming you are attaching it to the text object itself and not the fontobject.

GetFont - This will extract the font details of that text object as 3 individual elements which can then override without affecting other objects using the same font object.

Without writing your own addon I would suggest you ask the creator of that one to investigate the problems you have come across and try and rectify them and also to locate and reflect the incoming damage text font too.

This is the based Font Object for the combat text. You could try using this to override all CombatTextFont references which hopefully are not used elsewhere. An example below:
Code:
<FontString name="CombatTextTemplate" inherits="CombatTextFont" hidden="true" virtual="true">
These are the individual CombatText font strings used in Blizzard_CombatText.xml/lua the default combat text addon.
Code:
<FontString name="CombatText1" inherits="CombatTextTemplate"/>
<FontString name="CombatText2" inherits="CombatTextTemplate"/>
<FontString name="CombatText3" inherits="CombatTextTemplate"/>
<FontString name="CombatText4" inherits="CombatTextTemplate"/>
<FontString name="CombatText5" inherits="CombatTextTemplate"/>
<FontString name="CombatText6" inherits="CombatTextTemplate"/>
<FontString name="CombatText7" inherits="CombatTextTemplate"/>
<FontString name="CombatText8" inherits="CombatTextTemplate"/>
<FontString name="CombatText9" inherits="CombatTextTemplate"/>
<FontString name="CombatText10" inherits="CombatTextTemplate"/>
<FontString name="CombatText11" inherits="CombatTextTemplate"/>
<FontString name="CombatText12" inherits="CombatTextTemplate"/>
<FontString name="CombatText13" inherits="CombatTextTemplate"/>
<FontString name="CombatText14" inherits="CombatTextTemplate"/>
<FontString name="CombatText15" inherits="CombatTextTemplate"/>
<FontString name="CombatText16" inherits="CombatTextTemplate"/>
<FontString name="CombatText17" inherits="CombatTextTemplate"/>
<FontString name="CombatText18" inherits="CombatTextTemplate"/>
<FontString name="CombatText19" inherits="CombatTextTemplate"/>
<FontString name="CombatText20" inherits="CombatTextTemplate"/>
Example: Assuming that you have no other combat text display addons and have the default blizzard combat text messages displayed I would hazard a guess that this set up during the ADDON_LOADED event may be all you need to do.

Code:
local fontObject = CombatText1:GetFontObject();
fontObject:SetFont(fontFile,fontSize,fontStyle);
Simply replacing the values in SetFont() with your chosen file, size and style ( "OUTLINE", "THICKOUTLINE", nothing) and because they are all based on the same font object just changing the first combattext line should be enough to update the rest. I haven't been able to try this out as of yet due to server down time but if that doesn't work try replacing CombatText1 with CombatTextTemplate or CombatText and see if those work.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
05-11-10, 11:22 AM   #3
Sedh
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Jul 2008
Posts: 3
very nice. thank you for the fast and detailed answer. i'll try out your method as soon as i get home. will post my results then.
__________________
http://prpg.wordpress.com/
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » specific font api


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