all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Fangwen Yu <yynyygy@gmail.com>, Kenichi Handa <handa@gnu.org>
Cc: 22383@debbugs.gnu.org
Subject: bug#22383: 25.1.50; Wrong font height for some fonts
Date: Sat, 16 Jan 2016 10:11:54 +0200	[thread overview]
Message-ID: <834meeeyet.fsf@gnu.org> (raw)
In-Reply-To: <CAPtZNR2MGKDcCM706RB1cYq8Bjz8fEjQXvYHxQ0W5_t=wqc6-w@mail.gmail.com> (message from Fangwen Yu on Sat, 16 Jan 2016 15:07:04 +0800)

> Date: Sat, 16 Jan 2016 15:07:04 +0800
> From: Fangwen Yu <yynyygy@gmail.com>
> 
> With DejaVu Sans Mono-11, text lines in Emacs are 1 pixel taller than in
> gedit or gnome-terminal, also, bold faces are 1 pixel taller than
> regular, so if the theme uses bold faces, texts will jump up and down
> while editing. The line height problem also happens with Consolas font,
> but the bold faces problem doesn't.
> 
> Since it clearly has something to do with font height, I digged into the
> source and found the related code. Apply this patch, and the problem is
> gone:
> 
> diff --git a/src/xftfont.c b/src/xftfont.c
> index 956231e..d0f9a68 100644
> --- a/src/xftfont.c
> +++ b/src/xftfont.c
> @@ -395,16 +395,16 @@ xftfont_open (struct frame *f, Lisp_Object entity, int
> pixel_size)
> 
> font->ascent = xftfont->ascent;
> font->descent = xftfont->descent;
> - if (pixel_size >= 5)
> - {
> - /* The above condition is a dirty workaround because
> - XftTextExtents8 behaves strangely for some fonts
> - (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */
> - if (font->ascent < extents.y)
> - font->ascent = extents.y;
> - if (font->descent < extents.height - extents.y)
> - font->descent = extents.height - extents.y;
> - }
> + /* if (pixel_size >= 5) */
> + /* { */
> + /* /\* The above condition is a dirty workaround because */
> + /* XftTextExtents8 behaves strangely for some fonts */
> + /* (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. *\/ */
> + /* if (font->ascent < extents.y) */
> + /* font->ascent = extents.y; */
> + /* if (font->descent < extents.height - extents.y) */
> + /* font->descent = extents.height - extents.y; */
> + /* } */
> font->height = font->ascent + font->descent;
> 
> if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0)
> 
> As the comment says, this piece of code is a dirty workaround, and
> apparently it is causing some new problems.

Thanks for the report and the patch.

I'm CC'ing Handa-san, who wrote that code, in the hope that he could
comment on this issue.





  reply	other threads:[~2016-01-16  8:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-16  7:07 bug#22383: 25.1.50; Wrong font height for some fonts Fangwen Yu
2016-01-16  8:11 ` Eli Zaretskii [this message]
2016-01-28 13:00   ` handa
2016-02-25 20:02     ` Eli Zaretskii

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=834meeeyet.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=22383@debbugs.gnu.org \
    --cc=handa@gnu.org \
    --cc=yynyygy@gmail.com \
    /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.