On 03/05/2011 12:47 AM, Manolo Gouy wrote:
>> It looks like on OSX (and also on Xft) the
>> single-character call is implemented by making a 1-character string
>> and measuring that, so it is a total waste of time.
>
> The present working is that such a call is indeed done, but only
> once, the first time each character is encountered. The resulting
> width is memorized and returned by all successive character
> measurement requests.
>
>
>> I suspect the overhead of constructing the arguments and doing the
>> system call is much more important than the time the system actually
>> spends measuring, so minimizing these calls is much more important than
>> minimizing how much data is sent.
>
> As said above, there's no system call involved here, just a loop
> that adds up pre-memorized single-character widths.
>
> The previous implementation did make a system call to measure each
> string and was called by Fl_Text_Display with single characters as
> strings, and it was terribly slow indeed.

What I recommend instead, however, is that the text editor be changed to 
call fl_width(char*, length) (and that function also must be modified to 
call the correct OS function). At worst it should only call it after 
every word, and there are tricks that can be done so it calls it even less.

This would allow the kerning to remain on, too.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to