Question: How "expensive" would measuring the text before doing
the real output in X11 be?

Reasoning: In STR #2798 [1] there's a proposal to clip text before
drawing in X11, because of the problem with 16-bit coordinates
in X11 vs. 32-bit coordinates in FLTK. The proposed patch [2] is
incomplete (and not correct), but a correct clipping algorithm
would IMHO mean that we'd need to measure the text. The problem
is that text that would normally be outside the clipping range
could "wrap" into the display because X11 ignores the upper 16
bits of the (FLTK) coordinate space. Note that this is not a
problem for Windows and OS X, since these are using 32-bit
coordinates anyway.

Does anybody here know how "expensive" this would be in terms
of CPU usage and - probably *much* more important - X11 server
interactions? The measuring would have to be right before calling

XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, fl_gc, 
x, y, c, n);

in fl_font_x.cxx (isn't there another one for XFT?), so the font
for measuring the text would probably be set up already. Would this
introduce more X server messages, or would measuring be a local
operation?

Second question: What function should be used: fl_measure() or
fl_text_extents()? Would there be a performance difference to be
expected, or would it only be the small difference in the exact
layout? The latter could IMHO be ignored, I'd suggest to use the
faster method, because exactness wouldn't matter here, anyway.

Albrecht


[1] http://www.fltk.org/str.php?L2798
[2] http://www.fltk.org/strfiles/2798/patch.txt
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to