]> code.delx.au - gnu-emacs/commitdiff
Fix display of composite characters with large fonts
authorEli Zaretskii <eliz@gnu.org>
Sat, 30 May 2015 16:25:53 +0000 (19:25 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 30 May 2015 16:25:53 +0000 (19:25 +0300)
* src/xdisp.c (x_produce_glyphs): Call normal_char_ascent_descent
for reasonable values of font ascent and descent.
(get_font_ascent_descent): New function.

* src/composite.c (composition_gstring_width): Call
get_font_ascent_descent for reasonable values of font ascent and
descent.

* dispextern.h: Add prototype for get_font_ascent_descent.

src/composite.c
src/dispextern.h
src/xdisp.c

index 577b97920f47d2e6a3842c52273ee3b24739592a..e942eef3006a7ccb79ad058801babd21d37f479b 100644 (file)
@@ -732,9 +732,11 @@ composition_gstring_width (Lisp_Object gstring, ptrdiff_t from, ptrdiff_t to,
       if (FONT_OBJECT_P (font_object))
        {
          struct font *font = XFONT_OBJECT (font_object);
+         int font_ascent, font_descent;
 
-         metrics->ascent = font->ascent;
-         metrics->descent = font->descent;
+         get_font_ascent_descent (font, &font_ascent, &font_descent);
+         metrics->ascent = font_ascent;
+         metrics->descent = font_descent;
        }
       else
        {
index 1537d44330d8e4384e1bf13ce31bc00a7048399c..5202142313a2213e69a83e8a5460f6ad26753fc3 100644 (file)
@@ -3246,6 +3246,8 @@ extern ptrdiff_t compute_display_string_end (ptrdiff_t,
 extern void produce_stretch_glyph (struct it *);
 extern int merge_glyphless_glyph_face (struct it *);
 
+extern void get_font_ascent_descent (struct font *, int *, int *);
+
 #ifdef HAVE_WINDOW_SYSTEM
 
 #ifdef GLYPH_DEBUG
index 50d7376b28a22b84afa1ac7639ee0faea51544e8..53303272e60a9d0106322c8440f40c19a1c67d93 100644 (file)
@@ -24079,6 +24079,17 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
   return false;
 }
 
+void
+get_font_ascent_descent (struct font *font, int *ascent, int *descent)
+{
+#ifdef HAVE_WINDOW_SYSTEM
+  normal_char_ascent_descent (font, -1, ascent, descent);
+#else
+  *ascent = 1;
+  *descent = 0;
+#endif
+}
+
 \f
 /***********************************************************************
                             Glyph Display
@@ -26818,9 +26829,10 @@ x_produce_glyphs (struct it *it)
          boff = font->baseline_offset;
          if (font->vertical_centering)
            boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
-         font_ascent = FONT_BASE (font) + boff;
-         font_descent = FONT_DESCENT (font) - boff;
-         font_height = FONT_HEIGHT (font);
+         normal_char_ascent_descent (font, -1, &font_ascent, &font_descent);
+         font_ascent +=  boff;
+         font_descent -= boff;
+         font_height = font_ascent + font_descent;
 
          cmp->font = font;