[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
displaying texts/fonts
From: "Robbie" ####@####.#### Date: 10 Feb 2006 21:38:01 +0000 Message-Id: <20060210213745.1FA96BD63A@xprdmxin.myway.com> Hi All, I've ran into a few snags with texts and I'm trying to understand nanogui's implemsntation. If for instance I have a text "nanogui is the best" and I want to display each phase ("nanogui" , "is" , etc.) with a different size and color it appears that I'll have to know more details of the font used to do this. It appears that I'll have to know (calculate, maybe) the number of pixels and display each separately using GrText(). That implies fixed sized fonts.What about proportional fonts? Is this the way it is done? Do I understand this correctly? If I want to center this text in a window, is this approach used to do this as well? Much Thanks, Robbie, _______________________________________________ Join Excite! - http://www.excite.com The most personalized portal on the Web! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] displaying texts/fonts
From: Alex Holden ####@####.#### Date: 11 Feb 2006 10:24:18 +0000 Message-Id: <02695BEC-5FD0-4800-8180-1D01B16C8857@linuxhacker.org> On 10 Feb 2006, at 21:37, Robbie wrote: > It appears that I'll have to know (calculate, maybe) the number of > pixels and display each separately using GrText(). I think you are looking for this API call: /** * GrGetGCTextSize: * @gc: the graphics context * @str: pointer to a text string * @count: the length of the string * @flags: text rendering flags (GR_TF*) * @retwidth: pointer to the variable the width will be returned in * @retheight: pointer to the variable the height will be returned in * @retbase: pointer to the variable the baseline height will be returned in * * Calculates the dimensions of the specified text string using the current font * and flags in the specified graphics context. The count argument can be -1 * if the string is null terminated. */ void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags, GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase) -- ------------ Alex Holden - http://www.alexholden.net/ ------------ If it doesn't work, you're not hitting it with a big enough hammer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] displaying texts/fonts
From: "Robbie" ####@####.#### Date: 13 Feb 2006 22:25:16 +0000 Message-Id: <20060213222508.095034AF9E@xprdmxin.myway.com> If that's the case, (I could use the below function to theoretically display a character by character), it is this an efficient use of this function to display character by character message keeping track of the cursor this way? Or effecient is not an issue here? Is there a mechanism for doing this any other way? Thanks. --- On Sat 02/11, Alex Holden < ####@####.#### > wrote: From: Alex Holden [mailto: ####@####.#### To: ####@####.#### Cc: ####@####.#### Date: Sat, 11 Feb 2006 10:24:16 +0000 Subject: Re: [nanogui] displaying texts/fonts OOn 10 Feb 2006, at 21:37, Robbie wrote: > It appears that I'll have to know (calculate, maybe) the number of > pixels and display each separately using GrText(). I think you are looking for this API call: /** * GrGetGCTextSize: * @gc: the graphics context * @str: pointer to a text string * @count: the length of the string * @flags: text rendering flags (GR_TF*) * @retwidth: pointer to the variable the width will be returned in * @retheight: pointer to the variable the height will be returned in * @retbase: pointer to the variable the baseline height will be returned in * * Calculates the dimensions of the specified text string using the current font * and flags in the specified graphics context. The count argument can be -1 * if the string is null terminated. */ void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags, GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase) -- _______________________________________________ Join Excite! - http://www.excite.com The most personalized portal on the Web! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] displaying texts/fonts
From: "Greg Haerr" ####@####.#### Date: 14 Feb 2006 04:46:55 +0000 Message-Id: <036401c63121$7f4d4510$6401a8c0@winXP> : If that's the case, (I could use the below function to theoretically display a character by character), it is this an efficient use of this function to display character by character message keeping track of the cursor this way? Or effecient is not an issue here? Robbie - As Alex commented, GrGetGCTextSize is the way to calculate the text string size character by character, or word by word. Also for centering. The function takes account of whether the font is proportional or fixed, and returns the correct result. It's more efficient to draw more characters at a time. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |