View Single Post
10-10-11, 03:00 AM   #7
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
You can easily calculate text width.

Code:
local MyFrame = CreateFrame("Frame", nil, UIParent)
MyFrame:Hide()
MyFrame.text = MyFrame:CreateFontString()
MyFrame.text:SetAllPoints(MyFrame)
MyFrame.text:SetFont(font, size)

function GetTextWidth(str)
	MyFrame.text:SetText(str)
	return MyFrame.text:GetWidth()
end
Make sure the font and size is the same as the Chat Frame. Incorporate some loops, and routines, and you'll be able to get subsets of strings that equal the same as where the Chat Frame wraps it's text A ChatFrame1:GetWidth() and a bit of trial and error should get you there.

Last edited by Nibelheim : 10-10-11 at 03:02 AM.
  Reply With Quote