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

[patch] fixing display of signs in GTK builds

Expand Messages
  • Christian Brabandt
    Bram, I noticed, when displaying icon signs in the gui version of Vim there might be a small line not overdrawn by the sign, caused by the linespace setting
    Message 1 of 5 , Jun 10, 2014
    • 0 Attachment
      Bram,
      I noticed, when displaying icon signs in the gui version of Vim there
      might be a small line not overdrawn by the sign, caused by the
      'linespace' setting set to be one. That does look rather ugly, if you
      display several signs side by side (see attached screenshot).

      Here is a patch. A couple of comments:
      1) I am not sure, why a call to gdk_draw_rectangle() is done in the
      existing code. I have left it out as it seems to be unnecessary
      2) not sure, why a height of 127 was hard coded when drawing the size
      area. I have used the actual sign size for that
      3) when the sign hight differs from the char_height, it will always be
      rescaled. This of course has the additional disadvantage of causing a
      performance issue. Not sure, if this is noticeable, though.

      Best,
      Christian
      --
      Die Probe des Feinen ist nicht, gegen den Feinen fein zu sein - sie
      wäre zu leicht - aber wohl gegen den Groben es zu bleiben.
      -- Jean Paul

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Bram Moolenaar
      ... Thanks. ... I don t know either. Perhaps for icons that have transparent parts? Just guessing. ... For such small icons performance should not matter. If
      Message 2 of 5 , Jun 11, 2014
      • 0 Attachment
        Christian wrote:

        > I noticed, when displaying icon signs in the gui version of Vim there
        > might be a small line not overdrawn by the sign, caused by the
        > 'linespace' setting set to be one. That does look rather ugly, if you
        > display several signs side by side (see attached screenshot).

        Thanks.

        > Here is a patch. A couple of comments:
        > 1) I am not sure, why a call to gdk_draw_rectangle() is done in the
        > existing code. I have left it out as it seems to be unnecessary

        I don't know either. Perhaps for icons that have transparent parts?
        Just guessing.

        > 2) not sure, why a height of 127 was hard coded when drawing the size
        > area. I have used the actual sign size for that
        > 3) when the sign hight differs from the char_height, it will always be
        > rescaled. This of course has the additional disadvantage of causing a
        > performance issue. Not sure, if this is noticeable, though.

        For such small icons performance should not matter.

        If someone uses this kind of sign, please try out the patch.

        --
        ARTHUR: (as the MAN next to him is squashed by a sheep) Knights! Run away!
        Midst echoing shouts of "run away" the KNIGHTS retreat to cover with the odd
        cow or goose hitting them still. The KNIGHTS crouch down under cover.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Bram Moolenaar
        ... Do you mean that the dark line below the + sign should not be there? And if linespace is set to zero that black line is indeed gone? ... I believe this
        Message 3 of 5 , Jun 12, 2014
        • 0 Attachment
          Christian wrote:

          > Bram,
          > I noticed, when displaying icon signs in the gui version of Vim there
          > might be a small line not overdrawn by the sign, caused by the
          > 'linespace' setting set to be one. That does look rather ugly, if you
          > display several signs side by side (see attached screenshot).

          Do you mean that the dark line below the "+" sign should not be there?
          And if 'linespace' is set to zero that black line is indeed gone?

          > Here is a patch. A couple of comments:
          > 1) I am not sure, why a call to gdk_draw_rectangle() is done in the
          > existing code. I have left it out as it seems to be unnecessary

          I believe this is needed to first clear the area with the background
          color, in case the icon drawn is smaller than the available space.
          Perhaps you can try it with a rectangular icon, vertically and
          horizontally. E.g. something like a red exclamation mark. There would
          need to be some other sign at first to see any effect.

          > 2) not sure, why a height of 127 was hard coded when drawing the size
          > area. I have used the actual sign size for that

          The 127 is the value for "alpha_threshold". At least according to the
          documentation I found.

          > 3) when the sign hight differs from the char_height, it will always be
          > rescaled. This of course has the additional disadvantage of causing a
          > performance issue. Not sure, if this is noticeable, though.

          I don't think we should worry about performance.

          It appears that after your change the aspect ratio of the sign is not
          kept. Although that would be OK for filling the gap, if the sign was
          really a different shape it would look weird. In your specific case you
          would want the sign to fill the available space and probably don't care
          about keeping the aspect ratio. Adding a setting for this woule make it
          complicated...

          How about this: if we can fill the available space with a slightly
          different ascpect ratio, e.g., 10% different, filling the gap is nicer
          than the slightly different aspect ratio. If we change the aspect ratio
          more than 10% or so the icon will start looking weird and we stick to
          the aspect ratio and as a result there will be a gap (either vertically
          or horizontally).

          The names are a bit confusing, SIGN_ASPECT actually means the aspect
          ratio of the space availeble, with "aspect" is the aspect ratio of the
          sign being drawn.

          This also very much depends on the font size, since the space used for
          the icon is two character cells wide and one character cell plus
          'linespace' high.


          --
          FIRST HEAD: All right! All right! We'll kill him first and then have tea and
          biscuits.
          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Christian Brabandt
          Hi Bram! ... It goes away, if I set linespace to -1. But that has other screen problems. ... I used an rectangular icon. But you are right, this was probably
          Message 4 of 5 , Jun 12, 2014
          • 0 Attachment
            Hi Bram!

            On Do, 12 Jun 2014, Bram Moolenaar wrote:

            >
            > Christian wrote:
            >
            > > Bram,
            > > I noticed, when displaying icon signs in the gui version of Vim there
            > > might be a small line not overdrawn by the sign, caused by the
            > > 'linespace' setting set to be one. That does look rather ugly, if you
            > > display several signs side by side (see attached screenshot).
            >
            > Do you mean that the dark line below the "+" sign should not be there?
            > And if 'linespace' is set to zero that black line is indeed gone?

            It goes away, if I set linespace to -1. But that has other screen
            problems.
            >
            > > Here is a patch. A couple of comments:
            > > 1) I am not sure, why a call to gdk_draw_rectangle() is done in the
            > > existing code. I have left it out as it seems to be unnecessary
            >
            > I believe this is needed to first clear the area with the background
            > color, in case the icon drawn is smaller than the available space.
            > Perhaps you can try it with a rectangular icon, vertically and
            > horizontally. E.g. something like a red exclamation mark. There would
            > need to be some other sign at first to see any effect.

            I used an rectangular icon. But you are right, this was probably done
            for making sure, transparent icons are drawn correctly. I thought about
            using transparent signs, but I don not want to use different icons for
            different builts (e.g. png for GTK and bmp for Windows), so I usually
            use the same icon everywhere.
            >
            > > 2) not sure, why a height of 127 was hard coded when drawing the size
            > > area. I have used the actual sign size for that
            >
            > The 127 is the value for "alpha_threshold". At least according to the
            > documentation I found.

            Ah my bad, I got confused by the non_alpha function.
            >
            > > 3) when the sign hight differs from the char_height, it will always be
            > > rescaled. This of course has the additional disadvantage of causing a
            > > performance issue. Not sure, if this is noticeable, though.
            >
            > I don't think we should worry about performance.
            >
            > It appears that after your change the aspect ratio of the sign is not
            > kept. Although that would be OK for filling the gap, if the sign was
            > really a different shape it would look weird. In your specific case you
            > would want the sign to fill the available space and probably don't care
            > about keeping the aspect ratio. Adding a setting for this woule make it
            > complicated...
            >
            > How about this: if we can fill the available space with a slightly
            > different ascpect ratio, e.g., 10% different, filling the gap is nicer
            > than the slightly different aspect ratio. If we change the aspect ratio
            > more than 10% or so the icon will start looking weird and we stick to
            > the aspect ratio and as a result there will be a gap (either vertically
            > or horizontally).
            >
            > The names are a bit confusing, SIGN_ASPECT actually means the aspect
            > ratio of the space availeble, with "aspect" is the aspect ratio of the
            > sign being drawn.
            >
            > This also very much depends on the font size, since the space used for
            > the icon is two character cells wide and one character cell plus
            > 'linespace' high.

            Okay, how about the attached patch (it allows 15% deviation to the
            aspect ratio (so one can change linespace value by at most 2 for a sign
            of 16x16 pixel and the sign will be completely filled)

            Best,
            Christian
            --
            Kennst Du den Unterschied zwischen einem Arbeitslosen und einem Beamten?
            Arbeitslose haben schon einmal gearbeitet.

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... That sounds good. I ll have a better look later. -- GALAHAD: No. Look, I can tackle this lot single-handed! GIRLS: Yes, yes, let him Tackle us
            Message 5 of 5 , Jun 13, 2014
            • 0 Attachment
              Christian wrote:

              > > > Bram,
              > > > I noticed, when displaying icon signs in the gui version of Vim there
              > > > might be a small line not overdrawn by the sign, caused by the
              > > > 'linespace' setting set to be one. That does look rather ugly, if you
              > > > display several signs side by side (see attached screenshot).
              > >
              > > Do you mean that the dark line below the "+" sign should not be there?
              > > And if 'linespace' is set to zero that black line is indeed gone?
              >
              > It goes away, if I set linespace to -1. But that has other screen
              > problems.
              > >
              > > > Here is a patch. A couple of comments:
              > > > 1) I am not sure, why a call to gdk_draw_rectangle() is done in the
              > > > existing code. I have left it out as it seems to be unnecessary
              > >
              > > I believe this is needed to first clear the area with the background
              > > color, in case the icon drawn is smaller than the available space.
              > > Perhaps you can try it with a rectangular icon, vertically and
              > > horizontally. E.g. something like a red exclamation mark. There would
              > > need to be some other sign at first to see any effect.
              >
              > I used an rectangular icon. But you are right, this was probably done
              > for making sure, transparent icons are drawn correctly. I thought about
              > using transparent signs, but I don not want to use different icons for
              > different builts (e.g. png for GTK and bmp for Windows), so I usually
              > use the same icon everywhere.
              > >
              > > > 2) not sure, why a height of 127 was hard coded when drawing the size
              > > > area. I have used the actual sign size for that
              > >
              > > The 127 is the value for "alpha_threshold". At least according to the
              > > documentation I found.
              >
              > Ah my bad, I got confused by the non_alpha function.
              > >
              > > > 3) when the sign hight differs from the char_height, it will always be
              > > > rescaled. This of course has the additional disadvantage of causing a
              > > > performance issue. Not sure, if this is noticeable, though.
              > >
              > > I don't think we should worry about performance.
              > >
              > > It appears that after your change the aspect ratio of the sign is not
              > > kept. Although that would be OK for filling the gap, if the sign was
              > > really a different shape it would look weird. In your specific case you
              > > would want the sign to fill the available space and probably don't care
              > > about keeping the aspect ratio. Adding a setting for this woule make it
              > > complicated...
              > >
              > > How about this: if we can fill the available space with a slightly
              > > different ascpect ratio, e.g., 10% different, filling the gap is nicer
              > > than the slightly different aspect ratio. If we change the aspect ratio
              > > more than 10% or so the icon will start looking weird and we stick to
              > > the aspect ratio and as a result there will be a gap (either vertically
              > > or horizontally).
              > >
              > > The names are a bit confusing, SIGN_ASPECT actually means the aspect
              > > ratio of the space availeble, with "aspect" is the aspect ratio of the
              > > sign being drawn.
              > >
              > > This also very much depends on the font size, since the space used for
              > > the icon is two character cells wide and one character cell plus
              > > 'linespace' high.
              >
              > Okay, how about the attached patch (it allows 15% deviation to the
              > aspect ratio (so one can change linespace value by at most 2 for a sign
              > of 16x16 pixel and the sign will be completely filled)

              That sounds good. I'll have a better look later.

              --
              GALAHAD: No. Look, I can tackle this lot single-handed!
              GIRLS: Yes, yes, let him Tackle us single-handed!
              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            Your message has been successfully submitted and would be delivered to recipients shortly.