generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: text wrapping

Previous Thread :: Next Thread 
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 03:04 PM
how does the chat move the white characers over just enough to fit the name, and then with text wrapping move the rest down?

i was thinking they just have 2 textlabels, one for the name and then one for the text and then the one with the text is just a rectangle where the text is pushed over a bit with whitespace based on the name labels's text bounds. how do i do this with text wrapping?

maybe im over complicating this

imgur
.
com
/PY9Iw0K


Report Abuse
Zekleon is not online. Zekleon
Joined: 29 Sep 2012
Total Posts: 340
02 Feb 2017 03:13 PM
They have a math formula that sizes the name box according to the number of letters in the name and size of letters etc. Then they create another box placing it just next to it. I think that's what happens anyway.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 03:17 PM
if they place it next to the text then it won't go under the name. how do they get the text under the name?

do they just replace the beginning of the message with whitespace or something


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 03:18 PM
didnt see anything on github on how they do it


Report Abuse
17248 is not online. 17248
Joined: 20 Jan 2016
Total Posts: 1
02 Feb 2017 03:18 PM
put text in 1st line

while no more characters left
while textboundsx>width
subtract character put it on next line
end
increment line
end
Report Abuse
iDerpyDogez is not online. iDerpyDogez
Joined: 05 Feb 2012
Total Posts: 1781
02 Feb 2017 04:01 PM
on the new chat it just uses spaces until it is infront of the player label thing( im guessing using repeat until textbounds = player name textbounds but thats probably bad )


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
03 Feb 2017 05:07 AM
Seems strange to do it like that. I looked at this ugly code but it gave me nothing

function Util.GetStringTextBounds(text, font, fontSize, sizeBounds)
-- If no sizeBounds are specified use some huge number
sizeBounds = sizeBounds or false
if not TextSizeCache[text] then
TextSizeCache[text] = {}
end
if not TextSizeCache[text][font] then
TextSizeCache[text][font] = {}
end
if not TextSizeCache[text][font][sizeBounds] then
TextSizeCache[text][font][sizeBounds] = {}
end
if not TextSizeCache[text][font][sizeBounds][fontSize] then
testLabel.Text = text
testLabel.Font = font
testLabel.FontSize = fontSize
if sizeBounds then
testLabel.TextWrapped = true;
testLabel.Size = sizeBounds
else
testLabel.TextWrapped = false;
end
TextSizeCache[text][font][sizeBounds][fontSize] = testLabel.TextBounds
end
return TextSizeCache[text][font][sizeBounds][fontSize]
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image