Recent

Author Topic: SynEdit input chinese symbel problem patch.  (Read 4664 times)

steven2

  • New member
  • *
  • Posts: 7
SynEdit input chinese symbel problem patch.
« on: July 01, 2013, 09:38:00 am »
Hello,every body!

  I was found a bug for input chinese ,below is my patch !

  My env:
  windows xp sp3
  lazarus 1.0.8

  The below .zip file contain two files:

  synedittextdoublewidthchars.pas  is modified file, and synedittextdoublewidthchars2.pas is a new unit file.

  You can compare them with lazarus org. file.

  I think you can use it for new versions.

  I am a chinese.
 
« Last Edit: July 01, 2013, 10:17:01 am by steven2 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #1 on: July 01, 2013, 10:17:13 am »

Also please upload it to http://bugs.freepascal.org/ instead of the forum. It may be forgotten, if on the forum.

Please also add what the problem is? I assume some chars are displayed overlapped? Please indicate (in hex) which chars.

If it is full versus half width issue:
What property do the chars have in http://www.unicode.org/Public/5.1.0/ucd/EastAsianWidth.txt

Some chars are "ambiguous", I have not yet checked where the unicode standard defines how to resolve them. If your patch deals with them we need to find where this is defined.

------
I will be away for 2 weeks, so there may not be a reaction in that time.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #2 on: July 01, 2013, 10:30:44 am »
Just looked at the patch.

----
The list contains items like 0x0300 (accent) which are ambigious.
(Though it seems, this is for combining, which is not handled in that file.)

On the other hand
Code: [Select]
  if Line^ < #$e1 then continue;It is not called for them anyway. So why include them?

----

Code: [Select]
(ucs  > $2329) and (ucs <$a4cf)or
This range contains a lot of codepoints that are not fullwidth according to the copy of unicode documentation that I found.
Where did you get this?

----
Why throw away the existing code entirely? How many codepoints are missing or wrong?
« Last Edit: July 01, 2013, 10:37:47 am by Martin_fr »

steven2

  • New member
  • *
  • Posts: 7
Re: SynEdit input chinese symbel problem patch.
« Reply #3 on: July 01, 2013, 10:34:56 am »
Thanks for your reply. :)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #4 on: July 01, 2013, 10:38:21 am »
I edited the last note

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #5 on: July 01, 2013, 10:42:13 am »
Maybe you want to experiment with this (windows only)

 {$IFDEF WithSynExperimentalCharWidth}
  SynEditTextSystemCharWidth,
  {$ENDIF}

It can probably be extended.

However, this is experimental, and will not  make it into production code any time soon.

------------
Note:
About combining codepoints. They must be known in
Code: [Select]
function TSynEditStringList.LogicPosIsCombining(const AChar: PChar): Boolean;

Or backspace and delete will not work

steven2

  • New member
  • *
  • Posts: 7
Re: SynEdit input chinese symbel problem patch.
« Reply #6 on: July 01, 2013, 10:44:48 am »
I use the function convert UTF-8 charator to Unicode ,and then use the second unit to search the double width charactor ,return not a double charactor result while the charactor is not a UTF-8 charator.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #7 on: July 01, 2013, 10:48:38 am »
But the 2nd unit seems to contain a lot of unrelated functionality, that i not needed?

Where did it originate from (seems to be copied from somewhere?)

Again, which codepoint are missing in the original.

steven2

  • New member
  • *
  • Posts: 7
Re: SynEdit input chinese symbel problem patch.
« Reply #8 on: July 01, 2013, 10:55:50 am »
I was found this code from Internet ,forgot it's URI now.

May be the code have a lite bugs.

Buy I use this patch in my tools is very well. ;)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7153
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit input chinese symbel problem patch.
« Reply #9 on: July 01, 2013, 11:06:27 am »
Well I can not take a patch without knowing the origin.
I need to be able to verify that using it does not violate any licenses.

Also as I explained, I would rather fix the existing code, than replace it.
So, if you know which chars are causing the problems?

And, looking at the line I pointed out, the code seems wrong, and will risk breaking none Chinese text.

All chars must be handled according to the unicode standard.
If that does not work for you, then you may have a font, which is incorrect.

steven2

  • New member
  • *
  • Posts: 7
Re: SynEdit input chinese symbel problem patch.
« Reply #10 on: July 01, 2013, 11:13:18 am »
Thank you very much.

 

TinyPortal © 2005-2018