emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Emacs should check font width also when spacing is dual


From: Naohiro Aota
Subject: [PATCH] Emacs should check font width also when spacing is dual
Date: Wed, 17 Jun 2009 23:56:39 +0900
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.94 (gnu/linux)

Hi,

I found that emacs check character width one by one to calculate
font->min_width, font->average_width, font->space_width only when
`spacing' is not FC_PROPORTIONAL. But fontconfig's doc (1) says
"FC_DUAL, where the font has glyphs in precisely two widths, one twice
as wide as the other". So emacs should check them one by one also when
spacing is dual. Current behavior causes tab width to be doubled and so
indent to be strange.

To solve this, I suggest a tiny patch below. 

2009-06-17  Naohiro Aota  <address@hidden>

        * xftfont.c (xftfont_open): Check font width one by one also when
        spacing is dual.

        * ftfont.c (ftfont_open): Ditto.

--8<---------------cut here---------------start------------->8---
--- src/ftfont.c        17 Apr 2009 18:38:02 -0000      1.54
+++ src/ftfont.c        17 Jun 2009 14:51:37 -0000
@@ -1244,7 +1244,7 @@
     spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
   else
     spacing = FC_PROPORTIONAL;
-  if (spacing != FC_PROPORTIONAL)
+  if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL)
     font->min_width = font->average_width = font->space_width
       = (scalable ? ft_face->max_advance_width * size / upEM
         : ft_face->size->metrics.max_advance >> 6);
--- src/xftfont.c       11 May 2009 09:29:49 -0000      1.24
+++ src/xftfont.c       17 Jun 2009 14:51:37 -0000
@@ -333,7 +333,7 @@
        ascii_printable[i] = ' ' + i;
     }
   BLOCK_INPUT;
-  if (spacing != FC_PROPORTIONAL)
+  if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL)
     {
       font->min_width = font->average_width = font->space_width
        = xftfont->max_advance_width;
--8<---------------cut here---------------end--------------->8---

(1) http://fontconfig.org/fontconfig-devel/r1283.html

Regards,




reply via email to

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