nanogui: Finding out width of a text string in terms of pixels


Previous by date: 28 Sep 2006 05:35:53 +0100 Re: Setting background as transparent, pratish ganguly
Next by date: 28 Sep 2006 05:35:53 +0100 Creating thumbnails of images and videos, pratish ganguly
Previous in thread:
Next in thread: 28 Sep 2006 05:35:53 +0100 Re: Finding out width of a text string in terms of pixels, tj

Subject: Finding out width of a text string in terms of pixels
From: "pratish ganguly" ####@####.####
Date: 28 Sep 2006 05:35:53 +0100
Message-Id: <fa595afb0609272135i1318472ydddd29e17e65d6af@mail.gmail.com>

Dear all,

I am trying to find out the width of a text string and write it on the
middle of the screen using .
I have tried

    GR_SIZE text_width;        /* variable to store text width of normal
text             */
    GR_SIZE text_height;        /* variable to store text height of normal
text            */
    GR_SIZE text_base;        /* variable to store text baselineheight of
normal text            */

    GrGetGCTextSize( gc , "A" , 1 , (int)NULL , text_width , text_height ,
text_base );

     GrText(wid ,  gc , 400 - ((int)text_width_n * 7) , 240 , "books
selected", 14 , (int)NULL );         // on a 800 X 480 display

But the text does not appear exactly where I want it to be printed.
I tried to use other APIs like GrGetFontInfo , but was a little confused by
the pointer to GR_FONT_INFO structure used in it.
I tried to find information about the structure on the net.
It said that it is defined in graphics.h in /usr/src.
As I could not find graphics.h in my /usr/src directory , I have no
information about the structure.
Am I missing something here ?
Please help in resolving this problem by giving pointers to the solution.
Also it would be a great help for me if someone could refer some pointers
for me to find information about the GR_FONT_INFO structure.

Thanks and regards.

Pratish Ganguly

Previous by date: 28 Sep 2006 05:35:53 +0100 Re: Setting background as transparent, pratish ganguly
Next by date: 28 Sep 2006 05:35:53 +0100 Creating thumbnails of images and videos, pratish ganguly
Previous in thread:
Next in thread: 28 Sep 2006 05:35:53 +0100 Re: Finding out width of a text string in terms of pixels, tj


Powered by ezmlm-browse 0.20.