DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2550
Version: 1.3-current


@manolo: OK, thanks for that, that seems to have nailed it. (Though more
testing is welcome of course!)

@corvid: The really *safe* way to do that is to make the measurements in
your draw() method, at which point you can be sure the gc is valid and the
font should be set.
That's true on all platforms actually, although (as has been observed)
some (e.g. XFT) will *probably* work, if called at random times - though
if you have multiple fonts in different widgets, there is a high
likelihood that the measurement will be based on the font that the last
widget that was drawn used, which may not be the font you wanted!

An alternative might be to show your window then later (e.g. in a timeout
as you suggested) use make_current() to set a valid context based on that
window, and call the measurement functions then. That should also work,
but feels like a hack to me.

If you can contrive to make the measuremnts within your draw() method, all
should be well, and that is the most "graceful" solution...

If you look at the unittest_text.cxx example, you will see that is what is
done there, and is the "recommended" method.


Link: http://www.fltk.org/str.php?L2550
Version: 1.3-current

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

Reply via email to