More Japanese in WPRichEdit

  • There are two Japanese issues users are experiencing, the first is that if you type text in full size katakana and then try to insert a space, nothing happens until the text is repainted, i.e. you select the text where you expect the space to appear. All the spaces you typed will then appear.

    Secondly, and I don't know if there is anything that can be done about this, if you copy Japanese text from a WPRichText memo and paste it into word, the encoding is not brought over and you get garbage mojibake. However, if you do a Paste Special in Word and choose "Unformatted Text" or "Unformatted Unicode Text" it does come over OK.

    There is a third issue that I haven't actually been able to repeat yet (probably because I don't know how to type Japanese) but one that someone may recognise is that the Japanese users showed typing Japanese text on a line. The line began with katakana and ended with hiragana and some characters were invisible until the user hit Enter, there was a space where they were expected.

    These problems also occur on the MultiDemo exe, which I think means it affects WPTools 6 as well. This is on Delphi 7 and WPTools 5.51.

    • Offizieller Beitrag

    Hi,

    Please note: Japanese uses very special word wrap logic, that has not been implemented into WPTools.

    The other problems may be caused because of the use of simply double byte characters by wptools. Is it possible that that characters rather use multibytes?

    I do not have the expertise to elaborate on this.

    Julian

  • I don't think the Japanese word wrapping rules (which I think are called kinsoku shori) are the issue, they don't appear to apply to the text I've seen used. Also, I've tried typing a like 5 Japanese characters and then tried inserting a space and nothing appears until I select the text, it seems like an issue similar to the previous one I looked for help on.

  • OK, I think I've made a bit progress, InsertWideString() appears to never handle the painting correctly, regardless of the language, as a workaround I have tried modifying WMIMEEndComposition()

    Code
    procedure TWPCustomRtfEdit.WMIMEEndComposition(var Message: TMessage);
    begin
      inherited;
    
    
      if Assigned(FMemo._EditBox) then
        FMemo._EditBox.Invalidate();
    end;

    This seems to solve problems inputting Japanese text, but I suspect it's not the preferred solution.