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

Re: Request: Text Rendering as in SubEthaEdit

Expand Messages
  • Jjgod Jiang
    Hi,On Sun, Jan 4, 2009 at 12:36 AM, björn wrote: I m not entirely certain, but I think screen fonts means bitmap fonts. I
    Message 1 of 13 , Jan 3, 2009
    • 0 Attachment
      Hi,

      On Sun, Jan 4, 2009 at 12:36 AM, björn <bjorn.winckler@...> wrote:
      > I'm not entirely certain, but I think "screen fonts" means bitmap
      > fonts. I vaguely remember some option to use these in the Cocoa
      > frameworks, but I'll have to take a closer look and get back to you.
      > (Jiang: do you know how this works with ATSUI?)

      There is a setUsesScreenFonts: method in NSLayoutManager. Even
      though I still have no idea what a screen font means here, [1]
      may give us a hint.

      - Jiang

      [1]: http://www.cocoabuilder.com/archive/message/cocoa/2003/4/10/91712

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • David Alan Hjelle
      Linespace helped quit a bit. The MMCelWidthMultiplier 1.02 seemed too large, but it didn t seem to support as fine a grain as 1.005, so I ll leave it for now.
      Message 2 of 13 , Jan 3, 2009
      • 0 Attachment
        Linespace helped quit a bit. The MMCelWidthMultiplier 1.02 seemed too
        large, but it didn't seem to support as fine a grain as 1.005, so I'll
        leave it for now.

        Thanks!

        On Jan 3, 11:36 am, "björn" <bjorn.winck...@...> wrote:
        > Hi,
        >
        > 2009/1/3 David Alan Hjelle <dahje...@...>:
        >
        >
        >
        > > I just opened my copy of SubEthaEdit, and I noticed that the text
        > > rendering under the same font (9 point DejaVu Sans Mono) was
        > > considerably more readable for code in SubEthaEdit. After a bit of
        > > experimentation, I noticed that SubEthaEdit has a "Advanced" tab in
        > > preferences that includes an option labeled "Disable screen fonts."
        > > I'm afraid I don't have the expertise to know what this option really
        > > does, but having a similar option in MacVim would greatly improve its
        > > aesthetics.
        >
        > I'm not entirely certain, but I think "screen fonts" means bitmap
        > fonts.  I vaguely remember some option to use these in the Cocoa
        > frameworks, but I'll have to take a closer look and get back to you.
        > (Jiang: do you know how this works with ATSUI?)
        >
        > > Otherwise, I noticed that Terminal.app has options to increase the
        > > character and line spacing. These options might help a lot, too.
        >
        > To set linespace use the 'linespace' option, e.g.
        >
        > :set linespace=5
        >
        > Changing character spacing currently requires a bit more work.  Start
        > Terminal and type:
        >
        > defaults write org.vim.MacVim MMCellWidthMultiplier 1.2
        >
        > Change the value "1.2" for whatever you like (the default is "1").
        > You'll have to quit and restart MacVim for this change to take effect.
        >
        > Björn
        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • David Alan Hjelle
        Jiang, I sent you an email with some screenshots. There are two from SubEthaEdit, with and without the Disable Screen Fonts option checked. My opinion is
        Message 3 of 13 , Jan 3, 2009
        • 0 Attachment
          Jiang,

          I sent you an email with some screenshots.

          There are two from SubEthaEdit, with and without the "Disable Screen
          Fonts" option checked. My opinion is that the one with the option
          checked (the one that looks most different from MacVim) is more
          readable. It might just be a matter of character spacing, but it might
          also be some fiddling with the details of the antialiasing. I'm not
          sure.

          Let me know if there is more I can do!

          On Jan 3, 11:48 am, "Jjgod Jiang" <gzjj...@...> wrote:
          > Hi,
          >
          > On Sun, Jan 4, 2009 at 12:03 AM, David Alan Hjelle <dahje...@...> wrote:
          >
          > > I just opened my copy of SubEthaEdit, and I noticed that the text
          > > rendering under the same font (9 point DejaVu Sans Mono) was
          > > considerably more readable for code in SubEthaEdit. After a bit of
          > > experimentation, I noticed that SubEthaEdit has a "Advanced" tab in
          > > preferences that includes an option labeled "Disable screen fonts."
          > > I'm afraid I don't have the expertise to know what this option really
          > > does, but having a similar option in MacVim would greatly improve its
          > > aesthetics.
          >
          > So what do you mean by "considerably more readable"? Do you mind
          > send me a screenshot comparing these two?
          >
          > - Jiang
          >
          > [1]http://www.codingmonkeys.de/subethaedit/faq.html
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Jjgod Jiang
          Hi David, ... I ve seen these screenshots, however, to my eyes, the only difference is the character spacing. To whom interested in a technical details, I
          Message 4 of 13 , Jan 4, 2009
          • 0 Attachment
            Hi David,

            On Sun, Jan 4, 2009 at 11:31 AM, David Alan Hjelle <dahjelle@...> wrote:
            > I sent you an email with some screenshots.
            >
            > There are two from SubEthaEdit, with and without the "Disable Screen
            > Fonts" option checked. My opinion is that the one with the option
            > checked (the one that looks most different from MacVim) is more
            > readable. It might just be a matter of character spacing, but it might
            > also be some fiddling with the details of the antialiasing. I'm not
            > sure.

            I've seen these screenshots, however, to my eyes, the only difference
            is the character spacing.

            To whom interested in a technical details, I think it can be explained
            as follow:

            1. NSLayoutManager has a usesScreenFonts option. By default it's set to
            YES. Which means for font sizes less than 16.0 (px), use corresponding
            screen font to substitute the given font if available. Which is believed
            to provide better font hinting and metrics information. If this option
            is on, then glyph advance (character spacing included) will not linearly
            scaled with font size. If this option is off, then no screen font data
            will be used, which gives what David observed in SubEthaEdit when
            "Disable screen fonts" is checked.

            2. For a simple program uses NSLayoutManager to render text, we can
            simply call [someLayoutManager setUsesScreenFonts: NO] to achieve what
            David wants to have (more liberal character spacing), however, MacVim's
            text renderer is more complicated than that, in MMTextStorage, cellSize.
            width is calculated with the -sizeWithAttributes: method of NSString,
            which has no idea whether we are going to use screenFont or not.

            3. I tried -printerFont: method of NSFont, however it seems it cannot
            provide a different output as we expected.

            - Jiang

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • David Alan Hjelle
            Yeah, that must be what s going on. I took a more careful look, and I agree that there is very little difference in the antialiasing between the two samples.
            Message 5 of 13 , Jan 4, 2009
            • 0 Attachment
              Yeah, that must be what's going on. I took a more careful look, and I
              agree that there is very little difference in the antialiasing between
              the two samples. The character spacing makes the difference in
              readability.

              I tried Björn's suggestion to use

              defaults write org.vim.MacVim MMCellWidthMultiplier 1.2

              but I didn't seem to be able to get the multiplier down far enough to
              be reasonable.

              Anyhow, thank you all for your time and input!

              David

              On Jan 4, 3:39 am, "Jjgod Jiang" <gzjj...@...> wrote:
              > Hi David,
              >
              > On Sun, Jan 4, 2009 at 11:31 AM, David Alan Hjelle <dahje...@...> wrote:
              >
              > > I sent you an email with some screenshots.
              >
              > > There are two from SubEthaEdit, with and without the "Disable Screen
              > > Fonts" option checked. My opinion is that the one with the option
              > > checked (the one that looks most different from MacVim) is more
              > > readable. It might just be a matter of character spacing, but it might
              > > also be some fiddling with the details of the antialiasing. I'm not
              > > sure.
              >
              > I've seen these screenshots, however, to my eyes, the only difference
              > is the character spacing.
              >
              > To whom interested in a technical details, I think it can be explained
              > as follow:
              >
              > 1. NSLayoutManager has a usesScreenFonts option. By default it's set to
              > YES. Which means for font sizes less than 16.0 (px), use corresponding
              > screen font to substitute the given font if available. Which is believed
              > to provide better font hinting and metrics information. If this option
              > is on, then glyph advance (character spacing included) will not linearly
              > scaled with font size. If this option is off, then no screen font data
              > will be used, which gives what David observed in SubEthaEdit when
              > "Disable screen fonts" is checked.
              >
              > 2. For a simple program uses NSLayoutManager to render text, we can
              > simply call [someLayoutManager setUsesScreenFonts: NO] to achieve what
              > David wants to have (more liberal character spacing), however, MacVim's
              > text renderer is more complicated than that, in MMTextStorage, cellSize.
              > width is calculated with the -sizeWithAttributes: method of NSString,
              > which has no idea whether we are going to use screenFont or not.
              >
              > 3. I tried -printerFont: method of NSFont, however it seems it cannot
              > provide a different output as we expected.
              >
              > - Jiang
              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_mac" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • björn
              ... Can you post the screenshots to this list or provide a link where we can all take a look at them? ... Ok, I may be able to change this behaviour so that
              Message 6 of 13 , Jan 4, 2009
              • 0 Attachment
                2009/1/4 David Alan Hjelle <dahjelle@...>:
                >
                > Yeah, that must be what's going on. I took a more careful look, and I
                > agree that there is very little difference in the antialiasing between
                > the two samples. The character spacing makes the difference in
                > readability.

                Can you post the screenshots to this list or provide a link where we
                can all take a look at them?

                > I tried Björn's suggestion to use
                >
                > defaults write org.vim.MacVim MMCellWidthMultiplier 1.2
                >
                > but I didn't seem to be able to get the multiplier down far enough to
                > be reasonable.

                Ok, I may be able to change this behaviour so that you can specify the
                number of pixels to increase the character spacing width instead.
                That should give more precise control.

                I don't know if anybody actually uses MMCellWidthMultiplier (I don't)
                so I wasn't aware it needed fixing. Thanks for pointing this out.

                By the way, does anybody know if there is an option in Vim to affect
                (horizontal) character spacing, analogously to 'linespace'? I can't
                seem to find one.

                Björn

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_mac" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • björn
                ... ...Or maybe not. The attached screenshots show the difference between the normal character spacing (Padding-0) and when each character is 1 pixel wider
                Message 7 of 13 , Jan 4, 2009
                • 0 Attachment
                  2009/1/4 björn <bjorn.winckler@...>:
                  >
                  > Ok, I may be able to change this behaviour so that you can specify the
                  > number of pixels to increase the character spacing width instead.
                  > That should give more precise control.

                  ...Or maybe not. The attached screenshots show the difference between
                  the normal character spacing (Padding-0) and when each character is 1
                  pixel wider (Padding-1) using the default font. Even with 1 pixel
                  padding the characters look like they are quite far apart (to me, at
                  least) but this is the smallest possible amount. In other words, I
                  don't think there is much to be done about this.

                  Björn

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_mac" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • björn
                  ... Argh. Forgot the screenshots...here are the links: http://bjorn.winckler.googlepages.com/Padding-0.png http://bjorn.winckler.googlepages.com/Padding-1.png
                  Message 8 of 13 , Jan 4, 2009
                  • 0 Attachment
                    2009/1/4 björn <bjorn.winckler@...>:
                    > 2009/1/4 björn <bjorn.winckler@...>:
                    >>
                    >> Ok, I may be able to change this behaviour so that you can specify the
                    >> number of pixels to increase the character spacing width instead.
                    >> That should give more precise control.
                    >
                    > ...Or maybe not. The attached screenshots show the difference between
                    > the normal character spacing (Padding-0) and when each character is 1
                    > pixel wider (Padding-1) using the default font. Even with 1 pixel
                    > padding the characters look like they are quite far apart (to me, at
                    > least) but this is the smallest possible amount. In other words, I
                    > don't think there is much to be done about this.

                    Argh. Forgot the screenshots...here are the links:

                    http://bjorn.winckler.googlepages.com/Padding-0.png
                    http://bjorn.winckler.googlepages.com/Padding-1.png

                    Björn

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_mac" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Nico Weber
                    ... I asked David for them, and he sent them to me. Here they are: http://amnoid.de/tmp/SubEthaEdit%20enabled%20screen%20fonts.png
                    Message 9 of 13 , Jan 4, 2009
                    • 0 Attachment
                      >> Yeah, that must be what's going on. I took a more careful look, and I
                      >> agree that there is very little difference in the antialiasing
                      >> between
                      >> the two samples. The character spacing makes the difference in
                      >> readability.
                      >
                      > Can you post the screenshots to this list or provide a link where we
                      > can all take a look at them?

                      I asked David for them, and he sent them to me. Here they are:

                      http://amnoid.de/tmp/SubEthaEdit%20enabled%20screen%20fonts.png
                      http://amnoid.de/tmp/SubEthaEdit%20disabled%20screen%20fonts.png

                      To me, the difference is not just character spacing: in the screen
                      fonts-enabled screenshot, the characters seem to be more aligned with
                      pixel lines and are thus often less "colorful" (they are colored at
                      all because of os x's subpixel antialiasing). For example, see the
                      left edge of the "U" in line 3 or the "E" in line 5.

                      Nico

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_mac" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • björn
                      ... I can t really see that much of a difference apart from the spacing. The fact that the character spacing changes seems to make the most difference. To
                      Message 10 of 13 , Jan 4, 2009
                      • 0 Attachment
                        2009/1/4 Nico Weber <nicolasweber@...>:
                        >
                        > To me, the difference is not just character spacing: in the screen
                        > fonts-enabled screenshot, the characters seem to be more aligned with
                        > pixel lines and are thus often less "colorful" (they are colored at
                        > all because of os x's subpixel antialiasing). For example, see the
                        > left edge of the "U" in line 3 or the "E" in line 5.

                        I can't really see that much of a difference apart from the spacing.
                        The fact that the character spacing changes seems to make the most
                        difference. To test what it would look like in MacVim I did the
                        following:

                        a. disable screen fonts
                        b. disable fixed character advances

                        The result were these

                        (1) http://bjorn.winckler.googlepages.com/NO-ScreenFonts.png
                        (2) http://bjorn.winckler.googlepages.com/ScreenFonts.png
                        (3) http://bjorn.winckler.googlepages.com/ScreenFonts-VariableCharWidth.png

                        In (1) I've used the default settings with "gfn=DejaVuSansMono:h9".
                        Then I disabled screen fonts in (2), and finally I disabled both
                        screen fonts as well as fixed character advances in (3).

                        I can't see any difference between (1) and (2). Note that (3) fails
                        to fit the window because the character advances are not what MacVim
                        thinks they should be. There isn't much to do about this
                        unfortunately (because all of Vim is built around the assumption that
                        every character has the same width), so this style of rendering won't
                        work even though it may look more pleasing.

                        To conclude, (with the above font) disabling screen fonts seem to make
                        no difference (to me at least) -- the big difference is seen when
                        Cocoa is allowed to use variable character advances.

                        Björn

                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_mac" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      Your message has been successfully submitted and would be delivered to recipients shortly.