Thread: Aardvark Cata
View Single Post
05-03-24, 06:36 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,898
SetJustifyV is not for anchoring (SetPoint), it purely to set the vertical justification of the text inside a FontString (Think of the FontString as a container you anchor and the text inside as something separate that you control the look of based on the containers dimensions along with SetJustifyV/SetJustifyH).

For Cata (and presumably the other versions at some point) you can't use "CENTER" for SetJustifV, only "MIDDLE". Retail and Vanilla will sitll accept "CENTER" or "MIDDLE" for the time being but you may as well change those.

If you have saved any FontStrings SetJustifyV settings in your SavedVariables as "CENTER" then they will also cause an error and the SV entries will need to be updated to "MIDDLE".

Example:
Lua Code:
  1. local Text = "This is text to test. [%s] "
  2.  
  3. local V = { "TOP", "MIDDLE", "BOTTOM" }
  4. local H = { "LEFT", "CENTER", "RIGHT" }
  5.  
  6. local last
  7. for i = 1, 3 do
  8.     local t1 = UIParent:CreateFontString()
  9.     t1:SetFontObject(GameFontNormal)
  10.     t1:SetSize(55, 100)
  11.     t1:SetPoint("TOP", last and last or UIParent, last and "BOTTOM" or nil)
  12.     t1:SetJustifyV(V[i])
  13.     t1:SetText(format(Text, V[i]))
  14.     local x = UIParent:CreateTexture()
  15.     x:SetAllPoints(t1)
  16.     x:SetColorTexture(random(0, 255) / 255, random(0, 255) / 255, random(0, 255) / 255, 0.3)
  17.  
  18.     local t2 = UIParent:CreateFontString()
  19.     t2:SetFontObject(GameFontNormal)
  20.     t2:SetSize(250, 20)
  21.     t2:SetPoint("LEFT", t1, "RIGHT", 10, 0)
  22.     t2:SetJustifyH(H[i])
  23.     t2:SetText(format(Text, H[i]))
  24.     local x = UIParent:CreateTexture()
  25.     x:SetAllPoints(t2)
  26.     x:SetColorTexture(random(0, 255) / 255, random(0, 255) / 255, random(0, 255) / 255, 0.3)
  27.  
  28.     last = t1
  29. end
  30. -- add a no size FontString that will adjust to fit the text, JustifyV is "CENTER" by default
  31. local t1 = UIParent:CreateFontString()
  32. t1:SetFontObject(GameFontNormal)
  33. --t1:SetSize(55, 100)
  34. t1:SetPoint("TOP", last, "BOTTOM", 0, -10)
  35. --t1:SetJustifyV(V[i])
  36. t1:SetText("NO SIZE\n" .. Text .. Text .."\n" .. Text .."\n" .. Text .. Text .. Text)
  37. local x = UIParent:CreateTexture()
  38. x:SetAllPoints(t1)
  39. x:SetColorTexture(random(0, 255) / 255, random(0, 255) / 255, random(0, 255) / 255, 0.3)
If the FontString is too narrow for a word it should terminate with ...
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-03-24 at 09:45 PM.
  Reply With Quote