Sign in Join

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

Mailing lists / lazarus / 2010-04

[BIDI] TGrid and many bugs if i add Right To Left

15 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Zaher Dirkey

Hi, I work on TGrid to add bidi (Right To Left) support, after many changes on the source, i feel we will have many bugs need to more test, so i like to ask what to do?

1 - Continue and send patch then wait to start unstable version of Lazaurs to apply it
2 - Make new unit BidiGrid.pas but use this unit only when compile lazaurs with {$IFDEF BIDI}
3 - No, start new grid class, but we will lose many controls that descent from TGrid.
4 - (any idea)

In fact i already complete 75% of my work and like to continue with it in next my free time.

Thanks in advance.

SY, Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100411/9a8b3eb4/attachment.html>

Reply by email

ik
to Zaher Dirkey

Personally I think that the entire approach of BiDi in Lazarus should be addressed differently.
First of all Bidi must be part of the overall lookup of the entire project, that means that, any changes to LCL etc, must address it as well.

Secondly, there must be proper guidelines of how we want to see BiDi in LCL. And last but not lease, make sure that in a specific time frame everything that regarding BiDi will be addressed by the project.

The last time I tried to do something about it, I felt into a situation that made me believe that the main Lazarus development team are not interested in BiDi support at all, and I know more then one company where I'm located, that if there will BiDi support as a strategy (that is for long time, and not for specific version) for working (and that will result in contributing back code as well) with Lazarus, but the they first wish to see that existed.

That's my 2 cents on the matter.

Ido
http://ik.homelinux.org/

2010/4/11 Zaher Dirkey

Show quoted text 26 lines
Hi, I work on TGrid to add bidi (Right To Left) support, after many changes on the source, i feel we will have many bugs need to more test, so i like to ask what to do? 1 - Continue and send patch then wait to start unstable version of Lazaurs to apply it 2 - Make new unit BidiGrid.pas but use this unit only when compile lazaurs with {$IFDEF BIDI} 3 - No, start new grid class, but we will lose many controls that descent from TGrid. 4 - (any idea) In fact i already complete 75% of my work and like to continue with it in next my free time. Thanks in advance. SY, Zaher Dirkey -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100411/095a5d97/attachment.html>

Reply by email

Zaher Dirkey
to ik

2010/4/11 ik

addressed differently

I am not understand the meaning of "addressed" or "addressed by the project"? (It is my English :) )

BIDI now will be as like founded in Delphi for Win32, and work fine for me, but TGrid it is most important component to hav Right To Left support.

for TPageControl i have one work Right To Left, in my component but it still unstable,
http://sourceforge.net/projects/minilib
in
\minilib\Lazarus\components\native

One bad point that i am not good user in Linux, i need some help to add bidi to GTK2 widgetset, we can start from TLabel.

Best regards

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100411/2c8dead9/attachment.html>

Reply by email

ik
to Zaher Dirkey

http://ik.homelinux.org/

2010/4/11 Zaher Dirkey

Show quoted text 8 lines
2010/4/11 ik > addressed differently I am not understand the meaning of "addressed" or "addressed by the project"? (It is my English :) )

At the moment beside Windows, Lazarus does not support BiDi. The core team does not look at BiDi support as an important as for example making the API of LCL the same as the VCL (and only include additional settings/features).

That mean (and it already happened once that I know of), that the BiDi support can be broken on every update of Lazarus, and it might not work the same at all, and I'm not talking about the UI that Lazarus is binded to, but the way things are done in Lazarus.

The BiDi support must be looked at the same way was the LCL = VCL API, and it does not at the moment, and beside the two of us (that I know of), it is not interested anyone on Lazarus at all, and that's why what I wrote above can happen.

Show quoted text 25 lines
BIDI now will be as like founded in Delphi for Win32, and work fine for me, but TGrid it is most important component to hav Right To Left support. for TPageControl i have one work Right To Left, in my component but it still unstable, http://sourceforge.net/projects/minilib in \minilib\Lazarus\components\native One bad point that i am not good user in Linux, i need some help to add bidi to GTK2 widgetset, we can start from TLabel. Best regards -- Zaher Dirkey -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100411/599a089a/attachment-0001.html>

Reply by email

Zaher Dirkey
to ik

2010/4/11 ik

Show quoted text 13 lines
2010/4/11 Zaher Dirkey > 2010/4/11 ik > >> addressed differently > > > I am not understand the meaning of "addressed" or "addressed by the > project"? (It is my English :) ) > At the moment beside Windows, Lazarus does not support BiDi.

That mean need to more work from us (me and you and there is others in the forum).

Show quoted text 5 lines
The core team does not look at BiDi support as an important as for example making the API of LCL the same as the VCL (and only include additional settings/features).

No, I am not agree, the core team applying patches that send to bug tracker same as any feature, but it slow because Lazarus is free open source project as like any free open source, we must be patient.

That mean (and it already happened once that I know of), that the BiDi support can be broken on every update of Lazarus,

I will keep my eyes on it, while i am still alive :)

The BiDi support must be looked at the same way was the LCL = VCL API, and it does not at the moment.

Most of API i need support RightToLeft in Win32 for example Canvas.TextRect() use TTextStyle, TTextStyle have RightToLeft, I use Delphi and Bidi controls from Delphi 1, i added right to left by my self, and build my own grid, When Delphi 4 have BidiMode, i remove my own Bidi functions and use the VCL one.
In fact in Delphi there is some BIDI bugs not founded in Lazarus.

beside the two of us (that I know of), it is not interested anyone on Lazarus at all, and that's why what I wrote above can happen.

Some time i feel the same, but all open source project have the same problem for add official Right To Left, and many of them refuse to add the BIDI to it, i have old experience with some PHP forum, the core team of Lazaurs make it offical bidi and always accept my patches and that enough to, may be take a long time, but all features need the same time.

Sorry for my poor English, i am writing in English as like writing programming code :)

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100411/d669da1d/attachment.html>

Reply by email

Hans-Peter Diettrich
to Zaher Dirkey
Show quoted text 5 lines
Some time i feel the same, but all open source project have the same problem for add official Right To Left, and many of them refuse to add the BIDI to it, i have old experience with some PHP forum, the core team of Lazaurs make it offical bidi and always accept my patches and that enough to, may be take a long time, but all features need the same time.

One problem may be the extent of BiDi support, that is unknown to most (western) developers. E.g. I even don't know how to enter RTL text, so that all related code should be implemented and checked by people that are familiar with RTL applications and environment.

Does there exist a list of things that should change in RTL mode?

Newer Windows systems have an API for rendering full Unicode text, including an mix of LTR and RTL parts. Do there exist similar libraries for other platforms or widgetsets (Qt???)? If yes, these libraries should be explored and a compatible wrapper (class) should be constructed, for immediate use in most components (SynEdit may be an exception). If not, an API must be defined first, and then the platform specific libraries must be implemented accordingly.

But there seem to exist more issues with RTL, like the rows in a grid running from right to left? Such behaviour can be tested by everybody, at least by faking RTL mode to make the different appearance occur.

Sorry for my poor English, i am writing in English as like writing programming code :)

Does there exist a Wiki (Wikipedia?) entry, that describes *all* required changes in BiDi/RTL mode?

DoDi

Reply by email

ik
to Hans-Peter Diettrich

http://ik.homelinux.org/

Hans-Peter Diettrich wrote 37 lines
Zaher Dirkey schrieb: Some time i feel the same, but all open source project have the same > problem for add official Right To Left, and many of them refuse to add the > BIDI to it, i have old experience with some PHP forum, the core team of > Lazaurs make it offical bidi and always accept my patches and that enough > to, may be take a long time, but all features need the same time. > One problem may be the extent of BiDi support, that is unknown to most (western) developers. E.g. I even don't know how to enter RTL text, so that all related code should be implemented and checked by people that are familiar with RTL applications and environment. Does there exist a list of things that should change in RTL mode? Newer Windows systems have an API for rendering full Unicode text, including an mix of LTR and RTL parts. Do there exist similar libraries for other platforms or widgetsets (Qt???)? If yes, these libraries should be explored and a compatible wrapper (class) should be constructed, for immediate use in most components (SynEdit may be an exception). If not, an API must be defined first, and then the platform specific libraries must be implemented accordingly. But there seem to exist more issues with RTL, like the rows in a grid running from right to left? Such behaviour can be tested by everybody, at least by faking RTL mode to make the different appearance occur. Sorry for my poor English, i am writing in English as like writing > programming code :) > Does there exist a Wiki (Wikipedia?) entry, that describes *all* required changes in BiDi/RTL mode?

Let's seperate things into two groups:
1. Text
2. UI

For text, both Qt and GTK 2x support right to left languages. When there are also non right to left chars (such as "arabic numbers" [the number used in the arabic language are actually hindu numbers :)], and latin letters etc) .

Even on non BiDi system, you can write right to left languages. The problem starts when you need to use non Right To Left chars inside a Right To Left paragraph, or the other way around, when you have a Left To Right language and you add there Right To Left chars. That called Bi-Directional or BiDi for short. You have a full algorithm description for it in unicode,org ( http://www.unicode.org/reports/tr9/), including FAQ on the matter ( http://www.unicode.org/faq/bidi.html).

One more sophisticated problem in BiDi is the Arabic language. Many letters in the Arabic language have several ways to be presented, because the Arabic written language combine all (almost) letters like the lattin script language. So Letters that at the beginning, middle or end of a word (depends on few other rules) are different letter shapes.

My native language -> Hebrew does not have this have in the Open Source few implementation of BiDi support such as FreeBiDi, and the IBM's unicode library, but also with GTK2 and Qt3 and above.

The Right To Left UI, is a whole different approach that actually everyone here can help with. On Latin based languages, everything starts from Left To Right, on Right To Left UI, everything starts from the Right.

So point 0,0 on Latin bases system should be on the top left, and on the Right to left languages starts from the top right. Some UI such as GTK2 (up to a point, it does not support all of what we require in Lazarus) support it, and so does Qt, and Windows API (on a native/enabled/unicode versions).

I hope Bidi and Right To Left is more clearer now :)

Show quoted text 11 lines
DoDi -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Ido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100412/1f86a8ef/attachment-0001.html>

Reply by email

Zaher Dirkey
to Hans-Peter Diettrich: One problem may be the extent of BiDi support, that is unknown to most (western)…

On Mon, Apr 12, 2010 at 11:11 AM, Hans-Peter Diettrich <

wrote:
Show quoted text 16 lines
One problem may be the extent of BiDi support, that is unknown to most (western) developers. E.g. I even don't know how to enter RTL text, so that all related code should be implemented and checked by people that are familiar with RTL applications and environment. Does there exist a list of things that should change in RTL mode? Newer Windows systems have an API for rendering full Unicode text, including an mix of LTR and RTL parts. Do there exist similar libraries for other platforms or widgetsets (Qt???)? If yes, these libraries should be explored and a compatible wrapper (class) should be constructed, for immediate use in most components (SynEdit may be an exception). If not, an API must be defined first, and then the platform specific libraries must be implemented accordingly.

Win32, GTK2 and QT support RTL(Right To Left reading), but i am not expiration with GTK2 and QT

But there seem to exist more issues with RTL, like the rows in a grid

running from right to left? Such behaviour can be tested by everybody, at least by faking RTL mode to make the different appearance occur.

Most native controls like grid will work on all widgetsets except draw the string inside the cell, so if it done for TLabel for GTK/QT this issue will resolved.
TGrid in my svn draw its columns right to left, for that i opened this thread.

Show quoted text 8 lines
Sorry for my poor English, i am writing in English as like writing > programming code :) > Does there exist a Wiki (Wikipedia?) entry, that describes *all* required changes in BiDi/RTL mode?

http://wiki.lazarus.freepascal.org/BidiMode#References

Thanks

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100412/0227eeeb/attachment.html>

Reply by email

Zaher Dirkey
to ik: http://ik.homelinux.org/ Let's seperate things into two groups: 1. Text 2. UI For text,…

2010/4/12 ik

Show quoted text 6 lines
<http://ik.homelinux.org/> Let's seperate things into two groups: 1. Text 2. UI

Yes, UI more easy than Text, but drawing text done by API in GTK2/Cairo and QT, and it must implemented in widgetset of GTK2/QT.

Show quoted text 29 lines
For text, both Qt and GTK 2x support right to left languages. When there are also non right to left chars (such as "arabic numbers" [the number used in the arabic language are actually hindu numbers :)], and latin letters etc) . Even on non BiDi system, you can write right to left languages. The problem starts when you need to use non Right To Left chars inside a Right To Left paragraph, or the other way around, when you have a Left To Right language and you add there Right To Left chars. That called Bi-Directional or BiDi for short. You have a full algorithm description for it in unicode,org ( http://www.unicode.org/reports/tr9/), including FAQ on the matter ( http://www.unicode.org/faq/bidi.html). One more sophisticated problem in BiDi is the Arabic language. Many letters in the Arabic language have several ways to be presented, because the Arabic written language combine all (almost) letters like the lattin script language. So Letters that at the beginning, middle or end of a word (depends on few other rules) are different letter shapes. My native language -> Hebrew does not have this problem at all. You have in the Open Source few implementation of BiDi support such as FreeBiDi, and the IBM's unicode library, but also with GTK2 and Qt3 and above.

Arabic language have this rules, but it is easy that Japanese/Chinese languages :)

Drawing this text must done by the system or there is functions to calc the bidi of utf text founded in FPC
fpc\src\rtl\objpas\utf8bidi.pp if you want to draw in utf8 with system that not support right to left text like SDL.

Show quoted text 5 lines
The Right To Left UI, is a whole different approach that actually everyone here can help with. On Latin based languages, everything starts from Left To Right, on Right To Left UI, everything starts from the Right.

It is like see the control through the mirror.

So point 0,0 on Latin bases system should be on the top left, and on the Right to left languages starts from the top right.

No (0,0) it must still start from Top Left like Windows

Show quoted text 5 lines
Some UI such as GTK2 (up to a point, it does not support all of what we require in Lazarus) support it, and so does Qt, and Windows API (on a native/enabled/unicode versions). In Windows many control not support Right To Left, and still have bugs in

Menu, TreeView.

But, we can use a native control that support Right To Left for Like TVirtualTreeView for example.

Best Regards

Zaher Dirkey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100412/8dfc348f/attachment.html>

Reply by email

Jesus Reyes
to Zaher Dirkey: On Mon, Apr 12, 2010 at 11:11 AM, Hans-Peter Diettrich < Win32, GTK2 and QT support…

--- El lun 12-abr-10, Zaher Dirkey escribi?:

De:: Zaher Dirkey
Asunto: Re: [Lazarus] [BIDI] TGrid and many bugs if i add Right To Left A: "Lazarus mailing list"
Fecha: lunes, 12 de abril de 2010, 6:00

On Mon, Apr 12, 2010 at 11:11 AM, Hans-Peter Diettrich wrote: ?

One problem may be the extent of BiDi support, that is unknown to most (western) developers. E.g. I even don't know how to enter RTL text, so that all related code should be implemented and checked by people that are familiar with RTL applications and environment.

Does there exist a list of things that should change in RTL mode?

Newer Windows systems have an API for rendering full Unicode text, including an mix of LTR and RTL parts. Do there exist similar libraries for other platforms or widgetsets (Qt???)? If yes, these libraries should be explored and a compatible wrapper (class) should be constructed, for immediate use in most components (SynEdit may be an exception). If not, an API must be defined first, and then the platform specific libraries must be implemented accordingly.

?Win32, GTK2 and QT support RTL(Right To Left reading), but i am not expiration with GTK2 and QT

But there seem to exist more issues with RTL, like the rows in a grid running from right to left? Such behaviour can be tested by everybody, at least by faking RTL mode to make the different appearance occur.

?Most native controls like grid will work on all widgetsets except draw the string inside the cell, so if it done for TLabel for GTK/QT this issue will resolved. TGrid in my svn draw its columns right to left, for that i opened this thread.

Hello Zaher,
Please send to me the patches related to grids.

Jesus Reyes A.

Encuentra las mejores recetas en Yahoo! Cocina.
http://mx.mujer.yahoo.com/cocina/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100412/f9727a8d/attachment.html>

Reply by email

Zaher Dirkey
to Jesus Reyes

2010/4/12 Jesus Reyes

Show quoted text 8 lines
Hello Zaher, Please send to me the patches related to grids. Jesus Reyes A.

Thanks Jesus for your replay, as i mentioned above, my work (the patch) not completed yet, but the patch i attached with this email will give the idea about my work.
if you found i can continue, or no you prefer a another way to make Bidi Grids or make my own Grid, just tell me please.

Thanks in advance.

Zaher Dirkey -------------- next part -------------- A non-text attachment was scrubbed... Name: grids.patch.zip Type: application/zip Size: 6068 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100413/85b3271a/attachment-0001.zip> -------------- next part -------------- A non-text attachment was scrubbed... Name: BidiGrid.jpg Type: image/jpeg Size: 6317 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100413/85b3271a/attachment-0001.jpg>

Reply by email

ik
to Zaher Dirkey

You see that you have changed the position of 0,0 :P

Ido
http://ik.homelinux.org/

2010/4/13 Zaher Dirkey

Show quoted text 27 lines
2010/4/12 Jesus Reyes > > > Hello Zaher, > Please send to me the patches related to grids. > > Jesus Reyes A. > > Thanks Jesus for your replay, as i mentioned above, my work (the patch) not completed yet, but the patch i attached with this email will give the idea about my work. if you found i can continue, or no you prefer a another way to make Bidi Grids or make my own Grid, just tell me please. Thanks in advance. -- Zaher Dirkey -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100413/6fe46efb/attachment.html>

Reply by email

Zaher Dirkey
to ik

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

Reply by email

Jesus Reyes
to Zaher Dirkey: 2010/4/12 Jesus Reyes Thanks Jesus for your replay, as i mentioned above, my work (the…

--- El mar 13-abr-10, Zaher Dirkey escribi?:

Show quoted text 26 lines
De:: Zaher Dirkey Asunto: Re: [Lazarus] [BIDI] TGrid and many bugs if i add Right To Left A: "Lazarus mailing list" Fecha: martes, 13 de abril de 2010, 12:58 2010/4/12 Jesus Reyes > > > Hello Zaher, > Please send to me the patches related to grids. > > Jesus Reyes A. > > Thanks Jesus for your replay, as i mentioned above, my work (the patch) not completed yet, but the patch i attached with this email will give the idea about my work. if you found i can continue, or no you prefer a another way to make Bidi Grids or make my own Grid, just tell me please. Thanks in advance. -- Zaher Dirkey

Hi Zaher, I'm sorry for the delay, please continue.

Your patch was commited in revision 24632 with a couple of minor edits.

Thanks.

Jesus Reyes A.

Reply by email

Zaher Dirkey
to Jesus Reyes
Jesus Reyes wrote
Hi Zaher, I'm sorry for the delay, please continue.

Do not sorry about delay, we all have job/contracts.

Your patch was commited in revision 24632 with a couple of minor edits.

Thanks a lots Jesus

Zaher Dirkey

Reply by email