GDAL3AI@cc1.kuleuven.ac.be (09/27/90)
I'm looking for a way to find the heigth of the default system font under 2.0 . The problem I have is the following: I want to print a text in a window via PrintIText. I want to determine the window heigth before opening it so I get a nice window that fits around the text. What is the right way to do this ??? (under 2.0) BTW. I find the Width by using IntuiTextLength (or something like that, can't remember... is that right too ???) If you can help me with this, please respond as fast as possible, 'cos I'll leave soon.. I. Aerts
peter@cbmvax.commodore.com (Peter Cherna) (09/28/90)
In article <90270.154651GDAL3AI@cc1.kuleuven.ac.be> GDAL3AI@cc1.kuleuven.ac.be writes: >I'm looking for a way to find the heigth of the default system font >under 2.0 . The problem I have is the following: I want to print a >text in a window via PrintIText. I want to determine the window >heigth before opening it so I get a nice window that fits around >the text. What is the right way to do this ??? (under 2.0) >BTW. I find the Width by using IntuiTextLength (or something like that, >can't remember... is that right too ???) >If you can help me with this, please respond as fast as possible, 'cos >I'll leave soon.. Under 2.0, your window titlebar will contain the screen's font. To determine the height your window top border will be, perform the following calculation: topborder = screen->WBorTop + (screen->Font->ta_YSize + 1); To be safe, you should use the 2.0 Intuition function LockPubScreen(NULL) to get the screen pointer of the default public screen (usually Workbench), then open your window using win = OpenWindowTags(&newwin, WA_PubScreen, screen, TAG_DONE); then call UnlockPubScreen(NULL, screen). The default font for rendering IN the window is GfxBase->DefaultFont. IntuiTextLength() (or graphics/TextLength()) tells you how wide your text will be. The new graphics.library call TextExtent() gives you information about both width and height. > I. Aerts Peter -- Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.cbm.commodore.com My opinions do not necessarily represent the opinions of my employer. "Very strange... the window is broken on both sides."
bj@cbmvax.commodore.com (Brian Jackson) (09/28/90)
In article <90270.154651GDAL3AI@cc1.kuleuven.ac.be> GDAL3AI@cc1.kuleuven.ac.be writes: >I'm looking for a way to find the heigth of the default system font >under 2.0 . The problem I have is the following: I want to print a GfxBase->DefaultFont->tf_YSize >BTW. I find the Width by using IntuiTextLength (or something like that, >can't remember... is that right too ???) IntuiTextlength() will give you the length, in pixels, of the IntuiText's string. With a non-proproportional font, this should be the same as strlen(MyIntuiText->IText) * MyIntuiText->ITextFont->tf_XSize If you've got a proportional font, this is untrue. > I. Aerts ---------------------------------------------------------------------------- | Brian Jackson Software Engineer @ Commodore-Amiga Inc. | | bj@cbmvax.commodore.com or ...{uunet|rutgers}!cbmvax!bj GEnie: B.J. | | "Fasten your seatbelt, I want to try something." | ----------------------------------------------------------------------------