[Lazarus] Bidi TextOut in GTK2

ik idokan at gmail.com
Wed Apr 14 13:29:29 CEST 2010


Hmm, Now i understand you about change the position.

The position of Canvas still started from (Left Top), but the cells it
must be (Right Top)
In Delphi use SetWindowOrgEx, SetViewportExtEx to mirror the Canvas
and make the (0,0) in Right Top, and i dislike that way because

1- it is not work in all widgetsets
2- It make some confused when put controls in the Grid (like inplace
Edit), because the canvas switched but then control size/bounds for
child control not switched.

Delphi -------------------------------------------------------------
procedure TCustomGrid.ChangeGridOrientation(RightToLeftOrientation: Boolean);
var
  Org: TPoint;
  Ext: TPoint;
begin
  if RightToLeftOrientation then
  begin
    Org := Point(ClientWidth,0);
    Ext := Point(-1,1);
    SetMapMode(Canvas.Handle, mm_Anisotropic);
    SetWindowOrgEx(Canvas.Handle, Org.X, Org.Y, nil);
    SetViewportExtEx(Canvas.Handle, ClientWidth, ClientHeight, nil);
    SetWindowExtEx(Canvas.Handle, Ext.X*ClientWidth, Ext.Y*ClientHeight, nil);
  end
.....
end;
----------------------------------

Ido, i am not GTK user,if you like to make hand, TLabel is best and
simple control to start, if make it draw the text Right To Left, it
will resolve text drawing in many controls include TGrid,
You can work around
\lazarus\lcl\interfaces\gtk2\gtk2winapi.inc TGtk2WidgetSet.TextOut(
\lazarus\lcl\interfaces\gtk2\gtk2devicecontext.inc
TGtk2DeviceContext.DrawTextWithColors
there is pango.DIRECTION_RTL, in fact i am bad in GTK2 and Pango.

Best Regards
-- 
Zaher Dirkey




More information about the Lazarus mailing list