summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@gnu.org>2012-10-24 00:42:29 +0900
committerKenichi Handa <handa@gnu.org>2012-10-24 00:42:29 +0900
commit7e70a15287ee1ae5461d47e5a96d6c455aefaf57 (patch)
treee57d62a1371a3fe3dce0aa0ef3ca2369f7d6fcd8
parent6ec83f926d5ff699901fb530162d7f1bdfa85808 (diff)
downloademacs-7e70a15287ee1ae5461d47e5a96d6c455aefaf57.tar.gz
emacs-7e70a15287ee1ae5461d47e5a96d6c455aefaf57.tar.bz2
emacs-7e70a15287ee1ae5461d47e5a96d6c455aefaf57.zip
Make face-font-rescale-alist work correctly for non-ASCII fonts.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/font.c46
2 files changed, 32 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5a1b4a5d8ee..fbf22c35e4c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-23 Kenichi Handa <handa@gnu.org>
+
+ The following change is to make face-font-rescale-alist work
+ correctly for non-ASCII fonts.
+
+ * font.c (font_open_entity): Don't handle Vface_font_rescale_alist.
+ (font_open_for_lface): Handle Vface_font_rescale_alist.
+
2012-10-19 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change)
* font.c (Ffont_at): Fix previous change.
diff --git a/src/font.c b/src/font.c
index 7cb4149ac4e..bff2356d6ca 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2816,14 +2816,11 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
Lisp_Object objlist, size, val, font_object;
struct font *font;
int min_width, height;
- int scaled_pixel_size = pixel_size;
eassert (FONT_ENTITY_P (entity));
size = AREF (entity, FONT_SIZE_INDEX);
if (XINT (size) != 0)
- scaled_pixel_size = pixel_size = XINT (size);
- else if (CONSP (Vface_font_rescale_alist))
- scaled_pixel_size = pixel_size * font_rescale_ratio (entity);
+ pixel_size = XINT (size);
val = AREF (entity, FONT_TYPE_INDEX);
for (driver_list = f->font_driver_list;
@@ -2845,7 +2842,7 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
}
}
- font_object = driver_list->driver->open (f, entity, scaled_pixel_size);
+ font_object = driver_list->driver->open (f, entity, pixel_size);
if (!NILP (font_object))
ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size));
FONT_ADD_LOG ("open", entity, font_object);
@@ -3230,31 +3227,36 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O
if (INTEGERP (AREF (entity, FONT_SIZE_INDEX))
&& XINT (AREF (entity, FONT_SIZE_INDEX)) > 0)
size = XINT (AREF (entity, FONT_SIZE_INDEX));
- else if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX)))
- size = font_pixel_size (f, spec);
else
{
- double pt;
- if (INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
- pt = XINT (attrs[LFACE_HEIGHT_INDEX]);
+ if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX)))
+ size = font_pixel_size (f, spec);
else
{
- struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX];
- eassert (INTEGERP (height));
- pt = XINT (height);
- }
+ double pt;
+ if (INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
+ pt = XINT (attrs[LFACE_HEIGHT_INDEX]);
+ else
+ {
+ struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX];
+ eassert (INTEGERP (height));
+ pt = XINT (height);
+ }
- pt /= 10;
- size = POINT_TO_PIXEL (pt, f->resy);
+ pt /= 10;
+ size = POINT_TO_PIXEL (pt, f->resy);
#ifdef HAVE_NS
- if (size == 0)
- {
- Lisp_Object ffsize = get_frame_param (f, Qfontsize);
- size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0;
- }
+ if (size == 0)
+ {
+ Lisp_Object ffsize = get_frame_param (f, Qfontsize);
+ size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0;
+ }
#endif
+ }
+ size *= font_rescale_ratio (entity);
}
+
return font_open_entity (f, entity, size);
}