English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   Can I get text width (pixels) from font? (https://eab.abime.net/showthread.php?t=107721)

Sim085 24 July 2021 09:18

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?

thomas 24 July 2021 09:29

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 24 July 2021 13:33

Wow! Many thanks. Let me google about them.

Quote:

Originally Posted by thomas (Post 1497474)
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.



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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.07817 seconds with 11 queries