summaryrefslogtreecommitdiff
path: root/src/font.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@gnu.org>2014-07-20 00:18:23 +0900
committerKenichi Handa <handa@gnu.org>2014-07-20 00:18:23 +0900
commitbf0d3f76dcfe7881cb3058169b51cf6602fdcdcb (patch)
tree4d4c958973053b9c4427272c204b5e21fb03f89c /src/font.c
parent31ca1841d2e25983fbcc44302ee9eff0b3a1554a (diff)
downloademacs-bf0d3f76dcfe7881cb3058169b51cf6602fdcdcb.tar.gz
2014-07-19 Kenichi Handa <handa@gnu.org>
* xfaces.c (realize_x_face): Call font_load_for_lface with no mandatory font spec (Bug#17973). 2014-07-19 Stefan Monnier <monnier@iro.umontreal.ca> * font.c (font_score): Return the worst score if the size of ENTITY is wrong by more than a factor 2 (Bug#17973).
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/font.c b/src/font.c
index ef8b5e40eeb..054a68bfd94 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2158,10 +2158,14 @@ font_score (Lisp_Object entity, Lisp_Object *spec_prop)
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;