Recent

Author Topic: Hebrew entries  (Read 11722 times)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Hebrew entries
« Reply #30 on: August 18, 2016, 09:12:22 pm »
Can I say "very cool"? I haven't tried it yet, but it looks like simple code... what gives it a hefty overhead?
Just the fact that richedit has to do parsing for a single character is an overhead enough.

Besides, it's a bit hacky, since it relies on the fact, richedit would not enforce any layout and "injects" within \rtlpar or \rtlchr.

So all in all, it's a non-cross-platform workaround, with a potential to fail in future (though it works here in Windows 10).

... On the other hand, it's a legit solution (:D), since richedit declares an ability to accept RTF :)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #31 on: August 18, 2016, 09:14:39 pm »
I have finished the Hebrew keyboard. All of it works nicely. I think I am going to avoid the Windows Keyboard Layout. If I can't switch keyboards by code, I just see it as being too clumsy of a way to do it. Stifles invention.

Syriac is next. It shouldn't take long.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #32 on: August 18, 2016, 09:18:35 pm »
Quote
Besides, it's a bit hacky, since it relies on the fact, richedit would not enforce any layout and "injects" within \rtlpar or \rtlchr.

I think it is what I was hoping for. It looks like I can manipulate the RTF code.
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #33 on: August 18, 2016, 09:23:27 pm »
btw... I believe in hacks. The designers are fabulous people, but they have left us hanging on the ends of limbs by ourselves. We have to figure it out and keep going.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #34 on: August 18, 2016, 09:30:01 pm »
skalogryz,

Do you think that RichEdit has a tool for saving images within a document? Maybe even proportionately resizing an image?

Rick
« Last Edit: August 18, 2016, 09:32:41 pm by rick2691 »
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Hebrew entries
« Reply #35 on: August 18, 2016, 09:33:10 pm »
Do you think that RichEdit has a tool for saving images within a document?
If I remember correctly - yes, somewhat. When RichEdit streams-out RTF it allows to specify how to save an OLE object (an image) into RTF.
That's the way to add an image to the resulting RTF file.
The same approach is used when loading RTF.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2280
    • havefunsoft.com
Re: Hebrew entries
« Reply #36 on: August 19, 2016, 06:42:15 am »
Maybe even proportionately resizing an image?
Yes, it is possible.
No worries, I remember the thread. I should add these functions soon... like the next week :)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #37 on: August 19, 2016, 03:41:18 pm »
Thank you very much.

The Syriac is now complete. I may not do the Greek. I don't love Greek. You have to love a language in order to rightly do a phonetic keyboard.

The Estrangelo Edessa and Estrangelo Talada (Syriac Fonts) are Cadillac's. Either of them does most of the work for me. They have reactors that automatically edit your typing as you go. If letters should be joined, it does so. If they are enders, it handles it.

The draw back is that "as you go" is the operational mode. If you missed a vowel, and you go back to insert it, it may not like it. You could have to delete the consonant, retype it, then hit the vowel... but on my end, it is half the code (if not a third) that I would have to build. Script writing (which they are) is very complicated.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #38 on: August 22, 2016, 02:55:26 pm »
I have changed my method for activating RTL. I placed the MakeRTLPara code within my Format Paragraph routine. Now the Hebrew and Syriac Modes are only loading the font. For reasons beyond me they are typing left to right and advancing the cursor. Must be a reactor embedded within the font that gets activated at loading it. But that speculation doesn't answer why it wasn't happening before I was using the MakeRTLPara code that you supplied. I guess I was just trying too many things too fast.

I am however still having trouble with your InsertAsRTF function. It doesn't seem to do anything. At present, with not using it, a space character is jumping to the right side of an RTL entry, then jumping to the proper position upon hitting another Semitic key. It may be somebody's idea that you have gone Latin until you haven't.

Nevertheless, A period will jump the same way, but it will stay there. The same somebody must think that a period is certainly an exit from RTL... unless it is an RTL paragraph. Then there is no problem.

I am going to try using the InsertAsRTF function again. Perhaps with my current changes it will work as well.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #39 on: August 22, 2016, 03:07:01 pm »
I tried the following...

Code: Pascal  [Select]
  1. ' ' : begin
  2.                 UTF8Key:= #0;
  3.                 InsertAsRTF(PageMemo, ' ');
  4.                 PageMemo.SelStart:= PageMemo.SelStart+1;
  5.                 PageMemo.SelLength:= 0;
  6.                 end;
  7.           '.' : begin
  8.                 UTF8Key:= #0;
  9.                 InsertAsRTF(PageMemo, '.');
  10.                 PageMemo.SelStart:= PageMemo.SelStart+1;
  11.                 PageMemo.SelLength:= 0;
  12.                 end;
  13.  

It acted the same as operating without it. So it looks like I am fighting the system.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #40 on: August 22, 2016, 03:24:01 pm »
I have removed the InsertAsRTF section. Then I remembered that I was always testing RTL between two asterisks "**", in order to visually see that nothing extra was inserted. It will not advance the cursor with that condition, even though itplaces the Hebrew at the right spot. There has to be a space separator for it to advance the cursor. The "period" key will resume LTR as before. Both appear to be behaviors by the font reactors or the system itself.

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #41 on: August 23, 2016, 07:04:14 pm »
I think I may have found what could be a problem with the InsertAsRTF function. With the code line... s:= '{\rtf1\ansi '+s+'}';

"{rtf1...}" is the document container for the entire file. Shouldn't it have a more local address?

Perhaps something like... '\lang1037\f2\rtlch'

If so, can 'lang1037' and 'f2' be deduced from within the memo?

Rick
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 375
Re: Hebrew entries
« Reply #42 on: August 23, 2016, 07:33:55 pm »
OK. I found that \lang1037 is a constant that identifies the Hebrew language.

I believe that f2 is just the 2nd font event, and it might increment automatically every time you change font parameters. The language might also be automatically set by the font.

Perhaps a simple   '\rtlch'+s   is all that is needed.
Windows 10, LAZ 1.6.4, FPC 3.0.2, SVN 54278, i386-win32-win32/win64, forms use windows unit