From: Eli Zaretskii Date: Thu, 30 Nov 2017 17:55:41 +0000 (+0200) Subject: Avoid assertions in find-composition X-Git-Tag: emacs-26.0.91~221 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bdbcdba;p=emacs.git Avoid assertions in find-composition * src/font.c (font_range): If called with STRING non-nil and FACE a NULL pointer, compute face by calling face_at_string_position. (Bug#29506) * lisp/composite.el (find-composition): Doc fix. --- diff --git a/lisp/composite.el b/lisp/composite.el index 72b0ffc8f48..f7e0c4a0912 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -337,8 +337,9 @@ When Automatic Composition mode is on, this function also finds a chunk of text that is automatically composed. If such a chunk is found closer to POS than the position that has `composition' property, the value is a list of FROM, TO, and a glyph-string -that specifies how the chunk is to be composed. See the function -`composition-get-gstring' for the format of the glyph-string." +that specifies how the chunk is to be composed; DETAIL-P is +inored this case. See the function `composition-get-gstring' +for the format of the glyph-string." (let ((result (find-composition-internal pos limit string detail-p))) (if (and detail-p (> (length result) 3) (nth 2 result) (not (nth 3 result))) ;; This is a valid rule-base composition. diff --git a/src/font.c b/src/font.c index f7cebdce78c..441652b0951 100644 --- a/src/font.c +++ b/src/font.c @@ -3794,19 +3794,26 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit, int c; Lisp_Object font_object = Qnil; - if (NILP (string)) + if (!face) { - if (! face) + struct frame *f = XFRAME (w->frame); + int face_id; + + if (NILP (string)) + face_id = face_at_buffer_position (w, pos, &ignore, *limit, + false, -1); + else { - int face_id; + face_id = + NILP (Vface_remapping_alist) + ? DEFAULT_FACE_ID + : lookup_basic_face (f, DEFAULT_FACE_ID); - face_id = face_at_buffer_position (w, pos, &ignore, - *limit, false, -1); - face = FACE_FROM_ID (XFRAME (w->frame), face_id); + face_id = face_at_string_position (w, string, pos, 0, &ignore, + face_id, false); } + face = FACE_FROM_ID (f, face_id); } - else - eassert (face); while (pos < *limit) {