[ALLY] Re: Determining Pixel size of font
From: johan:forsberg:6117:student:uu:se at: 16-Aug-2000 12:38
On 16-Aug-00, [rebol--techscribe--com] wrote:
> how do I determine how much space (horizontally) a string will take
> up on the screen, given a specified font name and size?
> I.e. if I have the string "0123456789" and I'm using font size 12
> and font name "courier", and I position the face that contains the
> text at offset 0x0, how do I determine programmatically how large I
> must make the face so that the complete string will be displayed? If
> I then want to add some other element behind this string, how do I -
> again programmatically - determine at which x offset I have to
> position that next element?
You might use 'size-text on the appropriate face after you've added
the text and then re-size it accordingly. It's behaving a bit
strange for me sometimes, but I think it has to do with whether the
text has word-wrap turned on.
--
Johan Forsberg