Gold3nF1r3
(FENRIR Security)
December 19, 2024, 4:21am
#1
I would like to know if this is the most optimized way to handle text shortening
local textsize = math.abs(19-(topbar.AbsoluteSize.X-55))
print(textsize)
local text = computerdata.UIText.TextBounds.X
if text > textsize then
repeat computerdata.UIText.Text = string.sub(computerdata.UIText.Text,1,#computerdata.UIText.Text-1)
print(computerdata.UIText.Text,computerdata.UIText.TextBounds.X,textsize-9)
until computerdata.UIText.TextBounds.X < textsize - 9
computerdata.UIText.Text = computerdata.UIText.Text.."..."
end
If it is under a gui, then you can switch the TextScaled property to true. For example,
local TextLabel = "your text labet or text button or text box"
TextLabel.TextScaled = true
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 4:35am
#3
I don’t want it scaled. Its supposed to be the text like on a computer.
Okay, I’m a little confused now. What exactly did you want? I thought you said you wanted to make text size smaller to fit a label.
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 4:37am
#5
A space that fits the confines of a region, not scaling, just automating it to look like the top bar of a window.
IE:
Current code does this:
Um, I’m still confused. Can you explain in more detail what you are trying to achieve?
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 4:41am
#7
Ah okay. I myself don’t know how to do that, but I wish you good luck finding a solution!
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 4:43am
#9
I have already did it, but I was wondering if I could make the text handler shorter in length/runtime
Oh wait, I actually get it better now. Lemme look into some things.
Yeah I think your current method is pretty efficient. Stick with that.
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 5:09am
#12
I could do a check with 50% checks, where it checks half set, then if so, it removes 50% either left or right depending on stuff.
under 50%, check the left side starting from beginning to end, above 50%, check from right to left
Gold3nF1r3
(FENRIR Security)
December 19, 2024, 5:26am
#13
yeah, I got it pretty small iteration# now