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

Vim60ap patch: Athena & Motif "Menu" highlight group fix

Expand Messages
  • David Harrison
    Problem: Trying to set the font parameter of the Menu highlight group while the guifontset option was set resulted in a crash, because the Menu highlight
    Message 1 of 12 , Jul 31, 2001
    • 0 Attachment
      Problem: Trying to set the "font" parameter of the "Menu" highlight
      group while the 'guifontset' option was set resulted in a crash, because
      the Menu highlight group only stores a single XFontStruct and NOT an
      XFontSet.

      Solution: Force the "Menu" highlight group to always use a single font
      and not an XFontSet.

      Bram: I also noticed a few places where an "XFontSet *" was passed and
      then used as an XFontSet. I corrected those. Oddly enough, it was
      working under Motif before the "fix"!? I cannot explain this, except
      that maybe we were somehow taking advantage of an implementation detail
      of the underlying XFontStruct */XFontSet types. Anyway, it still
      "works", but should now be safer.

      I have done basic testing and it works, but I may have inadvertantly
      affected someone's obscure use of X11 resource files for the Athena
      version. International users can now only use a fontset in the menus by
      explicitly setting it in the resource files for Vim 6.0.

      Enjoy,
      David Harrison Jr.
    • Martin Dalecki
      ... Hello David. Please note that since X11R4 or even earier XFontSets are supposed to supercede single fonts! So I think that the most desirable way of fixing
      Message 2 of 12 , Aug 1, 2001
      • 0 Attachment
        David Harrison wrote:
        >
        > Problem: Trying to set the "font" parameter of the "Menu" highlight
        > group while the 'guifontset' option was set resulted in a crash, because
        > the Menu highlight group only stores a single XFontStruct and NOT an
        > XFontSet.
        >

        Hello David. Please note that since X11R4 or even earier
        XFontSets are supposed to supercede single fonts! So I think
        that the most desirable way of fixing those
        problems would be anyway to use *always* font structs.
      • Bram Moolenaar
        ... I suppose this means Asian languages cannot be used in the menus, unless set from a resource file. That s disappointing, I thought this was currently
        Message 3 of 12 , Aug 1, 2001
        • 0 Attachment
          David Harrison wrote:

          > Problem: Trying to set the "font" parameter of the "Menu" highlight
          > group while the 'guifontset' option was set resulted in a crash, because
          > the Menu highlight group only stores a single XFontStruct and NOT an
          > XFontSet.
          >
          > Solution: Force the "Menu" highlight group to always use a single font
          > and not an XFontSet.

          I suppose this means Asian languages cannot be used in the menus, unless set
          from a resource file. That's disappointing, I thought this was currently
          working.

          > Bram: I also noticed a few places where an "XFontSet *" was passed and
          > then used as an XFontSet. I corrected those. Oddly enough, it was
          > working under Motif before the "fix"!? I cannot explain this, except
          > that maybe we were somehow taking advantage of an implementation detail
          > of the underlying XFontStruct */XFontSet types. Anyway, it still
          > "works", but should now be safer.

          I can't imagine that passing a wrong pointer can ever work. We have had
          enough crashes when something like this was wrong. Perhaps the wrong code was
          never used?

          > I have done basic testing and it works, but I may have inadvertantly
          > affected someone's obscure use of X11 resource files for the Athena
          > version. International users can now only use a fontset in the menus by
          > explicitly setting it in the resource files for Vim 6.0.

          I thought the plan was to use a fontset for everything. Thus make the choice
          at compile time, not at runtime. Is that too difficult to implement now? I
          thought that using the fontset was in place already.

          --
          From "know your smileys":
          *<|:-) Santa Claus (Ho Ho Ho)

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
        • Bram Moolenaar
          ... Eh, don t you mean to use *always* fontsets ? I had the same idea, and I thought David had this idea as well, thus the question is why the patch takes us
          Message 4 of 12 , Aug 1, 2001
          • 0 Attachment
            Martin Dalecki wrote:

            > David Harrison wrote:
            > >
            > > Problem: Trying to set the "font" parameter of the "Menu" highlight
            > > group while the 'guifontset' option was set resulted in a crash, because
            > > the Menu highlight group only stores a single XFontStruct and NOT an
            > > XFontSet.
            > >
            >
            > Hello David. Please note that since X11R4 or even earier
            > XFontSets are supposed to supercede single fonts! So I think
            > that the most desirable way of fixing those
            > problems would be anyway to use *always* font structs.

            Eh, don't you mean "to use *always* fontsets"?

            I had the same idea, and I thought David had this idea as well, thus the
            question is why the patch takes us in the other direction.

            --
            From "know your smileys"
            8<}} Glasses, big nose, beard

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
            \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
          • Martin Dalecki
            ... Oh right of course. The above is a typo. I mean - always use fontsets. (BTW. libgtk does it internally.)
            Message 5 of 12 , Aug 1, 2001
            • 0 Attachment
              Bram Moolenaar wrote:
              >
              > Martin Dalecki wrote:
              >
              > > David Harrison wrote:
              > > >
              > > > Problem: Trying to set the "font" parameter of the "Menu" highlight
              > > > group while the 'guifontset' option was set resulted in a crash, because
              > > > the Menu highlight group only stores a single XFontStruct and NOT an
              > > > XFontSet.
              > > >
              > >
              > > Hello David. Please note that since X11R4 or even earier
              > > XFontSets are supposed to supercede single fonts! So I think
              > > that the most desirable way of fixing those
              > > problems would be anyway to use *always* font structs.
              >
              > Eh, don't you mean "to use *always* fontsets"?

              Oh right of course. The above is a typo.
              I mean - always use fontsets. (BTW. libgtk does it internally.)

              > I had the same idea, and I thought David had this idea as well, thus the
              > question is why the patch takes us in the other direction.
            • David Harrison
              ... I think you meant to say font sets , but Yes, I agree! The only reason I haven t done it yet is that I have little time at the moment. Add to that the
              Message 6 of 12 , Aug 1, 2001
              • 0 Attachment
                Martin Dalecki wrote:

                > David Harrison wrote:
                >
                >> Problem: Trying to set the "font" parameter of the "Menu" highlight
                >> group while the 'guifontset' option was set resulted in a crash, because
                >> the Menu highlight group only stores a single XFontStruct and NOT an
                >> XFontSet.
                >>
                >
                >
                > Hello David. Please note that since X11R4 or even earier
                > XFontSets are supposed to supercede single fonts!

                > So I think
                > that the most desirable way of fixing those
                > problems would be anyway to use *always* font structs.

                I think you meant to say "font sets", but Yes, I agree!

                The only reason I haven't done it yet is that I have little time at the
                moment. Add to that the fact that Vim 6.0 is now in BETA and I don't
                wish to create any more instability in the code base. It pretty much
                all keys on the 'guifontset' option; if it is set, then a font name is
                treated as a font set, otherwise a font struct. Last but not least, add
                to the fact that my RedHat 6.2 didn't seem to have extensive locale
                support (esp. Asian locales, which I think is the main reason for
                XFontSet), thus testing was difficult.

                No one has yet complained about the lack of FontSet support in the
                menus, so probably no real harm done.

                I AM going to fix this in 6.1.

                By the way, in the Athena version I DO treat all the tooltips as an
                XFontSet, which is my "test case".

                --David Harrison Jr.
              • David Harrison
                ... I have never had it working entirely. I suspect this has to do with the fact that Asian locales weren t supported very well under my version of Linux
                Message 7 of 12 , Aug 1, 2001
                • 0 Attachment
                  Bram Moolenaar wrote:

                  > David Harrison wrote:
                  >
                  >
                  >> Problem: Trying to set the "font" parameter of the "Menu" highlight
                  >> group while the 'guifontset' option was set resulted in a crash, because
                  >> the Menu highlight group only stores a single XFontStruct and NOT an
                  >> XFontSet.
                  >>
                  >> Solution: Force the "Menu" highlight group to always use a single font
                  >> and not an XFontSet.
                  >
                  >
                  > I suppose this means Asian languages cannot be used in the menus, unless set
                  > from a resource file. That's disappointing, I thought this was currently
                  > working.

                  I have never had it working entirely. I suspect this has to do with the
                  fact that Asian locales weren't supported very well under my version of
                  Linux (RedHat 6.2).

                  Maybe now that I have access to RedHat 7.1, this may change things.


                  > I thought the plan was to use a fontset for everything. Thus make the choice
                  > at compile time, not at runtime. Is that too difficult to implement now?

                  No. It may just take some time (a month or two?) to work all of the
                  tiny bugs out, that's all. For example, when you set the (what should
                  be a) fontset for a menu, does it take the current locale as the locale
                  to use, or should you be able to specify a specific locale to use? If
                  it is the former, then that means that if you want to have the menu be
                  in a different locale, you have to set the :language before you source
                  menu.vim, and then set it back immediately afterwards.

                  Can of worms?

                  > I
                  > thought that using the fontset was in place already.

                  Only if you compile with EXPERIMENTAL #defined.

                  Would you like for me to try something out shortly and send it in?

                  --David Jr.
                • Martin Dalecki
                  ... Well at least for non multibyte locales with a default font set differnt from iso8859-1 I can sort testing out for you quite easly ;-).
                  Message 8 of 12 , Aug 1, 2001
                  • 0 Attachment
                    David Harrison wrote:
                    >
                    > Bram Moolenaar wrote:
                    >
                    > > David Harrison wrote:
                    > >
                    > >
                    > >> Problem: Trying to set the "font" parameter of the "Menu" highlight
                    > >> group while the 'guifontset' option was set resulted in a crash, because
                    > >> the Menu highlight group only stores a single XFontStruct and NOT an
                    > >> XFontSet.
                    > >>
                    > >> Solution: Force the "Menu" highlight group to always use a single font
                    > >> and not an XFontSet.
                    > >
                    > >
                    > > I suppose this means Asian languages cannot be used in the menus, unless set
                    > > from a resource file. That's disappointing, I thought this was currently
                    > > working.
                    >
                    > I have never had it working entirely. I suspect this has to do with the
                    > fact that Asian locales weren't supported very well under my version of
                    > Linux (RedHat 6.2).
                    >
                    > Maybe now that I have access to RedHat 7.1, this may change things.
                    >
                    > > I thought the plan was to use a fontset for everything. Thus make the choice
                    > > at compile time, not at runtime. Is that too difficult to implement now?
                    >
                    > No. It may just take some time (a month or two?) to work all of the
                    > tiny bugs out, that's all. For example, when you set the (what should
                    > be a) fontset for a menu, does it take the current locale as the locale
                    > to use, or should you be able to specify a specific locale to use? If
                    > it is the former, then that means that if you want to have the menu be
                    > in a different locale, you have to set the :language before you source
                    > menu.vim, and then set it back immediately afterwards.

                    Well at least for non multibyte locales with a default font set
                    differnt from iso8859-1 I can sort testing out for you quite easly ;-).
                  • David Harrison
                    ... Thank you! ... and now for my Earth-shattering question: Is there a difference between using a single font and a font set for non-multibyte locales? If
                    Message 9 of 12 , Aug 1, 2001
                    • 0 Attachment
                      Martin Dalecki wrote:

                      > David Harrison wrote:
                      >
                      >> No. It may just take some time (a month or two?) to work all of the
                      >> tiny bugs out, that's all. For example, when you set the (what should
                      >> be a) fontset for a menu, does it take the current locale as the locale
                      >> to use, or should you be able to specify a specific locale to use? If
                      >> it is the former, then that means that if you want to have the menu be
                      >> in a different locale, you have to set the :language before you source
                      >> menu.vim, and then set it back immediately afterwards.
                      >
                      >
                      > Well at least for non multibyte locales with a default font set
                      > differnt from iso8859-1 I can sort testing out for you quite easly ;-).

                      Thank you!
                      ... and now for my Earth-shattering question: Is there a difference
                      between using a single font and a font set for non-multibyte locales?

                      If no, then using a single font should be okay for Vim 6.0. :-)

                      Any mulibyte users out there need to speak up if they desire their menus
                      to be in their preferred locale!

                      --David Harrison Jr.
                    • Bram Moolenaar
                      ... We both aim for stability and to fix all problems. In this case we might attempt to fix the problem, unless we can t do that in a couple of weeks (so that
                      Message 10 of 12 , Aug 1, 2001
                      • 0 Attachment
                        David Harrison wrote:

                        > The only reason I haven't done it yet is that I have little time at the
                        > moment. Add to that the fact that Vim 6.0 is now in BETA and I don't
                        > wish to create any more instability in the code base.

                        We both aim for stability and to fix all problems. In this case we might
                        attempt to fix the problem, unless we can't do that in a couple of weeks (so
                        that there is still time to test the result).

                        > It pretty much all keys on the 'guifontset' option; if it is set, then a
                        > font name is treated as a font set, otherwise a font struct.

                        We could change that. In fact, I never liked it. It was a result of adding
                        fontset support without the courage to change the existing fonts. The main
                        difference that will remain is that 'guifont' is a list of alternate fonts,
                        while 'guifontset' is a list of fonts to be used together. But we can drop
                        the use of this to use a fontset internally or not. We might have been
                        causing ourselves trouble by keeping the support for the fontstruct.

                        Another thing is wheter we want to do it the same way for Athena and Motif.
                        But I thought that fontset support is in the generic library, thus they could
                        both be the same, right?

                        > Last but not least, add to the fact that my RedHat 6.2 didn't seem to have
                        > extensive locale support (esp. Asian locales, which I think is the main
                        > reason for XFontSet), thus testing was difficult.

                        Getting a good setup to do testing might indeed be difficult. But with a bit
                        of help from our friends we should manage...

                        > No one has yet complained about the lack of FontSet support in the
                        > menus, so probably no real harm done.

                        I did get a few requests for it. Don't forget that the people that would like
                        to use this, often have trouble writing English, thus tend to keep their mouth
                        shut.

                        > I AM going to fix this in 6.1.
                        >
                        > By the way, in the Athena version I DO treat all the tooltips as an
                        > XFontSet, which is my "test case".

                        It almost looks like we have all the stuff in place to make the switch, or is
                        there still some place where using a fontset will require adding new code?

                        > [next message]
                        >
                        > > I thought the plan was to use a fontset for everything. Thus make the
                        > > choice at compile time, not at runtime. Is that too difficult to
                        > > implement now?
                        >
                        > No. It may just take some time (a month or two?) to work all of the
                        > tiny bugs out, that's all. For example, when you set the (what should
                        > be a) fontset for a menu, does it take the current locale as the locale
                        > to use, or should you be able to specify a specific locale to use? If
                        > it is the former, then that means that if you want to have the menu be
                        > in a different locale, you have to set the :language before you source
                        > menu.vim, and then set it back immediately afterwards.

                        By default the current locale should be used. That's how it has always
                        worked. If possible, we would like to allow setting the encoding with ":lang"
                        and the 'encoding' option, and make the menus work with that. But restricting
                        this to have it only work when Vim is starting up isn't too bad.

                        > Can of worms?

                        If that's true we better leave it alone.

                        > > I thought that using the fontset was in place already.
                        >
                        > Only if you compile with EXPERIMENTAL #defined.
                        >
                        > Would you like for me to try something out shortly and send it in?

                        Perhaps what we can do is use a FONTSET_ALWAYS define to add the code for
                        this. At first to see if we run into trouble when implementing it. Then we
                        can enable it by default to let people test it. When we run into too much
                        trouble we can undefine it to fall back to the old code. Does that sound
                        reasonable?

                        --
                        From "know your smileys":
                        :-| :-| Deja' vu!

                        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                        ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
                        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
                      • Martin Dalecki
                        ... Right. I agree fully. And then please take note as well that the documentation about what to use how is indeed very confusing. At least it was to me last
                        Message 11 of 12 , Aug 1, 2001
                        • 0 Attachment
                          Bram Moolenaar wrote:

                          > > It pretty much all keys on the 'guifontset' option; if it is set, then a
                          > > font name is treated as a font set, otherwise a font struct.
                          >
                          > We could change that. In fact, I never liked it. It was a result of adding
                          > fontset support without the courage to change the existing fonts. The main
                          > difference that will remain is that 'guifont' is a list of alternate fonts,
                          > while 'guifontset' is a list of fonts to be used together. But we can drop
                          > the use of this to use a fontset internally or not. We might have been
                          > causing ourselves trouble by keeping the support for the fontstruct.

                          Right. I agree fully. And then please take note as well that the
                          documentation about what to use how is indeed very confusing. At least
                          it
                          was to me last time I looked at 5.7 times.

                          > Another thing is wheter we want to do it the same way for Athena and Motif.
                          > But I thought that fontset support is in the generic library, thus they could
                          > both be the same, right?

                          Yes they are completely identical if you disrespect the Motif font-list
                          stuff,
                          which got introduced into Motif a very long time ago to circumvent
                          fontstruct
                          problems. This was done there at times where X11 didn't support font
                          sets.
                          But as I have already stated it this is really really a very long time
                          ago.

                          > > Last but not least, add to the fact that my RedHat 6.2 didn't seem to have
                          > > extensive locale support (esp. Asian locales, which I think is the main
                          > > reason for XFontSet), thus testing was difficult.
                          >
                          > Getting a good setup to do testing might indeed be difficult. But with a bit
                          > of help from our friends we should manage...

                          Hah! Even I managed once to get a proper tawanses input method setup.
                          You will have to look at some of the asian linux variants to get it
                          right.
                          (Or just look at redhat-7.1-jp RPM's)

                          > Perhaps what we can do is use a FONTSET_ALWAYS define to add the code for
                          > this. At first to see if we run into trouble when implementing it. Then we
                          > can enable it by default to let people test it. When we run into too much
                          > trouble we can undefine it to fall back to the old code. Does that sound
                          > reasonable?

                          Perhaps we make just a test ballon beta version with the code removed.
                          (It's a matter of patch -r to readd this stuff) and leave it that way
                          if nobody complains - I would suggest.
                        • David Harrison
                          ... Yes. I ll use an XFontSet type (from the X11 library). For Motif, I ll just create an XmFontList from that, while for Athena there would be nothing
                          Message 12 of 12 , Aug 1, 2001
                          • 0 Attachment
                            Bram Moolenaar wrote:

                            > David Harrison wrote:

                            >
                            > Another thing is wheter we want to do it the same way for Athena and Motif.
                            > But I thought that fontset support is in the generic library, thus they could
                            > both be the same, right?


                            Yes. I'll use an "XFontSet" type (from the X11 library). For Motif,
                            I'll just create an XmFontList from that, while for Athena there would
                            be nothing else to do.



                            >>No one has yet complained about the lack of FontSet support in the
                            >>menus, so probably no real harm done.
                            >>
                            >
                            > I did get a few requests for it. Don't forget that the people that would like
                            > to use this, often have trouble writing English, thus tend to keep their mouth
                            > shut.


                            *speaking to a large group of people* ... if anyone doesn't understand
                            English, please raise your hand. *pauses and notes no raised hands*
                            Good! Then everyone speaks English. ;-)



                            > It almost looks like we have all the stuff in place to make the switch, or is
                            > there still some place where using a fontset will require adding new code?


                            Only minor bits will be added, I think.

                            >
                            > By default the current locale should be used. That's how it has always
                            > worked. If possible, we would like to allow setting the encoding with ":lang"
                            > and the 'encoding' option, and make the menus work with that. But restricting
                            > this to have it only work when Vim is starting up isn't too bad.


                            I'll take the first step and we'll go from there...


                            > Perhaps what we can do is use a FONTSET_ALWAYS define to add the code for
                            > this. At first to see if we run into trouble when implementing it. Then we
                            > can enable it by default to let people test it. When we run into too much
                            > trouble we can undefine it to fall back to the old code. Does that sound
                            > reasonable?


                            That sounds very reasonable. I have direction now.

                            Thank you,
                            David Harrison Jr.
                          Your message has been successfully submitted and would be delivered to recipients shortly.