diff options
| -rw-r--r-- | src/xdisp.c | 87 |
1 files changed, 71 insertions, 16 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 20c7634fc3e..9e8b4b130b9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -29638,9 +29638,9 @@ get_char_face_and_encoding (struct frame *f, int c, int face_id, | |||
| 29638 | } | 29638 | } |
| 29639 | 29639 | ||
| 29640 | 29640 | ||
| 29641 | /* Get face and two-byte form of character glyph GLYPH on frame F. | 29641 | /* Get face glyph GLYPH on frame F, and if a character glyph, its |
| 29642 | The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is | 29642 | multi-byte character form in *CHAR2B. Value is a pointer to a |
| 29643 | a pointer to a realized face that is ready for display. */ | 29643 | realized face that is ready for display. */ |
| 29644 | 29644 | ||
| 29645 | static struct face * | 29645 | static struct face * |
| 29646 | get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, | 29646 | get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, |
| @@ -29655,19 +29655,23 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, | |||
| 29655 | /* Make sure X resources of the face are allocated. */ | 29655 | /* Make sure X resources of the face are allocated. */ |
| 29656 | prepare_face_for_display (f, face); | 29656 | prepare_face_for_display (f, face); |
| 29657 | 29657 | ||
| 29658 | if (face->font) | 29658 | if (glyph->type == CHAR_GLYPH) |
| 29659 | { | 29659 | { |
| 29660 | if (CHAR_BYTE8_P (glyph->u.ch)) | 29660 | if (face->font) |
| 29661 | code = CHAR_TO_BYTE8 (glyph->u.ch); | 29661 | { |
| 29662 | else | 29662 | if (CHAR_BYTE8_P (glyph->u.ch)) |
| 29663 | code = face->font->driver->encode_char (face->font, glyph->u.ch); | 29663 | code = CHAR_TO_BYTE8 (glyph->u.ch); |
| 29664 | else | ||
| 29665 | code = face->font->driver->encode_char (face->font, glyph->u.ch); | ||
| 29664 | 29666 | ||
| 29665 | if (code == FONT_INVALID_CODE) | 29667 | if (code == FONT_INVALID_CODE) |
| 29666 | code = 0; | 29668 | code = 0; |
| 29669 | } | ||
| 29670 | |||
| 29671 | /* Ensure that the code is only 2 bytes wide. */ | ||
| 29672 | *char2b = code & 0xFFFF; | ||
| 29667 | } | 29673 | } |
| 29668 | 29674 | ||
| 29669 | /* Ensure that the code is only 2 bytes wide. */ | ||
| 29670 | *char2b = code & 0xFFFF; | ||
| 29671 | return face; | 29675 | return face; |
| 29672 | } | 29676 | } |
| 29673 | 29677 | ||
| @@ -30167,17 +30171,28 @@ normal_char_height (struct font *font, int c) | |||
| 30167 | void | 30171 | void |
| 30168 | gui_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right) | 30172 | gui_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *right) |
| 30169 | { | 30173 | { |
| 30174 | unsigned char2b; | ||
| 30175 | struct face *face; | ||
| 30176 | |||
| 30170 | *left = *right = 0; | 30177 | *left = *right = 0; |
| 30178 | face = get_glyph_face_and_encoding (f, glyph, &char2b); | ||
| 30171 | 30179 | ||
| 30172 | if (glyph->type == CHAR_GLYPH) | 30180 | if (glyph->type == CHAR_GLYPH) |
| 30173 | { | 30181 | { |
| 30174 | unsigned char2b; | ||
| 30175 | struct face *face = get_glyph_face_and_encoding (f, glyph, &char2b); | ||
| 30176 | if (face->font) | 30182 | if (face->font) |
| 30177 | { | 30183 | { |
| 30178 | struct font_metrics *pcm = get_per_char_metric (face->font, &char2b); | 30184 | struct font_metrics *pcm |
| 30185 | = get_per_char_metric (face->font, &char2b); | ||
| 30186 | |||
| 30179 | if (pcm) | 30187 | if (pcm) |
| 30180 | { | 30188 | { |
| 30189 | /* Overstruck text is displayed twice, the second time | ||
| 30190 | one pixel to the right. Increase the right-side | ||
| 30191 | bearing to match. */ | ||
| 30192 | |||
| 30193 | if (face->overstrike) | ||
| 30194 | pcm->rbearing++; | ||
| 30195 | |||
| 30181 | if (pcm->rbearing > pcm->width) | 30196 | if (pcm->rbearing > pcm->width) |
| 30182 | *right = pcm->rbearing - pcm->width; | 30197 | *right = pcm->rbearing - pcm->width; |
| 30183 | if (pcm->lbearing < 0) | 30198 | if (pcm->lbearing < 0) |
| @@ -30190,8 +30205,18 @@ gui_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *r | |||
| 30190 | if (! glyph->u.cmp.automatic) | 30205 | if (! glyph->u.cmp.automatic) |
| 30191 | { | 30206 | { |
| 30192 | struct composition *cmp = composition_table[glyph->u.cmp.id]; | 30207 | struct composition *cmp = composition_table[glyph->u.cmp.id]; |
| 30208 | int rbearing; | ||
| 30209 | |||
| 30210 | rbearing = cmp->rbearing; | ||
| 30193 | 30211 | ||
| 30194 | if (cmp->rbearing > cmp->pixel_width) | 30212 | /* Overstruck text is displayed twice, the second time one |
| 30213 | pixel to the right. Increase the right-side bearing to | ||
| 30214 | match. */ | ||
| 30215 | |||
| 30216 | if (face->overstrike) | ||
| 30217 | rbearing++; | ||
| 30218 | |||
| 30219 | if (rbearing > cmp->pixel_width) | ||
| 30195 | *right = cmp->rbearing - cmp->pixel_width; | 30220 | *right = cmp->rbearing - cmp->pixel_width; |
| 30196 | if (cmp->lbearing < 0) | 30221 | if (cmp->lbearing < 0) |
| 30197 | *left = - cmp->lbearing; | 30222 | *left = - cmp->lbearing; |
| @@ -30203,6 +30228,14 @@ gui_get_glyph_overhangs (struct glyph *glyph, struct frame *f, int *left, int *r | |||
| 30203 | 30228 | ||
| 30204 | composition_gstring_width (gstring, glyph->slice.cmp.from, | 30229 | composition_gstring_width (gstring, glyph->slice.cmp.from, |
| 30205 | glyph->slice.cmp.to + 1, &metrics); | 30230 | glyph->slice.cmp.to + 1, &metrics); |
| 30231 | |||
| 30232 | /* Overstruck text is displayed twice, the second time one | ||
| 30233 | pixel to the right. Increase the right-side bearing to | ||
| 30234 | match. */ | ||
| 30235 | |||
| 30236 | if (face->overstrike) | ||
| 30237 | metrics.rbearing++; | ||
| 30238 | |||
| 30206 | if (metrics.rbearing > metrics.width) | 30239 | if (metrics.rbearing > metrics.width) |
| 30207 | *right = metrics.rbearing - metrics.width; | 30240 | *right = metrics.rbearing - metrics.width; |
| 30208 | if (metrics.lbearing < 0) | 30241 | if (metrics.lbearing < 0) |
| @@ -32311,6 +32344,14 @@ gui_produce_glyphs (struct it *it) | |||
| 32311 | if (get_char_glyph_code (it->char_to_display, font, &char2b)) | 32344 | if (get_char_glyph_code (it->char_to_display, font, &char2b)) |
| 32312 | { | 32345 | { |
| 32313 | pcm = get_per_char_metric (font, &char2b); | 32346 | pcm = get_per_char_metric (font, &char2b); |
| 32347 | |||
| 32348 | /* Overstruck text is displayed twice, the second time | ||
| 32349 | one pixel to the right. Increase the right-side | ||
| 32350 | bearing to match. */ | ||
| 32351 | |||
| 32352 | if (pcm && face->overstrike) | ||
| 32353 | pcm->rbearing++; | ||
| 32354 | |||
| 32314 | if (pcm->width == 0 | 32355 | if (pcm->width == 0 |
| 32315 | && pcm->rbearing == 0 && pcm->lbearing == 0) | 32356 | && pcm->rbearing == 0 && pcm->lbearing == 0) |
| 32316 | pcm = NULL; | 32357 | pcm = NULL; |
| @@ -32703,6 +32744,13 @@ gui_produce_glyphs (struct it *it) | |||
| 32703 | /* Initialize the bounding box. */ | 32744 | /* Initialize the bounding box. */ |
| 32704 | if (pcm) | 32745 | if (pcm) |
| 32705 | { | 32746 | { |
| 32747 | /* Overstruck text is displayed twice, the second time | ||
| 32748 | one pixel to the right. Increase the right-side | ||
| 32749 | bearing to match. */ | ||
| 32750 | |||
| 32751 | if (face->overstrike) | ||
| 32752 | pcm->rbearing++; | ||
| 32753 | |||
| 32706 | width = cmp->glyph_len > 0 ? pcm->width : 0; | 32754 | width = cmp->glyph_len > 0 ? pcm->width : 0; |
| 32707 | ascent = pcm->ascent; | 32755 | ascent = pcm->ascent; |
| 32708 | descent = pcm->descent; | 32756 | descent = pcm->descent; |
| @@ -32764,6 +32812,13 @@ gui_produce_glyphs (struct it *it) | |||
| 32764 | cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0; | 32812 | cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0; |
| 32765 | else | 32813 | else |
| 32766 | { | 32814 | { |
| 32815 | /* Overstruck text is displayed twice, the second | ||
| 32816 | time one pixel to the right. Increase the | ||
| 32817 | right-side bearing to match. */ | ||
| 32818 | |||
| 32819 | if (face->overstrike) | ||
| 32820 | pcm->rbearing++; | ||
| 32821 | |||
| 32767 | width = pcm->width; | 32822 | width = pcm->width; |
| 32768 | ascent = pcm->ascent; | 32823 | ascent = pcm->ascent; |
| 32769 | descent = pcm->descent; | 32824 | descent = pcm->descent; |