From: Naohiro Aota <naota@elisp.net>
To: emacs-devel@gnu.org
Subject: [PATCH] Emacs should check font width also when spacing is dual
Date: Wed, 17 Jun 2009 23:56:39 +0900 [thread overview]
Message-ID: <87skhyzz6g.fsf@yue.localnetwork> (raw)
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,
next reply other threads:[~2009-06-17 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 14:56 Naohiro Aota [this message]
2009-06-17 17:16 ` [PATCH] Emacs should check font width also when spacing is dual Chong Yidong
2009-06-18 0:57 ` Naohiro Aota
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87skhyzz6g.fsf@yue.localnetwork \
--to=naota@elisp.net \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.