HGL

Alastair Reid alastair@reid-hoffmann.net
Tue, 8 Jul 2003 10:38:40 +0100


On Tuesday 08 July 2003 1:30 am, John Meacham wrote:
> using HGL, I notice that there does not appear to be a way to get at the
> rendered size of text strings. this makes it very difficult to work with
> text in any meaningful way. although perhaps i am missing something.

The module Graphics.HGL.X11.Picture exports this function:

-- textInfo s returns:
--
-- 1) The offset at which the string would be drawn according to the
--    current text alignment (e.g., (Center, Baseline) will result in
--    an offset of (-width/2,0))
--
-- 2) The size at which the text would be drawn using the current font.
--
textInfo :: String -> Draw ((Point,Size))

This is not yet available on Win32 and, due to an oversight, was not exported 
from Graphics.HGL.X11 or Graphics.HGL.  I'll fix that in the next release.

--
Alastair