Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>textheight() get a string's height in pixels</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 textheight()            Get a String's Height in Pixels

 #include   <graphics.h>

 int far    textheight(tstring);
 char far   *tstring;

    textheight() gets the height of 'tstring' in pixels by using the
    current text font size and multiplication factor.   textheight() and
    textwidth() are used for sizing strings that need to be fit into
    existing spaces.

    Returns:     The text height in pixels.

   -------------------------------- Example ---------------------------------

    The following statements size the word "squeeze" and print it in a
    small box.

           #include <graphics.h>
           #include <conio.h>

           main()
           {
               int gdriver = DETECT;
               int gmode;
               char *txt = "Squeeze";

               initgraph(&gdriver,&gmode,"");
               settextjustify(CENTER_TEXT,CENTER_TEXT);
               settextstyle(SANS_SERIF_FONT,HORIZ_DIR,USER_CHAR_SIZE);
               setusercharsize(60,textwidth(txt),50,textheight(txt));
               settextstyle(SANS_SERIF_FONT,HORIZ_DIR,USER_CHAR_SIZE);
               rectangle(290,125,350,175);
               outtextxy(320,150,txt);
               getch();
               closegraph();
           }


See Also: gettextsettings() outtext() textwidth()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson