all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: handa@gnu.org (K. Handa)
Cc: 17973@debbugs.gnu.org
Subject: bug#17973: Thin space not thin at all
Date: Thu, 10 Jul 2014 12:37:27 -0400	[thread overview]
Message-ID: <jwvzjghmeli.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87a98he19h.fsf@gnu.org> (K. Handa's message of "Thu, 10 Jul 2014 23:28:42 +0900")

> Do you customize face-font-selection-order?  It's default
> value is (:width :height :weight :slant), which means that
> the function font_select_entity (called from
> font_find_for_lface) selects a font whose :width is
> semicondensed even if that font has very different height
> from what specified.

Ah, right, that explains it.  Hmm... I guess ideally, Emacs should
consider a height that's "too far" from the requested one as a failure
and then try again ignoring some of the specs.

The patch below expresses the first part, but it looks like the second
part doesn't exit: Emacs just doesn't find any font to use for the "thin
space" of C-x SPC and indicates it to me with one of those big squares
that say "0020", which is a lot more intrusive than the problem I'm
trying to fix.

And (setq scalable-fonts-allowed t) doesn't help either.

Maybe a solution/workaround for the specific problem of such "thin
lines" is to replace the (:height 0.2) face with another face that
specifies "any family".  If I use (:height 0.2 :family "Monospace"),
indeed, the problem disappears.  Is there a better "any family" than
"Monospace"?


        Stefan


PS: The patch below also happens to give me assertion failures
fontset.c:897: Emacs fatal error: assertion failed: fontset_id_valid_p (face->fontset)
I haven't investigated any further, tho (and the line number might be off
because of local changes anyway).


=== modified file 'src/font.c'
--- src/font.c	2014-07-09 13:45:53 +0000
+++ src/font.c	2014-07-10 16:11:04 +0000
@@ -2165,10 +2165,14 @@
 	 lowest bit is set if the DPI is different.  */
       EMACS_INT diff;
       EMACS_INT pixel_size = XINT (spec_prop[FONT_SIZE_INDEX]);
+      EMACS_INT entity_size = XINT (AREF (entity, FONT_SIZE_INDEX));
 
       if (CONSP (Vface_font_rescale_alist))
 	pixel_size *= font_rescale_ratio (entity);
-      diff = eabs (pixel_size - XINT (AREF (entity, FONT_SIZE_INDEX))) << 1;
+      if (pixel_size * 2 < entity_size || entity_size * 2 < pixel_size)
+	/* This size is wrong by more than a factor 2: reject it!  */
+	return 0xFFFFFFFF;
+      diff = eabs (pixel_size - entity_size) << 1;
       if (! NILP (spec_prop[FONT_DPI_INDEX])
 	  && ! EQ (spec_prop[FONT_DPI_INDEX], AREF (entity, FONT_DPI_INDEX)))
 	diff |= 1;






  reply	other threads:[~2014-07-10 16:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 18:07 bug#17973: Thin space not thin at all Stefan Monnier
2014-07-09 15:32 ` K. Handa
2014-07-09 19:21   ` Stefan Monnier
2014-07-10 14:28     ` K. Handa
2014-07-10 16:37       ` Stefan Monnier [this message]
2014-07-13 15:12         ` K. Handa
2014-07-19  6:13           ` Stefan Monnier
2014-07-19 15:57             ` K. Handa
2014-07-19 17:30               ` Stefan Monnier

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=jwvzjghmeli.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=17973@debbugs.gnu.org \
    --cc=handa@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.