English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 24 July 2021, 09:18   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Can I get text width (pixels) from font?

I am writing an application in Intuition. I need to know the width of the text being printed in a TEXT_KIND to see if this is more than the width of the gadget (and then act upon this if so).

For example, given the text "Hello World", is there a way how to know the width that this text will have in pixels for a particular font used?
Sim085 is offline  
Old 24 July 2021, 09:29   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
graphics.library/TextLength
intuition.library/IntuiTextLength

There are also

graphics.library/TextExtent
graphics.library/TextFit

The former tells you more details about the space your text neeeds and the latter tells you how many characters of your text fit into the area.
thomas is online now  
Old 24 July 2021, 13:33   #3
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Wow! Many thanks. Let me google about them.

Quote:
Originally Posted by thomas View Post
graphics.library/TextLength
intuition.library/IntuiTextLength

There are also

graphics.library/TextExtent
graphics.library/TextFit

The former tells you more details about the space your text neeeds and the latter tells you how many characters of your text fit into the area.
Sim085 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
QBlit Unqueue width Nightshft Coders. Blitz Basic 4 18 June 2020 00:08
Bob width >16 pixels DanielAllsopp Coders. Asm / Hardware 10 22 May 2020 18:02
ListBrowser column width mritter0 Coders. C/C++ 1 08 August 2017 07:03
Object width mritter0 Coders. C/C++ 2 19 September 2014 23:06
Get Gadget Width mritter0 Coders. C/C++ 2 11 June 2014 02:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:16.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07557 seconds with 15 queries