Thread Tools Display Modes
06-28-15, 03:35 PM   #1
Visneh
A Defias Bandit
Join Date: Jun 2015
Posts: 2
[Help] Fontstring alignment.

I'm trying to create a new "custom" profession to play around with, much like the current blacksmithing one:



This is what I have so far:



Unfortunately, the problem I am currently having is that I am trying to produce an array of FontStrings, and use them to effectively act as the recipes and categories of the new profession. However, depending on their size, I can't seem to get them all to be left aligned, as in starting from the same place as they are all aligned in the center?

Code:
AddRecipe = function(name, req1, req2, req3, req4, type)
	if type == "CATAGORY" then
		
	elseif type == "RECIPE" then
		EBGUI_TOPLEFT.NUMBERTOCREATE2 = EBGUI_TOPRIGHT:CreateFontString()
		EBGUI_TOPLEFT.NUMBERTOCREATE2:SetPoint("LEFT", EBGUI_TOPLEFT, BaseTextPoint_X + NumberOfRecipes, BaseTextPoint_Y - (NumberOfRecipes * 15))
		EBGUI_TOPLEFT.NUMBERTOCREATE2:SetFontObject("GameFontWhite")
		EBGUI_TOPLEFT.NUMBERTOCREATE2:SetText(name)
		EBGUI_TOPLEFT.NUMBERTOCREATE2:SetSize(500,50)
		NumberOfRecipes = NumberOfRecipes + 1
	end
end

AddRecipe("Test1", 0, 0, 0, 0, "RECIPE")
AddRecipe("Test-2", 0, 0, 0, 0, "RECIPE")
AddRecipe("Test3.1415", 0, 0, 0, 0, "RECIPE")
AddRecipe("TEST THE FOURTH", 0, 0, 0, 0, "RECIPE")
Firstly, I'm fairly weak with XML, so a LUA example would definately be prefable! I'm wondering if there is any way to make the FontStrings left-aligned so they can be added much more easily!

Sorry for the bad english and thanks!
  Reply With Quote
06-28-15, 03:47 PM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Have you tried:

Lua Code:
  1. FontString:SetJustifyH("LEFT")
  2. FontString:SetJustifyV("TOP")
  Reply With Quote
06-28-15, 03:50 PM   #3
Visneh
A Defias Bandit
Join Date: Jun 2015
Posts: 2
I'm afraid it just makes the strings vanish!

edit: Google tells me to reference the FontInstance? What does that mean?

I've currently got:

EBGUI_TOPLEFT.NUMBERTOCREATE2:SetJustifyH("LEFT")
EBGUI_TOPLEFT.NUMBERTOCREATE2:SetJustifyV("TOP")

added into the code


FINAL EDIT: I got it working, you were right all along! Thank you so much!

Last edited by Visneh : 06-28-15 at 03:53 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » [Help] Fontstring alignment.


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