aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-12-12 12:39:41 +0400
committerDmitry Antipov2013-12-12 12:39:41 +0400
commit397a32c12ad097314c0948818d5c54b43d9f3d54 (patch)
tree30a5a27213eede4f3c633deb00d9c1423bb9d976 /src
parent09faee72dd0743a5b46444b5e917ee1259843788 (diff)
downloademacs-397a32c12ad097314c0948818d5c54b43d9f3d54.tar.gz
emacs-397a32c12ad097314c0948818d5c54b43d9f3d54.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/dispextern.h10
-rw-r--r--src/fontset.c40
-rw-r--r--src/fontset.h4
4 files changed, 19 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 60258810fe2..33675599390 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -5,6 +5,13 @@
5 http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. 5 http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
6 * keyboard.c (poll_for_input_1, input_polling_used): Define 6 * keyboard.c (poll_for_input_1, input_polling_used): Define
7 unconditionally. 7 unconditionally.
8 * dispextern.h (FACE_SUITABLE_FOR_CHAR_P): Remove unused macro.
9 (FACE_FOR_CHAR): Simplify because face_for_char does the same.
10 * fontset.c (face_suitable_for_char_p) [0]: Remove unused function.
11 (font_for_char): Prefer ptrdiff_t to int for buffer position.
12 (face_for_char): Likewise. Rearrange eassert and return ASCII
13 face for CHAR_BYTE8_P.
14 * fontset.h (font_for_char, face_for_char): Adjust prototypes.
8 15
92013-12-11 Ken Brown <kbrown@cornell.edu> 162013-12-11 Ken Brown <kbrown@cornell.edu>
10 17
diff --git a/src/dispextern.h b/src/dispextern.h
index 5976d068a78..97847e04686 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1819,24 +1819,16 @@ struct face_cache
1819#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \ 1819#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) \
1820 ((FACE) == (FACE)->ascii_face) 1820 ((FACE) == (FACE)->ascii_face)
1821 1821
1822#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) \
1823 (ASCII_CHAR_P (CHAR) \
1824 ? FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE) \
1825 : face_suitable_for_char_p ((FACE), (CHAR)))
1826
1827/* Return the id of the realized face on frame F that is like the face 1822/* Return the id of the realized face on frame F that is like the face
1828 with id ID but is suitable for displaying character CHAR. 1823 with id ID but is suitable for displaying character CHAR.
1829 This macro is only meaningful for multibyte character CHAR. */ 1824 This macro is only meaningful for multibyte character CHAR. */
1830 1825
1831#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \ 1826#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \
1832 ((ASCII_CHAR_P (CHAR) || CHAR_BYTE8_P (CHAR)) \ 1827 face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT))
1833 ? (FACE)->ascii_face->id \
1834 : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)))
1835 1828
1836#else /* not HAVE_WINDOW_SYSTEM */ 1829#else /* not HAVE_WINDOW_SYSTEM */
1837 1830
1838#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) 1 1831#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) 1
1839#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) 1
1840#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id) 1832#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id)
1841 1833
1842#endif /* not HAVE_WINDOW_SYSTEM */ 1834#endif /* not HAVE_WINDOW_SYSTEM */
diff --git a/src/fontset.c b/src/fontset.c
index a3634f0b08d..b9f6de33ebb 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -899,42 +899,21 @@ free_face_fontset (struct frame *f, struct face *face)
899 face->fontset = -1; 899 face->fontset = -1;
900} 900}
901 901
902 902/* Return ID of face suitable for displaying character C at buffer position
903#if 0 903 POS on frame F. FACE must be realized for ASCII characters in advance.
904/* Return true if FACE is suitable for displaying character C. 904 Called from the macro FACE_FOR_CHAR. */
905 Called from the macro FACE_SUITABLE_FOR_CHAR_P
906 when C is not an ASCII character. */
907
908bool
909face_suitable_for_char_p (struct face *face, int c)
910{
911 Lisp_Object fontset, rfont_def;
912
913 fontset = FONTSET_FROM_ID (face->fontset);
914 rfont_def = fontset_font (fontset, c, NULL, -1);
915 return (VECTORP (rfont_def)
916 && INTEGERP (RFONT_DEF_FACE (rfont_def))
917 && face->id == XINT (RFONT_DEF_FACE (rfont_def)));
918}
919#endif
920
921
922/* Return ID of face suitable for displaying character C on frame F.
923 FACE must be realized for ASCII characters in advance. Called from
924 the macro FACE_FOR_CHAR. */
925 905
926int 906int
927face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object object) 907face_for_char (struct frame *f, struct face *face, int c,
908 ptrdiff_t pos, Lisp_Object object)
928{ 909{
929 Lisp_Object fontset, rfont_def, charset; 910 Lisp_Object fontset, rfont_def, charset;
930 int face_id; 911 int face_id;
931 int id; 912 int id;
932 913
933 /* If face->fontset is negative (that happens when no font is found 914 eassert (fontset_id_valid_p (face->fontset));
934 for face), just return face->ascii_face because we can't do 915
935 anything. Perhaps, we should fix the callers to assure 916 if (ASCII_CHAR_P (c) || CHAR_BYTE8_P (c))
936 that face->fontset is always valid. */
937 if (ASCII_CHAR_P (c) || face->fontset < 0)
938 return face->ascii_face->id; 917 return face->ascii_face->id;
939 918
940#ifdef HAVE_NS 919#ifdef HAVE_NS
@@ -950,7 +929,6 @@ face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object o
950 } 929 }
951#endif 930#endif
952 931
953 eassert (fontset_id_valid_p (face->fontset));
954 fontset = FONTSET_FROM_ID (face->fontset); 932 fontset = FONTSET_FROM_ID (face->fontset);
955 eassert (!BASE_FONTSET_P (fontset)); 933 eassert (!BASE_FONTSET_P (fontset));
956 934
@@ -1005,7 +983,7 @@ face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object o
1005 983
1006 984
1007Lisp_Object 985Lisp_Object
1008font_for_char (struct face *face, int c, int pos, Lisp_Object object) 986font_for_char (struct face *face, int c, ptrdiff_t pos, Lisp_Object object)
1009{ 987{
1010 Lisp_Object fontset, rfont_def, charset; 988 Lisp_Object fontset, rfont_def, charset;
1011 int id; 989 int id;
diff --git a/src/fontset.h b/src/fontset.h
index b8ef4789e71..3531915f7d9 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -28,8 +28,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29extern void free_face_fontset (struct frame *, struct face *); 29extern void free_face_fontset (struct frame *, struct face *);
30extern int face_for_char (struct frame *, struct face *, int, 30extern int face_for_char (struct frame *, struct face *, int,
31 int, Lisp_Object); 31 ptrdiff_t, Lisp_Object);
32extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object); 32extern Lisp_Object font_for_char (struct face *, int, ptrdiff_t, Lisp_Object);
33 33
34extern int make_fontset_for_ascii_face (struct frame *, int, struct face *); 34extern int make_fontset_for_ascii_face (struct frame *, int, struct face *);
35extern int fontset_from_font (Lisp_Object); 35extern int fontset_from_font (Lisp_Object);