nanogui: GrArea and colours
Subject:
Re: GrArea and colours
From:
Alex Holden ####@####.####
Date:
3 Nov 1999 17:08:30 -0000
Message-Id: <Pine.LNX.4.04.9911031652560.743-100000@hyperspace>
---------- Forwarded message ----------
Date: 3 Nov 1999 13:20:01 -0000
From: Vidar Hokstad ####@####.####
To: ####@####.####
Cc: ####@####.#### ####@####.####
Subject: Re: GrArea and colours
On Wed, 03 Nov 1999 14:11:41 +0100 you wrote:
>**text-size - for positions.
> all text that is outputted is outputted in small chunks - 3 or 4 words
>at a time. I have no idea how to
> calculate the width of a outputted line, and that causes large
>spacings here and there since I assume
> a fixed length on all characters and i's are by far thinner than a M.
> Is there a quick way to calculate the pixel-width of a word ?
There's two ways to do this:
GrGetFontInfo() - This fills in a structure that includes the width of
every character.
GrGCTextSize() - This calculates the width of a given string.
I suggest using GrGetFontInfo(), since that can be done once for each font
used, and
then calculate the length "locally". It doesn't matter much when the app is
linked with
Nano-X directly, but it is a LOT faster when using the network code.
Vidar.
[Cc:'d my answer to the mailing list since it doesn't contain any private
info...:) ]