diff options
| author | Eli Zaretskii | 2015-05-30 19:25:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-05-30 19:25:53 +0300 |
| commit | 643470ff797407b256eea380e0f41d3749400927 (patch) | |
| tree | e83f536e29595ae218a41d6fb9a909c305247f81 /src | |
| parent | ba5f83dfe5dea1b9dd3fca5d21384afc92cd2060 (diff) | |
| download | emacs-643470ff797407b256eea380e0f41d3749400927.tar.gz emacs-643470ff797407b256eea380e0f41d3749400927.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/composite.c | 6 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 18 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/composite.c b/src/composite.c index 577b97920f4..e942eef3006 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, | |||
| 732 | if (FONT_OBJECT_P (font_object)) | 732 | if (FONT_OBJECT_P (font_object)) |
| 733 | { | 733 | { |
| 734 | struct font *font = XFONT_OBJECT (font_object); | 734 | struct font *font = XFONT_OBJECT (font_object); |
| 735 | int font_ascent, font_descent; | ||
| 735 | 736 | ||
| 736 | metrics->ascent = font->ascent; | 737 | get_font_ascent_descent (font, &font_ascent, &font_descent); |
| 737 | metrics->descent = font->descent; | 738 | metrics->ascent = font_ascent; |
| 739 | metrics->descent = font_descent; | ||
| 738 | } | 740 | } |
| 739 | else | 741 | else |
| 740 | { | 742 | { |
diff --git a/src/dispextern.h b/src/dispextern.h index 1537d44330d..5202142313a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3246,6 +3246,8 @@ extern ptrdiff_t compute_display_string_end (ptrdiff_t, | |||
| 3246 | extern void produce_stretch_glyph (struct it *); | 3246 | extern void produce_stretch_glyph (struct it *); |
| 3247 | extern int merge_glyphless_glyph_face (struct it *); | 3247 | extern int merge_glyphless_glyph_face (struct it *); |
| 3248 | 3248 | ||
| 3249 | extern void get_font_ascent_descent (struct font *, int *, int *); | ||
| 3250 | |||
| 3249 | #ifdef HAVE_WINDOW_SYSTEM | 3251 | #ifdef HAVE_WINDOW_SYSTEM |
| 3250 | 3252 | ||
| 3251 | #ifdef GLYPH_DEBUG | 3253 | #ifdef GLYPH_DEBUG |
diff --git a/src/xdisp.c b/src/xdisp.c index 50d7376b28a..53303272e60 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, | |||
| 24079 | return false; | 24079 | return false; |
| 24080 | } | 24080 | } |
| 24081 | 24081 | ||
| 24082 | void | ||
| 24083 | get_font_ascent_descent (struct font *font, int *ascent, int *descent) | ||
| 24084 | { | ||
| 24085 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24086 | normal_char_ascent_descent (font, -1, ascent, descent); | ||
| 24087 | #else | ||
| 24088 | *ascent = 1; | ||
| 24089 | *descent = 0; | ||
| 24090 | #endif | ||
| 24091 | } | ||
| 24092 | |||
| 24082 | 24093 | ||
| 24083 | /*********************************************************************** | 24094 | /*********************************************************************** |
| 24084 | Glyph Display | 24095 | Glyph Display |
| @@ -26818,9 +26829,10 @@ x_produce_glyphs (struct it *it) | |||
| 26818 | boff = font->baseline_offset; | 26829 | boff = font->baseline_offset; |
| 26819 | if (font->vertical_centering) | 26830 | if (font->vertical_centering) |
| 26820 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; | 26831 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; |
| 26821 | font_ascent = FONT_BASE (font) + boff; | 26832 | normal_char_ascent_descent (font, -1, &font_ascent, &font_descent); |
| 26822 | font_descent = FONT_DESCENT (font) - boff; | 26833 | font_ascent += boff; |
| 26823 | font_height = FONT_HEIGHT (font); | 26834 | font_descent -= boff; |
| 26835 | font_height = font_ascent + font_descent; | ||
| 26824 | 26836 | ||
| 26825 | cmp->font = font; | 26837 | cmp->font = font; |
| 26826 | 26838 | ||