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

quartz.diff

Expand Messages
  • Rain Dog
    Attached is a patch to gui_mac.c (current CVS version) that enables Quartz text antialiasing under OSX 10.2.0 ( Jaguar ) and higher. Though I suppose it s a
    Message 1 of 5 , Dec 8, 2002
    • 0 Attachment
      Attached is a patch to gui_mac.c (current CVS version) that enables
      Quartz text antialiasing under OSX 10.2.0 ("Jaguar") and higher.
      Though I suppose it's a matter of personal taste, I find Quartz text
      to be much more readable than the old QuickDraw antialiased text,
      and the look is consistent with native OSX apps.

      This patch should have no effect unless Vim is being built under Jaguar,
      but I've been able to test it only on a Jaguar system, and even then
      not exhaustively. Hopefully, someone can test this with multibyte text
      and/or on other systems. (If there are linking problems on earlier
      systems, I think I know how to correct them).

      ---------- 8< ---------- 8< ---------- 8< ---------- 8< ----------

      *** gui_mac.c Sat Nov 30 12:21:04 2002
      --- gui_mac.c Sat Nov 30 12:26:24 2002
      ***************
      *** 2790,2795 ****
      --- 2790,2806 ----
      gui.scrollbar_height = gui.scrollbar_width = 15; /* cheat 1
      overlap */
      gui.border_offset = gui.border_width = 2;

      + #ifdef MACOS_X
      + SInt32 sys_version = 0;
      + Gestalt(gestaltSystemVersion, &sys_version);
      + if (sys_version >= 0x1020)
      + {
      + /* If OS is 10.2 or greater, use Quartz-style text antialiasing. */
      + UInt32 qd_flags = kQDUseCGTextRendering | kQDUseCGTextMetrics;
      + (void)SwapQDTextFlags(qd_flags);
      + }
      + #endif
      +
      /* TODO: Load bitmap if using TOOLBAR */
      return OK;
      }
      ***************
      *** 3248,3253 ****
      --- 3259,3297 ----
      int len;
      int flags;
      {
      +
      + #ifdef MACOS_X /* On OS X, try using new Quartz-style text
      antialiasing. */
      + StyleParameter face;
      + face = normal;
      + if (flags & DRAW_BOLD)
      + face |= bold;
      + if (flags & DRAW_UNDERL)
      + face |= underline;
      + TextFace(face);
      +
      + /* Quartz-style text antialiasing works only in srcOr transfer
      mode. */
      + TextMode(srcOr);
      +
      + if (!(flags & DRAW_TRANSP))
      + {
      + /*
      + * Since we're using srcOr mode, we have to clear the block
      + * before drawing the text. The following is like calling
      + * gui_mch_clear_block(row, col, row, col + len - 1),
      + * but without setting the bg color to gui.back_pixel.
      + */
      + Rect rc;
      + rc.left = FILL_X(col);
      + rc.top = FILL_Y(row);
      + rc.right = FILL_X(col + len) + (col + len == Columns);
      + rc.bottom = FILL_Y(row + 1);
      + EraseRect(&rc);
      + }
      +
      + MoveTo(TEXT_X(col), TEXT_Y(row));
      + DrawText((char*)s, 0, len);
      +
      + #else /* If not on OS X, use old-style QuickDraw text antialiasing. */
      TextMode (srcCopy);
      TextFace (normal);

      ***************
      *** 3274,3279 ****
      --- 3318,3324 ----
      MoveTo (FILL_X(col), FILL_Y(row + 1) - 1);
      LineTo (FILL_X(col + len) - 1, FILL_Y(row + 1) - 1);
      }
      + #endif /* defined(MACOS_X) */
      }

      /*
    • Benji Fisher
      ... [patch snipped] I tried this with OSX 10.2.3 . Two problems: 1. Status messages (such as the More prompt and the Hit ENTER prompt) are not rendered
      Message 2 of 5 , Feb 2, 2003
      • 0 Attachment
        Rain Dog wrote:
        > Attached is a patch to gui_mac.c (current CVS version) that enables
        > Quartz text antialiasing under OSX 10.2.0 ("Jaguar") and higher.
        > Though I suppose it's a matter of personal taste, I find Quartz text
        > to be much more readable than the old QuickDraw antialiased text,
        > and the look is consistent with native OSX apps.
        >
        > This patch should have no effect unless Vim is being built under Jaguar,
        > but I've been able to test it only on a Jaguar system, and even then
        > not exhaustively. Hopefully, someone can test this with multibyte text
        > and/or on other systems. (If there are linking problems on earlier
        > systems, I think I know how to correct them).
        >
        [patch snipped]

        I tried this with OSX 10.2.3 . Two problems:

        1. Status messages (such as the More prompt and the Hit ENTER prompt)
        are not rendered correctly. If you cannot reproduce this, I will give a
        better description.

        2. The text looks fuzzy to me. As you say, this is a matter of taste.
        I tried it with

        :set gfn=courier:h12

        What font do you use?

        I will not include this patch in my next binary release. Can you
        make Quartz/QuickDraw a compile-time option? (Even better would be a
        window-local run-time option, but I have a feeling that is asking for
        too much.)

        --Benji Fisher
      • Rain Dog
        ... I m not seeing this. Is it a problem with all boldface text, or just status messages? ... courier:h12 does seem a bit fuzzy to me. I use monaco:h11,
        Message 3 of 5 , Feb 8, 2003
        • 0 Attachment
          On Sunday, February 2, 2003, at 05:53 AM, Benji Fisher wrote:

          > Rain Dog wrote:
          >> Attached is a patch to gui_mac.c (current CVS version) that enables
          >> Quartz text antialiasing under OSX 10.2.0 ("Jaguar") and higher.
          >
          > I tried this with OSX 10.2.3 . Two problems:
          >
          > 1. Status messages (such as the More prompt and the Hit ENTER prompt)
          > are not rendered correctly. If you cannot reproduce this, I will give
          > a better description.

          I'm not seeing this. Is it a problem with all boldface text, or just
          status messages?

          > 2. The text looks fuzzy to me. As you say, this is a matter of taste.
          > I tried it with
          >
          > :set gfn=courier:h12
          >
          > What font do you use?

          courier:h12 does seem a bit fuzzy to me. I use monaco:h11, which is
          more legible,
          and actually somewhat larger.

          Peter
        • Benji Fisher
          ... Good question. It is all bold face text. It seems to be a font problem. With monaco:h11 there is no problem, but with the default font or with
          Message 4 of 5 , Feb 10, 2003
          • 0 Attachment
            Rain Dog wrote:
            >
            > I'm not seeing this. Is it a problem with all boldface text, or just
            > status messages?

            Good question. It is all bold face text. It seems to be a font
            problem. With monaco:h11 there is no problem, but with the default font
            or with monaco:h12 or monaco:h10 there is a problem. The bold versions
            of these fonts act as if they are not mono-spaced. (At least, I have
            seen similar problems with Linux gvim using variable-width fonts.) With
            standard syntax highlighting, I looked at a C file (src/version.c) and
            type declarations (static int) are in green bold, and they are messed up.

            > courier:h12 does seem a bit fuzzy to me. I use monaco:h11, which is
            > more legible,
            > and actually somewhat larger.

            OK, monaco looks pretty good, but there is much less difference
            between the two rendering schemes. In fact, I cannot tell them apart.
            Also, I hate the "#" character in this font. YMMV.

            --Benji Fisher
          • Benji Fisher
            ... I still see a problem with monaco:h10 but not with monaco:h12 . (Maybe I was mistaken when I said that was a problem.) There is also a problem with
            Message 5 of 5 , Feb 14, 2003
            • 0 Attachment
              Rain Dog wrote:
              > On Monday, February 10, 2003, at 07:05 AM, Benji Fisher wrote:
              >
              >> Rain Dog wrote:
              >>
              >>> I'm not seeing this. Is it a problem with all boldface text, or just
              >>> status messages?
              >>
              >>
              >> Good question. It is all bold face text. It seems to be a font
              >> problem. With monaco:h11 there is no problem, but with the default
              >> font or with monaco:h12 or monaco:h10 there is a problem. The bold
              >> versions of these fonts act as if they are not mono-spaced.
              >
              >
              > In the General category of System Preferences there's an option to turn
              > off text
              > smoothing for small font sizes. If it isn't already, would you mind to
              > set yours
              > to the lowest value (8) and let me know if you still see problems with
              > Monaco and
              > Courier at the sizes we've been discussing?
              >
              > Thanks,
              > Peter

              I still see a problem with monaco:h10 but not with monaco:h12 .
              (Maybe I was mistaken when I said that was a problem.) There is also a
              problem with courier:h10 .

              I had it set to 9 before. When I set it to the largest possible
              value (12) the text looks much less fuzzy. (I see there is also a
              choice for "Font smoothing style." Since I have a PowerBook, maybe I
              should change that. ...)

              HTH --Benji Fisher
            Your message has been successfully submitted and would be delivered to recipients shortly.