]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid assertions in find-composition
authorEli Zaretskii <eliz@gnu.org>
Thu, 30 Nov 2017 17:55:41 +0000 (19:55 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 30 Nov 2017 17:55:41 +0000 (19:55 +0200)
* 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.

lisp/composite.el
src/font.c

index 72b0ffc8f487506b5f72d32c80199733ed608a2a..f7e0c4a09123ed24b99470546a90daa26d175f45 100644 (file)
@@ -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.
index f7cebdce78c3bfbfe3c43dcadbb2033108f8be97..441652b09514b81c319b17b66fbbd50d73665116 100644 (file)
@@ -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)
     {