bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied)


From: Dragan Ivanovic
Subject: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied)
Date: Tue, 01 Feb 2011 11:12:58 +0100 (CET)

Hi,

From: Jan Djärv <address@hidden>
Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied)
Date: Tue, 01 Feb 2011 08:49:55 +0100

> Basically what you do is replace average width with the width of 'M'?
> If it is a fixed pitch font, max_width, average_width and space_width
> should all be the same so I don't understand why you substituted space
> for 'M'.  I'm guessing it is the setting of max_width that fixes the
> problem?
> Does this make your frames half as big as they where before?

It turns out that some very good monospace fonts (mostly
Japanese-made), such as those in the M+ family:

http://mplus-fonts.sourceforge.jp/

contain glyphs of two sizes: the "normal" size for ASCII characters,
and double width for ideograms (Japanese characters).  So the fonts
are declared as monospaced, and they are, but within these two
separate realms. While font attributes on X systems include FC_DUAL to
indicate that situation, on Macs the FixedPitch property does not
differentiate.  Therefore, max_width is not the same as average_width
and space_width.  Now, there are two problems I have experienced there
on Max/Cocoa, and tried to address in the patch I sent:

1) Frames open twice as wide when using e.g. "M+ 1m" font.  This is
   addressed by using the width of a printable character instead of
   the maximum width from the font metrics. (Btw., I don't know how
   this affects Japanese users.)  It is not just the annoyance of
   having to resize fonts, of course, but also that all automatic text
   wrapping works wrongly.  Font metrics is obviously not reliable in
   this case.  Admittedly, choice of a character in the range 32-126
   should not be significant here, but:

2) In my experience, some otherwise monospaced fonts, such as Courier,
   tend to have wrong width for space in Emacs (it is much thinner
   than other characters).  I used to run into this all the time while
   using LaTeX (AUCTeX) in Emacs, which, by default, uses Courier for
   the verbatim environment, where I usually put listings.  It is
   extremely annoying to have the space of the "|" width there and see
   your listings garbled for no obvious reason.  I don't know what's
   causing this.  Once I replaced ' ' with 'M' in calculation of the
   space size, this problem has vanished.  It could be another letter,
   but 'm' (em-space, the widest letter), 'x' (ex-space, medium width
   letter) and 'n' (en-space, a thin letter) are normally used as the
   characteristic character widths in typography, so I chose 'M'.

By the way, Emacs patches for 1) can be found on Ubuntu forums, of
course for the X-based systems.

Cheers,

-- Dragan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]