> OK. Based on Bill's points, rather than messing with the 
> existing API  
> at all, I'll just try and add an "fl_text_extent" mechanism (name  
> TBD) just as a proof of concept for now. Then if that seems to be  
> working for us, we can build on that, perhaps.

Hm, well, I had a little time last night to look at this, so I
implemented an "fl_text_extents" function in 1.3/OSX, and after a little
fiddling about, it seems to work quite nicely.
I settled on using ATSUMeasureTextImage(...) to measure the extents of
my strings, and that seems to have worked really well.
It doesn't return *exactly* the same bounding box that Cairo returns,
but it's just off by the odd pixel here or there, and using this my
application code works well - flicking back and forth between the Cairo
rendered view and the fltk rendered view, you can see some small shifts,
but it is basically good. And a good bit faster than the Cairo version.
At this point I was feeling quite optimistic and inspired by how well
this was going.

So, fire up Vista on my laptop to implement the equivalent function for
win32.
And there goes the rest of my evening...
In summary: The MS function GetTextExtentPoint32W() and it's siblings
return a "typographical" bounding box, it seems, which is fine for our
general use, but I can't see which function to use to get the actual
extents of the rendered glyphs (the "inked" portion, as it were).
A grep through the Cairo source suggest that they don't use
GetTextExtentPoint* at all... Indeed, the code they use to measure text
extents in win32 looks pretty "complicated"...

So - anyone got any useful tips for measuring actual text extents on
win32? (Short of just calling Cairo!)

Tonight, time permitting, I might take a stab at an XFT version, see how
that goes. Maybe.

-- 
Ian



SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to