emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/large-fonts 643470f: Fix display of composite char


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/large-fonts 643470f: Fix display of composite characters with large fonts
Date: Sat, 30 May 2015 16:26:57 +0000

branch: scratch/large-fonts
commit 643470ff797407b256eea380e0f41d3749400927
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix display of composite characters with large fonts
    
    * 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  |    6 ++++--
 src/dispextern.h |    2 ++
 src/xdisp.c      |   18 +++++++++++++++---
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/composite.c b/src/composite.c
index 577b979..e942eef 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -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
        {
diff --git a/src/dispextern.h b/src/dispextern.h
index 1537d44..5202142 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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
diff --git a/src/xdisp.c b/src/xdisp.c
index 50d7376..5330327 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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
+}
+
 
 /***********************************************************************
                             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;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]