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

Re: [BUG] Ambiguous-width character handling

Expand Messages
  • Noah Levitt
    ... What about guifont and guifontwide? The fonts I use have some overlap. Incidentally, Autrijus s sample line gave me no problems in an utf8 xterm. It
    Message 1 of 7 , Sep 19, 2002
    • 0 Attachment
      On Thu, Sep 19, 2002 at 21:43:00 +0200, Bram Moolenaar wrote:
      >
      > Note that Vim only supports one font for the whole Vim window. I don't
      > expect that a single font has two glyphs for the same character,
      > depending on the context. Therefore the choice for whether an ambiguous
      > character is single or double width should match the font.

      What about guifont and guifontwide? The fonts I use have
      some overlap.

      Incidentally, Autrijus's sample line gave me no problems in
      an utf8 xterm. It treated the characters as single-width.
      xterm uses Markus Kuhn's wcwidth, I believe.

      Noah
    • Bram Moolenaar
      ... That has a chicken-egg problem: the choice between the two fonts is made based on the width of a character. There could be a test if a glyph for a
      Message 2 of 7 , Sep 19, 2002
      • 0 Attachment
        Noah Levitt wrote:

        > On Thu, Sep 19, 2002 at 21:43:00 +0200, Bram Moolenaar wrote:
        > >
        > > Note that Vim only supports one font for the whole Vim window. I don't
        > > expect that a single font has two glyphs for the same character,
        > > depending on the context. Therefore the choice for whether an ambiguous
        > > character is single or double width should match the font.
        >
        > What about guifont and guifontwide? The fonts I use have
        > some overlap.

        That has a chicken-egg problem: the choice between the two fonts is made
        based on the width of a character. There could be a test if a glyph for
        a character is available, but that's complicated.

        > Incidentally, Autrijus's sample line gave me no problems in
        > an utf8 xterm. It treated the characters as single-width.
        > xterm uses Markus Kuhn's wcwidth, I believe.

        The function I use has the same source, thus it's no surprise Vim and
        Xterm work well together. The problem probably only exists on Asian
        terminals.

        --
        The Feynman problem solving Algorithm:
        1) Write down the problem
        2) Think real hard
        3) Write down the answer

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
      • Autrijus Tang
        ... Yes, and I d think that it is somehow too smart for Vim to probe the glyph s width -- what if the guifont has the narrow glyph, and guifontwide has the
        Message 3 of 7 , Sep 19, 2002
        • 0 Attachment
          On Thu, Sep 19, 2002 at 10:37:04PM +0200, Bram Moolenaar wrote:
          > Noah Levitt wrote:
          > > On Thu, Sep 19, 2002 at 21:43:00 +0200, Bram Moolenaar wrote:
          > > > Note that Vim only supports one font for the whole Vim window. I don't
          > > > expect that a single font has two glyphs for the same character,
          > > > depending on the context. Therefore the choice for whether an ambiguous
          > > > character is single or double width should match the font.
          > > What about guifont and guifontwide? The fonts I use have
          > > some overlap.
          > That has a chicken-egg problem: the choice between the two fonts is made
          > based on the width of a character. There could be a test if a glyph for
          > a character is available, but that's complicated.

          Yes, and I'd think that it is somehow "too smart" for Vim to probe
          the glyph's width -- what if the guifont has the narrow glyph, and
          guifontwide has the East Asian-fullwidth glyph?

          A separate option, maybe probed initially be some heuristic
          (but not neccessary), is IMHO more natural.

          > > Incidentally, Autrijus's sample line gave me no problems in
          > > an utf8 xterm. It treated the characters as single-width.
          > > xterm uses Markus Kuhn's wcwidth, I believe.
          > The function I use has the same source, thus it's no surprise Vim and
          > Xterm work well together. The problem probably only exists on Asian
          > terminals.

          Or rather, only existing on East Asian fonts, like the one I use here:
          "ar pl mingti2l big5-iso10646-1;"

          Switching to other fonts can surely match the single-width results
          given by wcwidth, but since text files prepared other unicode/big5
          editors will assume double-width layout, the resulting formatting
          and display will be incorrect from the author's perspective.

          Thanks,
          /Autrijus/
        Your message has been successfully submitted and would be delivered to recipients shortly.