Loading ...
Sorry, an error occurred while loading the content.

RevOut

Expand Messages
  • Glenn Maynard
    In win32 gui_mch_draw_string: if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), foptions | ETO_IGNORELANGUAGE,
    Message 1 of 3 , Aug 18, 2002
    • 0 Attachment
      In win32 gui_mch_draw_string:

      if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
      ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
      foptions | ETO_IGNORELANGUAGE,
      pcliprect, (char *)text, len, padding);
      else
      RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
      foptions, pcliprect, (char *)text, len, padding);

      RevOut claims that its code is needed for NT 5+ and 98+:

      /* Check windows version: special treatment is needed if it is NT 5 or
      * Win98 or higher. */
      if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
      && os_version.dwMajorVersion >= 5)
      || (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS
      && (os_version.dwMajorVersion > 4
      || (os_version.dwMajorVersion == 4
      && os_version.dwMinorVersion > 0))))
      special = 1;

      So, it's only being called in NT, but thinks the code is needed in NT5+
      and 98+. So there are four cases: <= 95, >= 98, <= NT4, >= NT5, and
      it's not clear which of them need the per-character code and which can
      use ETO_IGNORELANGUAGE. The selection should probably be done all in
      one place, rather than in two places (both RevOut and the call to
      RevOut). I don't think the "special" optimization does anything; I'd just
      put it all in the call, so we'd have:

      RevOut( HDC s_hdc,
      ...
      {
      int ix;
      for (ix = 0; ix < (int)len; ++ix)
      ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions,
      pcliprect, text + ix, 1, padding);
      }

      and

      if (curwin->w_p_rl && os_version.dwPlatformId != VER_PLATFORM_WIN32_NT)
      {
      RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
      foptions, pcliprect, (char *)text, len, padding);
      } else ...

      which is a lot simpler. However, I'm not entirely certain of the last
      conditional: which versions need RevOut and which need
      ETO_IGNORELANGUAGE.

      Other problems:
      1: This needs to be done all the time, not just when curwin->w_p_rl is
      set, or we get screen corruption if the file happens to have Hebrew/Arabic
      text in it. We should always render all Unicode text documents without
      screen corruption, even if it's not "right" for the language itself.

      2: This needs to be done in Unicode, too. If I paste Arabic text when
      enc=UTF-8, I get graphical glitches. (Well, I do if I comment out
      ETO_IGNORELANGUAGE, which indicates that this would happen in 9x.)

      Perhaps we should just *always* draw character-by-character? Is it
      ever noticably slower? (I can't tell; I'm on a K7/1000.) There
      doesn't seem to be an easy way to find out if there are characters
      in the text that Windows is going to mess with.

      --
      Glenn Maynard
    • Bram Moolenaar
      ... I didn t see a response or folloup about this. Do we need to change anything, or should we just wait until someone complains there is a problem? ... Would
      Message 2 of 3 , Oct 6, 2002
      • 0 Attachment
        Glenn Maynard wrote on Aug 18:

        > In win32 gui_mch_draw_string:
        >
        > [...]
        >
        > RevOut claims that its code is needed for NT 5+ and 98+:
        >
        > [...]
        > So, it's only being called in NT, but thinks the code is needed in NT5+
        > and 98+. So there are four cases: <= 95, >= 98, <= NT4, >= NT5, and
        > it's not clear which of them need the per-character code and which can
        > use ETO_IGNORELANGUAGE. The selection should probably be done all in
        > one place, rather than in two places (both RevOut and the call to
        > RevOut). I don't think the "special" optimization does anything; I'd just
        > put it all in the call, so we'd have:

        I didn't see a response or folloup about this. Do we need to change
        anything, or should we just wait until someone complains there is a
        problem?

        > Other problems:
        > 1: This needs to be done all the time, not just when curwin->w_p_rl is
        > set, or we get screen corruption if the file happens to have Hebrew/Arabic
        > text in it. We should always render all Unicode text documents without
        > screen corruption, even if it's not "right" for the language itself.

        Would there ever be Hebrew/Arabic text without 'rightleft' set?

        > 2: This needs to be done in Unicode, too. If I paste Arabic text when
        > enc=UTF-8, I get graphical glitches. (Well, I do if I comment out
        > ETO_IGNORELANGUAGE, which indicates that this would happen in 9x.)

        This should be simple to solve.

        > Perhaps we should just *always* draw character-by-character? Is it
        > ever noticably slower? (I can't tell; I'm on a K7/1000.) There
        > doesn't seem to be an easy way to find out if there are characters
        > in the text that Windows is going to mess with.

        I do think it would cause a slowdown. Calling a windows system function
        does have overhead.

        --
        hundred-and-one symptoms of being an internet addict:
        134. You consider bandwidth to be more important than carats.

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
      • Glenn Maynard
        ... Well, I was trying to track down what was being done where, and what problems happened when, and this complicated things a good bit. ... Editing
        Message 3 of 3 , Oct 6, 2002
        • 0 Attachment
          On Sun, Oct 06, 2002 at 06:49:09PM +0200, Bram Moolenaar wrote:
          > I didn't see a response or folloup about this. Do we need to change
          > anything, or should we just wait until someone complains there is a
          > problem?

          Well, I was trying to track down what was being done where, and what
          problems happened when, and this complicated things a good bit.

          > Would there ever be Hebrew/Arabic text without 'rightleft' set?

          Editing multilingual text (eg. translation data); it'd be unpleasant
          if I wanted to change some text in one language and saw screen
          corruption for others.

          > > Perhaps we should just *always* draw character-by-character? Is it
          > > ever noticably slower? (I can't tell; I'm on a K7/1000.) There
          > > doesn't seem to be an easy way to find out if there are characters
          > > in the text that Windows is going to mess with.
          >
          > I do think it would cause a slowdown. Calling a windows system function
          > does have overhead.

          It might be a measurable but meaningless slowdown.

          Or it might be a real slowdown. The only safe way to find out is to
          test it, but I don't have access to any really slow machines.

          FYI, I have all of these patches and I've summarized them at
          http://zewt.org/vim . I havn't thrown them out because I've gone silent
          recently, I've just been working on some other projects. (I don't think
          this is complete; the file I/O CP code isn't mentioned, at least.)

          --
          Glenn Maynard
        Your message has been successfully submitted and would be delivered to recipients shortly.