]> git.eshelyaron.com Git - emacs.git/commitdiff
* dispextern.h (FACE_SUITABLE_FOR_CHAR_P): Remove unused macro.
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 12 Dec 2013 08:39:41 +0000 (12:39 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 12 Dec 2013 08:39:41 +0000 (12:39 +0400)
(FACE_FOR_CHAR): Simplify because face_for_char does the same.
* fontset.c (face_suitable_for_char_p) [0]: Remove unused function.
(font_for_char): Prefer ptrdiff_t to int for buffer position.
(face_for_char): Likewise.  Rearrange eassert and return ASCII
face for CHAR_BYTE8_P.
* fontset.h (font_for_char, face_for_char): Adjust prototypes.

src/ChangeLog
src/dispextern.h
src/fontset.c
src/fontset.h

index 60258810fe2e5fd753f36d57e581e73625df1ece..336755993903e084facfcf28ac57d28209828395 100644 (file)
@@ -5,6 +5,13 @@
        http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
        * keyboard.c (poll_for_input_1, input_polling_used): Define
        unconditionally.
+       * dispextern.h (FACE_SUITABLE_FOR_CHAR_P): Remove unused macro.
+       (FACE_FOR_CHAR): Simplify because face_for_char does the same.
+       * fontset.c (face_suitable_for_char_p) [0]: Remove unused function.
+       (font_for_char): Prefer ptrdiff_t to int for buffer position.
+       (face_for_char): Likewise.  Rearrange eassert and return ASCII
+       face for CHAR_BYTE8_P.
+       * fontset.h (font_for_char, face_for_char): Adjust prototypes.
 
 2013-12-11  Ken Brown  <kbrown@cornell.edu>
 
index 5976d068a780efbbc36107beb5987a8e291ed323..97847e04686548d080b93db9c3f057b660605f30 100644 (file)
@@ -1819,24 +1819,16 @@ struct face_cache
 #define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR)     \
   ((FACE) == (FACE)->ascii_face)
 
-#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR)   \
-  (ASCII_CHAR_P (CHAR)                         \
-   ? FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE)      \
-   : face_suitable_for_char_p ((FACE), (CHAR)))
-
 /* Return the id of the realized face on frame F that is like the face
    with id ID but is suitable for displaying character CHAR.
    This macro is only meaningful for multibyte character CHAR.  */
 
 #define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT)      \
-  ((ASCII_CHAR_P (CHAR) || CHAR_BYTE8_P (CHAR))                \
-   ? (FACE)->ascii_face->id                            \
-   : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)))
+  face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT))
 
 #else /* not HAVE_WINDOW_SYSTEM */
 
 #define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) 1
-#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) 1
 #define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id)
 
 #endif /* not HAVE_WINDOW_SYSTEM */
index a3634f0b08dca1769614b2dcd12cf5fd4ef87fe3..b9f6de33ebb0d9afde6a24a9f5b659276969e9ab 100644 (file)
@@ -899,42 +899,21 @@ free_face_fontset (struct frame *f, struct face *face)
   face->fontset = -1;
 }
 
-
-#if 0
-/* Return true if FACE is suitable for displaying character C.
-   Called from the macro FACE_SUITABLE_FOR_CHAR_P
-   when C is not an ASCII character.  */
-
-bool
-face_suitable_for_char_p (struct face *face, int c)
-{
-  Lisp_Object fontset, rfont_def;
-
-  fontset = FONTSET_FROM_ID (face->fontset);
-  rfont_def = fontset_font (fontset, c, NULL, -1);
-  return (VECTORP (rfont_def)
-         && INTEGERP (RFONT_DEF_FACE (rfont_def))
-         && face->id == XINT (RFONT_DEF_FACE (rfont_def)));
-}
-#endif
-
-
-/* Return ID of face suitable for displaying character C on frame F.
-   FACE must be realized for ASCII characters in advance.  Called from
-   the macro FACE_FOR_CHAR.  */
+/* Return ID of face suitable for displaying character C at buffer position
+   POS on frame F.  FACE must be realized for ASCII characters in advance.
+   Called from the macro FACE_FOR_CHAR.  */
 
 int
-face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object object)
+face_for_char (struct frame *f, struct face *face, int c,
+              ptrdiff_t pos, Lisp_Object object)
 {
   Lisp_Object fontset, rfont_def, charset;
   int face_id;
   int id;
 
-  /* If face->fontset is negative (that happens when no font is found
-     for face), just return face->ascii_face because we can't do
-     anything.  Perhaps, we should fix the callers to assure
-     that face->fontset is always valid.  */
-  if (ASCII_CHAR_P (c) || face->fontset < 0)
+  eassert (fontset_id_valid_p (face->fontset));
+
+  if (ASCII_CHAR_P (c) || CHAR_BYTE8_P (c))
     return face->ascii_face->id;
 
 #ifdef HAVE_NS
@@ -950,7 +929,6 @@ face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object o
     }
 #endif
 
-  eassert (fontset_id_valid_p (face->fontset));
   fontset = FONTSET_FROM_ID (face->fontset);
   eassert (!BASE_FONTSET_P (fontset));
 
@@ -1005,7 +983,7 @@ face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object o
 
 
 Lisp_Object
-font_for_char (struct face *face, int c, int pos, Lisp_Object object)
+font_for_char (struct face *face, int c, ptrdiff_t pos, Lisp_Object object)
 {
   Lisp_Object fontset, rfont_def, charset;
   int id;
index b8ef4789e71e0884e300b8fe54303ef49281cb5a..3531915f7d90bac56041729a37ff329bf95385a7 100644 (file)
@@ -28,8 +28,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 extern void free_face_fontset (struct frame *, struct face *);
 extern int face_for_char (struct frame *, struct face *, int,
-                          int, Lisp_Object);
-extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object);
+                          ptrdiff_t, Lisp_Object);
+extern Lisp_Object font_for_char (struct face *, int, ptrdiff_t, Lisp_Object);
 
 extern int make_fontset_for_ascii_face (struct frame *, int, struct face *);
 extern int fontset_from_font (Lisp_Object);