Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
105 user(s) are online (90 user(s) are browsing Forums)

Members: 2
Guests: 103

VooDoo, Nuder_Try, more...

Support us!

Headlines

 
  Register To Post  

Finding size of system font?
Home away from home
Home away from home


See User information
Is there a nice way to find the size of the system fonts on os4?
I need to check if the font is under a certain size, if so then not let the gadget be that small. Using C programming.

X5000
Go to top
Re: Finding size of system font?
Not too shy to talk
Not too shy to talk


See User information

Please define "system" font.

Please define "size".

The font that usually is called the "system font" is the fixed-width font you define in Prefs/Font. It is the default font for all RastPorts, but it is not used for GUI elements. The default font for GUI elements is the screen font. You can get it from Screen->RastPort.Font (pointer to struct TextFont) or Screen->Font (pointer to struct TextAttr).

The size of a font usually means its height. Therefore you can get the size of a font from TextFont->tf_YSize or TextAttr->ta_YSize. Or Screen->RastPort.TxHeight.

If you want the width of a given text you should use the TextLength function.

Some fonts, especially outline fonts, might need more pixels than derived from TxHeight / TextLength. To get the real area a given text needs to be printed, you should use the TextExtent function.

Go to top
Re: Finding size of system font?
Home away from home
Home away from home


See User information
Yep, it's the height of the font i need. Where in the autodocs is this information at? Could not find anything about anything really.

X5000
Go to top
Re: Finding size of system font?
Home away from home
Home away from home


See User information
Quote:

Antique wrote:
Yep, it's the height of the font i need. Where in the autodocs is this information at? Could not find anything about anything really.


Not so much in the autodocs as the includes

check out the various structures defined in graphics/text.h

What gadget anyway?


Go to top
Re: Finding size of system font?
Just can't stay away
Just can't stay away


See User information
@Antique
Check out the autodocs for Intuition GetScreenAttr() and the SA_Font TAG in the includes.

Go to top
Re: Finding size of system font?
Home away from home
Home away from home


See User information
This seems to do the trick for me....

struct Screen *screen = NULL;
screen = LockPubScreen(NULL);
printf("fonthoyde=%i",screen->Font->ta_YSize);


X5000
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project