cjk char width is a little wider

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

cjk char width is a little wider

Donghai Zhu
when vim is compiled with gtk2, I set guifont to monospace font, my chinese character spacing is wider than latin character,not as other gtk2 applictions,the character spaing is united, can someone fix this problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

crimson-2

try

:set ambiwidth=double


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Donghai Zhu

It doesn't have any effect
2007/10/13, crimson <[hidden email]>:
>
> try
>
> :set ambiwidth=double
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Kornelis
In reply to this post by Donghai Zhu

On Oct 11, 2:19 am, ocean <[hidden email]> wrote:
> when vim is compiled with gtk2, I set guifont to monospace font, my chinese
> character spacing is wider than latin character,not as other gtk2
> applictions,the character spaing is united, can someone fix this problem?

Did you set guifontwide explicitly as well?

example from my .gvimrc
    set guifont=Luxi\ Mono\ 16
    set guifontwide=Kochi\ Mincho\ 20
    set linespace=3

Kornelis


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

krbeesley

When you set both guifont and guifontwide,
when does vim use one, and when the other?

Ken



On 15 Oct 2007, at 08:04, Kornelis wrote:

>
> On Oct 11, 2:19 am, ocean <[hidden email]> wrote:
>> when vim is compiled with gtk2, I set guifont to monospace font,  
>> my chinese
>> character spacing is wider than latin character,not as other gtk2
>> applictions,the character spaing is united, can someone fix this  
>> problem?
>
> Did you set guifontwide explicitly as well?
>
> example from my .gvimrc
>     set guifont=Luxi\ Mono\ 16
>     set guifontwide=Kochi\ Mincho\ 20
>     set linespace=3
>
> Kornelis
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Kornelis

On Oct 15, 8:41 pm, Kenneth Beesley <[hidden email]> wrote:
> When you set both guifont and guifontwide,
> when does vim use one, and when the other?
>
> Ken
>

It uses the guifont for the characters that are not wide and the
guifontwide
for those that are. Actually quite convinient, since you can select
your best
latin font and best Asian font at the same time. But you can also
choose
the same font for both (but not always - depends on the font).

If you set only guifont on Linux Pango/Xft will choose a wide font to
match,
but for reasons unknown to me some combinations mess up the character
spacing of the Asian font in gvim upto now. Therefore explicitly
setting
guifontwide as well works better for me.

Best results are to be expected with a monospaced font for the latin
font.

Kornelis







> On 15 Oct 2007, at 08:04, Kornelis wrote:
>
>
>
> > On Oct 11, 2:19 am, ocean <[hidden email]> wrote:
> >> when vim is compiled with gtk2, I set guifont to monospace font,
> >> my chinese
> >> character spacing is wider than latin character,not as other gtk2
> >> applictions,the character spaing is united, can someone fix this
> >> problem?
>
> > Did you set guifontwide explicitly as well?
>
> > example from my .gvimrc
> >     set guifont=Luxi\ Mono\ 16
> >     set guifontwide=Kochi\ Mincho\ 20
> >     set linespace=3
>
> > Kornelis


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Tony Mechelynck

Kornelis wrote:

> On Oct 15, 8:41 pm, Kenneth Beesley <[hidden email]> wrote:
>> When you set both guifont and guifontwide,
>> when does vim use one, and when the other?
>>
>> Ken
>>
>
> It uses the guifont for the characters that are not wide and the
> guifontwide
> for those that are. Actually quite convinient, since you can select
> your best
> latin font and best Asian font at the same time. But you can also
> choose
> the same font for both (but not always - depends on the font).
>
> If you set only guifont on Linux Pango/Xft will choose a wide font to
> match,
> but for reasons unknown to me some combinations mess up the character
> spacing of the Asian font in gvim upto now. Therefore explicitly
> setting
> guifontwide as well works better for me.
>
> Best results are to be expected with a monospaced font for the latin
> font.
>
> Kornelis

The wide glyphs should be exactly twice the width of, and the same height as,
the narrow glyphs, regardless of whether or not you use the 'guifontwide' option.

Not setting 'guifontwide' (and selecting some East-Asian 'guifont' when
editing a file containing CJK text) works best for me on gvim with GTK2 GUI.
That way, proper size relations between wide and narrow glyphs are ensured by
the construction of the font itself.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
58. You turn on your computer and turn off your wife.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Kornelis

On Oct 16, 9:26 am, Tony Mechelynck <[hidden email]>
wrote:

> > > On Oct 15, 8:41 pm, Kenneth Beesley
> > > <[hidden email]> wrote: When you set both
> > > guifont and guifontwide, when does vim use one, and
> > > when the other? [snip]
> > It uses the guifont for the characters that are not
> > wide and the guifontwide for those that are. Actually
> > quite convinient, since you can select  your best
> > latin font and best Asian font at the same time. But
> > you can also choose the same font for both (but not
> > always - depends on the font).
> >
> > If you set only guifont on Linux Pango/Xft will
> > choose a wide font to match, but for reasons unknown
> > to me some combinations mess up the character spacing
> > of the Asian font in  gvim upto now.  Therefore
> > explicitly setting guifontwide as well works better
> > for me.
> >
> > Best results are to be expected with a monospaced
> > font for the latin font.

> The wide glyphs should be exactly twice the width of,
> and the same height as, the narrow glyphs, regardless
> of whether or not you use the 'guifontwide' option.

I thought the orignal poster was talking about TTF, but I
don't know how to determine the width of a TTF (I
remember I tried to find that out through fontconfig, but
according to my notes all I got was a width of 100 for
*all* my TTF fonts).

As for the height (still talking TTF) do you mean size? I
play with setting that to make a better match, but I never
noticed a problem.

But perhaps your comment was strictly with regard to
bitmap, unscalable fonts?

I know how to get info on the height and width of bitmap
fonts, and in fact I use bitmap fonts in gvim as a rule.
But in my experience thus far lots of users want to use
TTF. Perhaps I don't know how to get info on those
correctly, or perhaps things are different in different
distro's and/or wm's?  (Slackware 10.2 / Openbox here)

> Not setting 'guifontwide' (and selecting some
> East-Asian 'guifont' when editing a file containing CJK
> text) works best for me on gvim with GTK2 GUI.  That
> way, proper size relations between wide and narrow
> glyphs are ensured by the construction of the font
> itself.

When I set only guifont with a TTF, the results are
unpredictable in my version of gvim (version 7.0 on
Slackware 10.2). Some fonts are spaced correctly (e.g.
Kochi Mincho or HGSeikaishotaiPRO) others are  not. For
example the popular free TTF Bitstream Cyberbit spaces
too wide when I set only guifont. Some epson fonts I've
got display wrong as guifont as well. But when I set them
as guifontwide in combination with a latin monospace TTF
for guifont things are just fine.

I've seen this for many years, and I thought the original poster
was having the same problem. But perhaps my system is
broken and is my approach a crude end-user hack.








--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Donghai Zhu

I am talking about TTF fonts,I use fontconfig <alias> <prefer> to
combine latin fonts and cjk fonts,when I only set guifont the space
between cjk chars is about twice the
space between space between latin chars.Now problem solved,I think the
key point is set guifont and guifontwide with different size.By way,my
mlterm also have the same problem. Thanks.I think why vim can't behave
like other gtk applications,for example gedit,make all the chars have
the same space between each other.
2007/10/16, Kornelis <[hidden email]>:

>
> On Oct 16, 9:26 am, Tony Mechelynck <[hidden email]>
> wrote:
> > > > On Oct 15, 8:41 pm, Kenneth Beesley
> > > > <[hidden email]> wrote: When you set both
> > > > guifont and guifontwide, when does vim use one, and
> > > > when the other? [snip]
> > > It uses the guifont for the characters that are not
> > > wide and the guifontwide for those that are. Actually
> > > quite convinient, since you can select  your best
> > > latin font and best Asian font at the same time. But
> > > you can also choose the same font for both (but not
> > > always - depends on the font).
> > >
> > > If you set only guifont on Linux Pango/Xft will
> > > choose a wide font to match, but for reasons unknown
> > > to me some combinations mess up the character spacing
> > > of the Asian font in  gvim upto now.  Therefore
> > > explicitly setting guifontwide as well works better
> > > for me.
> > >
> > > Best results are to be expected with a monospaced
> > > font for the latin font.
>
> > The wide glyphs should be exactly twice the width of,
> > and the same height as, the narrow glyphs, regardless
> > of whether or not you use the 'guifontwide' option.
>
> I thought the orignal poster was talking about TTF, but I
> don't know how to determine the width of a TTF (I
> remember I tried to find that out through fontconfig, but
> according to my notes all I got was a width of 100 for
> *all* my TTF fonts).
>
> As for the height (still talking TTF) do you mean size? I
> play with setting that to make a better match, but I never
> noticed a problem.
>
> But perhaps your comment was strictly with regard to
> bitmap, unscalable fonts?
>
> I know how to get info on the height and width of bitmap
> fonts, and in fact I use bitmap fonts in gvim as a rule.
> But in my experience thus far lots of users want to use
> TTF. Perhaps I don't know how to get info on those
> correctly, or perhaps things are different in different
> distro's and/or wm's?  (Slackware 10.2 / Openbox here)
>
> > Not setting 'guifontwide' (and selecting some
> > East-Asian 'guifont' when editing a file containing CJK
> > text) works best for me on gvim with GTK2 GUI.  That
> > way, proper size relations between wide and narrow
> > glyphs are ensured by the construction of the font
> > itself.
>
> When I set only guifont with a TTF, the results are
> unpredictable in my version of gvim (version 7.0 on
> Slackware 10.2). Some fonts are spaced correctly (e.g.
> Kochi Mincho or HGSeikaishotaiPRO) others are  not. For
> example the popular free TTF Bitstream Cyberbit spaces
> too wide when I set only guifont. Some epson fonts I've
> got display wrong as guifont as well. But when I set them
> as guifontwide in combination with a latin monospace TTF
> for guifont things are just fine.
>
> I've seen this for many years, and I thought the original poster
> was having the same problem. But perhaps my system is
> broken and is my approach a crude end-user hack.
>
>
>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cjk char width is a little wider

Tony Mechelynck
In reply to this post by Kornelis

Kornelis wrote:

> On Oct 16, 9:26 am, Tony Mechelynck <[hidden email]>
> wrote:
>>>> On Oct 15, 8:41 pm, Kenneth Beesley
>>>> <[hidden email]> wrote: When you set both
>>>> guifont and guifontwide, when does vim use one, and
>>>> when the other? [snip]
>>> It uses the guifont for the characters that are not
>>> wide and the guifontwide for those that are. Actually
>>> quite convinient, since you can select  your best
>>> latin font and best Asian font at the same time. But
>>> you can also choose the same font for both (but not
>>> always - depends on the font).
>>>
>>> If you set only guifont on Linux Pango/Xft will
>>> choose a wide font to match, but for reasons unknown
>>> to me some combinations mess up the character spacing
>>> of the Asian font in  gvim upto now.  Therefore
>>> explicitly setting guifontwide as well works better
>>> for me.
>>>
>>> Best results are to be expected with a monospaced
>>> font for the latin font.
>
>> The wide glyphs should be exactly twice the width of,
>> and the same height as, the narrow glyphs, regardless
>> of whether or not you use the 'guifontwide' option.
>
> I thought the orignal poster was talking about TTF, but I
> don't know how to determine the width of a TTF (I
> remember I tried to find that out through fontconfig, but
> according to my notes all I got was a width of 100 for
> *all* my TTF fonts).
>
> As for the height (still talking TTF) do you mean size? I
> play with setting that to make a better match, but I never
> noticed a problem.
>
> But perhaps your comment was strictly with regard to
> bitmap, unscalable fonts?

My comment was about all fonts. The Vim character cell has a constant size all
over the screen, for all windows comprising one instance of Vim. One narrow
character occupies one cell, one wide character occupies two cells. The cell
size changes when you set the 'guifont'. The GTK2 GUI (alone among all
versions of gvim) will accept a font whose glyphs aren't all the same size,
but it will clip wider glyphs at the cell borders and it will fill narrower
glyphs with empty space, making the result ugly. Other gvim versions require
monospace fonts (which may be TrueType or OpenType); I have met fonts which
pretended to be monospace but weren't: for instance, the bold Cyrillic glyphs
of the Lucida Console font are one or two pixels wider than the character
cell. The result, again, was ugly.

>
> I know how to get info on the height and width of bitmap
> fonts, and in fact I use bitmap fonts in gvim as a rule.
> But in my experience thus far lots of users want to use
> TTF. Perhaps I don't know how to get info on those
> correctly, or perhaps things are different in different
> distro's and/or wm's?  (Slackware 10.2 / Openbox here)
>
>> Not setting 'guifontwide' (and selecting some
>> East-Asian 'guifont' when editing a file containing CJK
>> text) works best for me on gvim with GTK2 GUI.  That
>> way, proper size relations between wide and narrow
>> glyphs are ensured by the construction of the font
>> itself.
>
> When I set only guifont with a TTF, the results are
> unpredictable in my version of gvim (version 7.0 on
> Slackware 10.2). Some fonts are spaced correctly (e.g.
> Kochi Mincho or HGSeikaishotaiPRO) others are  not. For
> example the popular free TTF Bitstream Cyberbit spaces
> too wide when I set only guifont. Some epson fonts I've
> got display wrong as guifont as well. But when I set them
> as guifontwide in combination with a latin monospace TTF
> for guifont things are just fine.
>
> I've seen this for many years, and I thought the original poster
> was having the same problem. But perhaps my system is
> broken and is my approach a crude end-user hack.

I use Bitstream Vera Sans Mono for normal editing, Courier New for Arabic and
FZKaiTi for CJK, and it doesn't give me problems. (On Windows my favourite CJK
font used to be MingLiU and my favourite Latin font, Lucida Console.)


Best regards,
Tony.
--
         The Split-Atom Blues

Gimme Twinkies, gimme wine,
     Gimme jeans by Calvin Kline ...
But if you split those atoms fine,
     Mama keep 'em off those genes of mine!

Gimme zits, take my dough,
     Gimme arsenic in my jelly roll ...
Call the devil and sell my soul,
     But Mama keep dem atoms whole!
                -- Milo Bloom, "Bloom County"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---