unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Emacs should check font width also when spacing is dual
@ 2009-06-17 14:56 Naohiro Aota
  2009-06-17 17:16 ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Naohiro Aota @ 2009-06-17 14:56 UTC (permalink / raw)
  To: emacs-devel

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  <naota@elisp.net>

	* 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,




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-18  0:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17 14:56 [PATCH] Emacs should check font width also when spacing is dual Naohiro Aota
2009-06-17 17:16 ` Chong Yidong
2009-06-18  0:57   ` Naohiro Aota

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).