Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-06

Gtk2 ExtTextOut internal helper is slow

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexey Tor.
gtk2devicecontext.inc
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength:
PtrInt);
var
   OldStr: PChar;
begin
   OldStr := pango_layout_get_text(ALayout);
   if (strlen(OldStr)ALength) or (strlcomp(AText, OldStr, ALength)
0) then
     pango_layout_set_text(ALayout, AText, ALength);
end;

as you see it's slow
a) get oldstr
b) compare oldstr by 2 funcs
why this cache is needed?
to call ExtTextOut() 20 times with the same x/y/s ? so I suggest to del checks - just call pango_layout_set_text and that's it.

Alexey Torgashin

Reply by email

Martin Frb
to Alexey Tor.
Alexey Tor. wrote
to call ExtTextOut() 20 times with the same x/y/s ? so I suggest to del checks - just call pango_layout_set_text and that's it.

I do not know if this is related.

But test your changes with Synedit extra-char-width.

You can set the extra char width to 1 (or greater) in the IDE for the source editor. Make sure that works.
Also test with Japanese double width chars in SynEdit. アkj (randomly typed, no idea if or what it means)
And maybe Arabic right to left script. (checking that the caret works, and text is stable while selection is changed char by char)

Reply by email