Can't select text correctly with Show Spaces/Tabs enabled for UTF-8 file with SimSun font

Can't select text correctly with Show Spaces/Tabs enabled for UTF-8 file with SimSun font

7
NewbieNewbie
7

    May 28, 2015#1

    I have always found this problem for more than five years in every UE version.
    This is a simple way to show this problem.

    We always use Chinese characters in our text file with encoding UTF-8, when click "View - Show Spaces/Tabs and Show Line Endings", then selected text will change not controlled.
    Just like this image
    Display selected text position always incorrect.png (51.5KiB)
    UE display selected text position always incorrect

    Include Chinese characters in file with encoding UTF-8
    test.rar (2.98 KiB)   90
    Include Chinese characters in file with encoding UTF-8

    I have to disable Show Spaces/Tabs and Show Line Endings, when I want to select text in file. That is terrible for us.

    My current version is UltraEdit Professional Text/HEX Editor Version 21.30.0.1024, but this problem can display in every UE version which I have used UE for several versions.

    OS: Microsoft Windows 8 企业版(mean is Enterprise)
    Version: 6.2.9200 暂缺 Build 9200

    6,604548
    Grand MasterGrand Master
    6,604548

      May 28, 2015#2

      First, I had to correct in second line lang=zh-tw"> to lang="zh-tw"> to get the HTML file correct highlighted with my wordfile for HTML containing in first line EnableMLS (enable multi-line string highlighting).

      Second, I'm using English UE v22.0.0.66 on English Windows 7 x64 with Windows Region and Language Settings set to German (Austria). I view your HTML file with font Courier New. My syntax highlighting does not contain bold and italic styles which requires a fixed pitch font to avoid problems because of different character widths depending on style. The problem cannot be reproduced with my configuration. There is no problem with selection with Show Spaces/Tabs and Show Line Endings enabled.

      Third, do you have ever reported this issue to IDM support by email with detailed information about configuration, best by attaching to email a ZIP or RAR file containing entire directory %APPDATA%\IDMComp\UltraEdit?
      (It is also possible to use in UltraEdit Backup/Restore User Customizations from menu Advanced and select all to be included in the file attach to the email.)

      This is a user-to-user forum as it can be read at top of every forum page. Therefore reporting here a problem will not result in a fix in a future version of UltraEdit.
      Best regards from an UC/UE/UES for Windows user from Austria

      7
      NewbieNewbie
      7

        May 28, 2015#3

        Dear Mofi,

        thank for your help.

        I set font as 宋体 (simsun.ttc) in my UE.

        My UltraEdit theme is Slate.

        Themes is Slate.png (39.07KiB)
        Theme is slate

        I will report this problem to IDM support.

        Thanks.

        6,604548
        Grand MasterGrand Master
        6,604548

          May 28, 2015#4

          Okay, I could see the problem now with font SimSun installed as font collection together with NSimSun. Those 2 fonts are available only for regular style which means bold and italic style can be only emulated by font rendering engine of Windows with the result discussed already once at Default Font, Letters cut off.

          But even more worse here with this font is the fact that the interpunct symbol used by UE to display a space character has a much wider width than the space character which is not typical. The reason is explained on the referenced Wikipedia page about interpunct symbol. In Chinese this symbol has a different meaning (partition sign) as in English (space dot) which is the reason for being much wider in the Chinese font SimSun. Therefore the font SimSun is not even a monospaced font.

          Microsoft Word 2010 solves this problem by ignoring real width of interpunct symbol and draws the interpunct symbols with same width as a space character when enabling showing paragraph marks and other hidden symbols, see attached image where I marked two interpunct symbols with a red circle. It can be also seen on this screenshot that using italic with this font is in general not a good idea.

          UltraEdit takes for drawing the text the larger width of the interpunct symbol in this Chinese font into account which results on moving every text right of a space character to right on enabling Show Spaces/Tabs and to left on disabling this feature.

          But UltraEdit does not take the larger width of interpunct symbol in comparison to space character into account on calculating position of caret in file.

          This font is an Open True Type font and it is legal to edit it for personal usage. So as workaround you could make a copy of font SimSun, give this copy the file name simsunmo.ttc, change name of font slightly for example to SimSun-Mod using a font editor, and edit also with font editor the interpunct symbol by reducing space on left and right side of the middle dot to get same width as space character has. Then install font SimSun-Mod and select this font in UltraEdit. This would have the advantage that the displayed text no longer jumps left/right on disabling/enabling Show Spaces/Tabs.

          There is no width problem with right-pointing double angle quotation mark used to display a horizontal tab character as this character has the same width as a space character.
          SimSunHtmlWord2010.png (82.97KiB)
          Part of HTML file with font SimSun in MS Word 2010
          Best regards from an UC/UE/UES for Windows user from Austria