Quantcast
SetFont size help please - WoWInterface
Thread Tools Display Modes
01-09-14, 03:45 AM   #1
glupikreten
A Fallenroot Satyr
Join Date: Apr 2009
Posts: 25
SetFont size help please

Hi,

I have
customFrame.text = customFrame:CreateFontString(nil, "BACKGROUND", "PVPInfoTextFont");
customFrame.text:SetFont("Fonts\\DAMAGE.ttf",22,"OUTLINE");

Why is 22 font size the biggest i can go in this case? If i put into 48 size remains 22... if i put 20 it scales down a bit as expected.

As you can see i'm not good at lua at all... so if anyone have any advice how to make font bigger ...


************************************
Whole frame
************************************
customFrame=CreateFrame("Frame");
customFrame:ClearAllPoints();
customFrame:SetHeight(30);
customFrame:SetWidth(300);
customFrame:SetScript("OnUpdate", customFrame_OnUpdate);
customFrame:Hide();
customFrame.text = customFrame:CreateFontString(nil, "BACKGROUND", "PVPInfoTextFont");
customFrame.text:SetFont("Fonts\\DAMAGE.ttf",22,"OUTLINE");
customFrame.text:SetAllPoints();
customFrame:SetPoint("CENTER", 0, 250);
customFrameTime = 0;
customFrame:EnableMouse(false)
customFrame:SetMovable(false)
  Reply With Quote
01-09-14, 03:49 AM   #2
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Code:
customFrame.text = customFrame:CreateFontString(nil, "BACKGROUND", "PVPInfoTextFont");
Try without the red part, does that work? I'm fairly sure the third argument of CreateFontString is just so you don't have to set a font etc. manually, instead it'll inherit the style of an already existing template.

I'm not 100% sure about this, but this is what I gathered from when I was messing around with DailyChecklist.

EDIT: Some more reading on fontstrings
http://wowprogramming.com/docs/widge...eateFontString
http://wowprogramming.com/docs/widgets/FontString
http://wowprogramming.com/docs/widgets/FontInstance
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
01-09-14, 04:02 AM   #3
glupikreten
A Fallenroot Satyr
Join Date: Apr 2009
Posts: 25
Tried... no joy
  Reply With Quote
01-09-14, 04:30 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There is a maximum absolute size at which WoW will render a font string. For most fonts, this maximum absolute size (in pixels) is reached at a font size (I guess it's points?) of 30-32. If your font is topping out at 22, it's probably oddly designed, with lots of whitespace around each character. Without seeing the actual font file you are using though, I can't say for sure whether that is the problem, but a value of 48 or 9000 will have the same visual effect as a value of 32 even for a "normal" font.

@Wimpface:
Calling SetFont overrides any base font object you set, either by passing a font object to CreateFontstring, or by calling SetFontObject explicitly. Once SetFont is called, your fontstring is no longer considered to "have" a font object (though GetFontObject might still return something) and changes to the font object will no longer propigate to your fontstring, though any properties (like shadows) you don't override will be retained. So, passing a font object to CreateFontstring is not the cause of OP's problem.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
01-09-14, 06:36 AM   #5
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Really? How come I had to remove that argument from the addon I was tinkering with in order for me to use SetFont?
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote
01-09-14, 08:30 AM   #6
glupikreten
A Fallenroot Satyr
Join Date: Apr 2009
Posts: 25
maybe i could do this instead then to get bigger "font"

customFrame.texture = customFrame:CreateTexture();
customFrame.texture:SetAllPoints();

if customFrame.text == 1 then
customFrame:SetTexture("image1.tga",false);
elseif customFrame.text == 2 then
customFrame:SetTexture("image2.tga",false);
elseif customFrame.text == 3 then
customFrame:SetTexture("image2.tga",false);
end

where image1,2,3.tga would be images of 48 font size?

Last edited by glupikreten : 01-09-14 at 08:32 AM.
  Reply With Quote
01-09-14, 05:20 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Wimpface View Post
Really? How come I had to remove that argument from the addon I was tinkering with in order for me to use SetFont?
Without seeing your code there is absolutely nothing I can tell you, other than that you can use SetFont after setting font object, but not vice versa (you cannot set a font object after using SetFont).

Originally Posted by glupikreten View Post
maybe i could do this instead then to get bigger "font" ... where image1,2,3.tga would be images of 48 font size?
Yes, that approach has been taken by some addons to get bigger "text".
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » SetFont size help please

Thread Tools
Display Modes

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