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

702RevOut

Expand Messages
  • Glenn Maynard
    Aug 18, 2002
      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
    • Show all 3 messages in this topic