diff options
| author | Eli Zaretskii | 2019-07-01 21:12:55 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-07-01 21:12:55 +0300 |
| commit | 0f830340afc48461c021b858370004972162837c (patch) | |
| tree | a2cbda5b057e72543df82c1cf3e25fdb3a3310ea /src | |
| parent | 50c98fdc0f9a7da65521fa1e4965e2f27b5557d8 (diff) | |
| download | emacs-0f830340afc48461c021b858370004972162837c.tar.gz emacs-0f830340afc48461c021b858370004972162837c.zip | |
More XFIXNUM fixes
* src/hbfont.c (hbfont_shape): Don't assume LGLYPH_TO is
always a fixnum.
* src/fontset.c (fontset_find_font): A cleaner test for
matching charset_id.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fontset.c | 34 | ||||
| -rw-r--r-- | src/hbfont.c | 6 |
2 files changed, 23 insertions, 17 deletions
diff --git a/src/fontset.c b/src/fontset.c index 137d2895932..828e7fe70cc 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -564,23 +564,25 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, | |||
| 564 | or the charset priorities were changed. */ | 564 | or the charset priorities were changed. */ |
| 565 | reorder_font_vector (font_group, face->ascii_face->font); | 565 | reorder_font_vector (font_group, face->ascii_face->font); |
| 566 | if (charset_id >= 0) | 566 | if (charset_id >= 0) |
| 567 | /* Find a spec matching with CHARSET_ID to try it at | 567 | { |
| 568 | first. */ | 568 | Lisp_Object lcsetid = make_fixnum (charset_id); |
| 569 | for (i = 0; i < ASIZE (vec); i++) | 569 | /* Find a spec matching with CHARSET_ID to try it at first. */ |
| 570 | { | 570 | for (i = 0; i < ASIZE (vec); i++) |
| 571 | Lisp_Object repertory; | 571 | { |
| 572 | 572 | Lisp_Object repertory; | |
| 573 | rfont_def = AREF (vec, i); | 573 | |
| 574 | if (NILP (rfont_def)) | 574 | rfont_def = AREF (vec, i); |
| 575 | break; | 575 | if (NILP (rfont_def)) |
| 576 | repertory = FONT_DEF_REPERTORY (RFONT_DEF_FONT_DEF (rfont_def)); | ||
| 577 | |||
| 578 | if (FIXNUMP (repertory) && XFIXNUM_RAW (repertory) == charset_id) | ||
| 579 | { | ||
| 580 | charset_matched = i; | ||
| 581 | break; | 576 | break; |
| 582 | } | 577 | repertory = FONT_DEF_REPERTORY (RFONT_DEF_FONT_DEF (rfont_def)); |
| 583 | } | 578 | |
| 579 | if (EQ (repertory, lcsetid)) | ||
| 580 | { | ||
| 581 | charset_matched = i; | ||
| 582 | break; | ||
| 583 | } | ||
| 584 | } | ||
| 585 | } | ||
| 584 | } | 586 | } |
| 585 | 587 | ||
| 586 | /* Find the first available font in the vector of RFONT-DEF. If | 588 | /* Find the first available font in the vector of RFONT-DEF. If |
diff --git a/src/hbfont.c b/src/hbfont.c index 455c1a7a554..db10f92e313 100644 --- a/src/hbfont.c +++ b/src/hbfont.c | |||
| @@ -512,9 +512,11 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 512 | Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); | 512 | Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); |
| 513 | struct font_metrics metrics = {.width = 0}; | 513 | struct font_metrics metrics = {.width = 0}; |
| 514 | int xoff, yoff, wadjust; | 514 | int xoff, yoff, wadjust; |
| 515 | bool new_lglyph = false; | ||
| 515 | 516 | ||
| 516 | if (NILP (lglyph)) | 517 | if (NILP (lglyph)) |
| 517 | { | 518 | { |
| 519 | new_lglyph = true; | ||
| 518 | lglyph = LGLYPH_NEW (); | 520 | lglyph = LGLYPH_NEW (); |
| 519 | LGSTRING_SET_GLYPH (lgstring, i, lglyph); | 521 | LGSTRING_SET_GLYPH (lgstring, i, lglyph); |
| 520 | } | 522 | } |
| @@ -556,7 +558,9 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 556 | in the original sequence were processed by the composition. | 558 | in the original sequence were processed by the composition. |
| 557 | If we don't do this, some of the composed characters will be | 559 | If we don't do this, some of the composed characters will be |
| 558 | displayed again as separate glyphs. */ | 560 | displayed again as separate glyphs. */ |
| 559 | if (!(to == text_len - 1 && LGLYPH_TO (lglyph) > to)) | 561 | if (!(!new_lglyph |
| 562 | && to == text_len - 1 | ||
| 563 | && LGLYPH_TO (lglyph) > to)) | ||
| 560 | LGLYPH_SET_TO (lglyph, to); | 564 | LGLYPH_SET_TO (lglyph, to); |
| 561 | 565 | ||
| 562 | /* Not every glyph in a cluster maps directly to a single | 566 | /* Not every glyph in a cluster maps directly to a single |