Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Text size calculation

Author
Message
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 28th Nov 2019 07:31
Hi,
Is there any way to calculate the size of a text object, so that it will not extend beyond the size of a specific rectangle?
I work in percentage based system

The author of this post has marked a post as an answer.

Go to answer

Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Nov 2019 09:27
You can use:
SetTextScissor( iTextIndex, x, y, x2, y2 )

This limits the text object to a specified rectangular area...so no text is drawn outside of the rectangle area you define.

To get the actual size of the text displayed in pixels, you can use
GetTextTotalWidth( iTextIndex )
GetTextTotalHeight( iTextIndex )

These will give you how many pixels the text object is wide and how high.
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 28th Nov 2019 10:52
This post has been marked by the post author as the answer.
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 29th Nov 2019 19:59 Edited at: 29th Nov 2019 20:00
Hi, thank you both for your responses.
@Ougurun: your function works like a charm!. This is what I was looking for.

Login to post a reply

Server time is: 2024-04-20 03:19:46
Your offset time is: 2024-04-20 03:19:46