240 |
/* Glyphs. |
/* Glyphs. |
241 |
|
|
242 |
Be extra careful when changing this structure! Esp. make sure that |
Be extra careful when changing this structure! Esp. make sure that |
243 |
functions producing glyphs, like x_append_glyph, fill ALL of the |
functions producing glyphs, like append_glyph, fill ALL of the |
244 |
glyph structure, and that GLYPH_EQUAL_P compares all |
glyph structure, and that GLYPH_EQUAL_P compares all |
245 |
display-relevant members of glyphs (not to imply that these are the |
display-relevant members of glyphs (not to imply that these are the |
246 |
only things to check when you add a member). */ |
only things to check when you add a member). */ |
302 |
unsigned glyph_not_available_p : 1; |
unsigned glyph_not_available_p : 1; |
303 |
|
|
304 |
/* Face of the glyph. */ |
/* Face of the glyph. */ |
305 |
unsigned face_id : 22; |
unsigned face_id : 21; |
306 |
|
|
307 |
#ifdef WINDOWSNT |
/* Type of font used to display the character glyph. May be used to |
|
/* Type of font used to display the character glyph. Used to |
|
308 |
determine which set of functions to use to obtain font metrics |
determine which set of functions to use to obtain font metrics |
309 |
for the glyph. Value should be an enumerator of the type |
for the glyph. On W32, value should be an enumerator of the type |
310 |
w32_char_font_type. */ |
w32_char_font_type. Otherwise it equals FONT_TYPE_UNKNOWN. */ |
311 |
unsigned w32_font_type : 2; |
unsigned font_type : 3; |
|
#endif |
|
312 |
|
|
313 |
/* A union of sub-structures for different glyph types. */ |
/* A union of sub-structures for different glyph types. */ |
314 |
union |
union |
339 |
}; |
}; |
340 |
|
|
341 |
|
|
342 |
|
/* Default value of the glyph font_type field. */ |
343 |
|
|
344 |
|
#define FONT_TYPE_UNKNOWN 0 |
345 |
|
|
346 |
/* Is GLYPH a space? */ |
/* Is GLYPH a space? */ |
347 |
|
|
348 |
#define CHAR_GLYPH_SPACE_P(GLYPH) \ |
#define CHAR_GLYPH_SPACE_P(GLYPH) \ |
917 |
|
|
918 |
|
|
919 |
/************************************************************************ |
/************************************************************************ |
920 |
|
Glyph Strings |
921 |
|
************************************************************************/ |
922 |
|
|
923 |
|
/* Enumeration for overriding/changing the face to use for drawing |
924 |
|
glyphs in x_draw_glyphs. */ |
925 |
|
|
926 |
|
enum draw_glyphs_face |
927 |
|
{ |
928 |
|
DRAW_NORMAL_TEXT, |
929 |
|
DRAW_INVERSE_VIDEO, |
930 |
|
DRAW_CURSOR, |
931 |
|
DRAW_MOUSE_FACE, |
932 |
|
DRAW_IMAGE_RAISED, |
933 |
|
DRAW_IMAGE_SUNKEN |
934 |
|
}; |
935 |
|
|
936 |
|
/* A sequence of glyphs to be drawn in the same face. */ |
937 |
|
|
938 |
|
struct glyph_string |
939 |
|
{ |
940 |
|
/* X-origin of the string. */ |
941 |
|
int x; |
942 |
|
|
943 |
|
/* Y-origin and y-position of the base line of this string. */ |
944 |
|
int y, ybase; |
945 |
|
|
946 |
|
/* The width of the string, not including a face extension. */ |
947 |
|
int width; |
948 |
|
|
949 |
|
/* The width of the string, including a face extension. */ |
950 |
|
int background_width; |
951 |
|
|
952 |
|
/* The height of this string. This is the height of the line this |
953 |
|
string is drawn in, and can be different from the height of the |
954 |
|
font the string is drawn in. */ |
955 |
|
int height; |
956 |
|
|
957 |
|
/* Number of pixels this string overwrites in front of its x-origin. |
958 |
|
This number is zero if the string has an lbearing >= 0; it is |
959 |
|
-lbearing, if the string has an lbearing < 0. */ |
960 |
|
int left_overhang; |
961 |
|
|
962 |
|
/* Number of pixels this string overwrites past its right-most |
963 |
|
nominal x-position, i.e. x + width. Zero if the string's |
964 |
|
rbearing is <= its nominal width, rbearing - width otherwise. */ |
965 |
|
int right_overhang; |
966 |
|
|
967 |
|
/* The frame on which the glyph string is drawn. */ |
968 |
|
struct frame *f; |
969 |
|
|
970 |
|
/* The window on which the glyph string is drawn. */ |
971 |
|
struct window *w; |
972 |
|
|
973 |
|
/* X display and window for convenience. */ |
974 |
|
Display *display; |
975 |
|
Window window; |
976 |
|
|
977 |
|
/* The glyph row for which this string was built. It determines the |
978 |
|
y-origin and height of the string. */ |
979 |
|
struct glyph_row *row; |
980 |
|
|
981 |
|
/* The area within row. */ |
982 |
|
enum glyph_row_area area; |
983 |
|
|
984 |
|
/* Characters to be drawn, and number of characters. */ |
985 |
|
XChar2b *char2b; |
986 |
|
int nchars; |
987 |
|
|
988 |
|
/* A face-override for drawing cursors, mouse face and similar. */ |
989 |
|
enum draw_glyphs_face hl; |
990 |
|
|
991 |
|
/* Face in which this string is to be drawn. */ |
992 |
|
struct face *face; |
993 |
|
|
994 |
|
/* Font in which this string is to be drawn. */ |
995 |
|
XFontStruct *font; |
996 |
|
|
997 |
|
/* Font info for this string. */ |
998 |
|
struct font_info *font_info; |
999 |
|
|
1000 |
|
/* Non-null means this string describes (part of) a composition. |
1001 |
|
All characters from char2b are drawn composed. */ |
1002 |
|
struct composition *cmp; |
1003 |
|
|
1004 |
|
/* Index of this glyph string's first character in the glyph |
1005 |
|
definition of CMP. If this is zero, this glyph string describes |
1006 |
|
the first character of a composition. */ |
1007 |
|
int gidx; |
1008 |
|
|
1009 |
|
/* 1 means this glyph strings face has to be drawn to the right end |
1010 |
|
of the window's drawing area. */ |
1011 |
|
unsigned extends_to_end_of_line_p : 1; |
1012 |
|
|
1013 |
|
/* 1 means the background of this string has been drawn. */ |
1014 |
|
unsigned background_filled_p : 1; |
1015 |
|
|
1016 |
|
/* 1 means glyph string must be drawn with 16-bit functions. */ |
1017 |
|
unsigned two_byte_p : 1; |
1018 |
|
|
1019 |
|
/* 1 means that the original font determined for drawing this glyph |
1020 |
|
string could not be loaded. The member `font' has been set to |
1021 |
|
the frame's default font in this case. */ |
1022 |
|
unsigned font_not_found_p : 1; |
1023 |
|
|
1024 |
|
/* 1 means that the face in which this glyph string is drawn has a |
1025 |
|
stipple pattern. */ |
1026 |
|
unsigned stippled_p : 1; |
1027 |
|
|
1028 |
|
/* 1 means only the foreground of this glyph string must be drawn, |
1029 |
|
and we should use the physical height of the line this glyph |
1030 |
|
string appears in as clip rect. */ |
1031 |
|
unsigned for_overlaps_p : 1; |
1032 |
|
|
1033 |
|
/* The GC to use for drawing this glyph string. */ |
1034 |
|
#if defined(HAVE_X_WINDOWS) || defined(HAVE_CARBON) |
1035 |
|
GC gc; |
1036 |
|
#endif |
1037 |
|
#if defined(HAVE_NTGUI) |
1038 |
|
XGCValues *gc; |
1039 |
|
HDC hdc; |
1040 |
|
#endif |
1041 |
|
|
1042 |
|
/* A pointer to the first glyph in the string. This glyph |
1043 |
|
corresponds to char2b[0]. Needed to draw rectangles if |
1044 |
|
font_not_found_p is 1. */ |
1045 |
|
struct glyph *first_glyph; |
1046 |
|
|
1047 |
|
/* Image, if any. */ |
1048 |
|
struct image *img; |
1049 |
|
|
1050 |
|
struct glyph_string *next, *prev; |
1051 |
|
}; |
1052 |
|
|
1053 |
|
|
1054 |
|
|
1055 |
|
/************************************************************************ |
1056 |
Display Dimensions |
Display Dimensions |
1057 |
************************************************************************/ |
************************************************************************/ |
1058 |
|
|
1937 |
|
|
1938 |
/* The character to display, possibly translated to multibyte |
/* The character to display, possibly translated to multibyte |
1939 |
if unibyte_display_via_language_environment is set. This |
if unibyte_display_via_language_environment is set. This |
1940 |
is set after x_produce_glyphs has been called. */ |
is set after produce_glyphs has been called. */ |
1941 |
int char_to_display; |
int char_to_display; |
1942 |
|
|
1943 |
/* If what == IT_IMAGE, the id of the image to display. */ |
/* If what == IT_IMAGE, the id of the image to display. */ |
2164 |
void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, |
void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, |
2165 |
struct draw_fringe_bitmap_params *p)); |
struct draw_fringe_bitmap_params *p)); |
2166 |
|
|
2167 |
|
/* Get metrics of character CHAR2B in FONT of type FONT_TYPE. |
2168 |
|
Value is null if CHAR2B is not contained in the font. */ |
2169 |
|
XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b, |
2170 |
|
int font_type)); |
2171 |
|
|
2172 |
|
/* Encode CHAR2B using encoding information from FONT_INFO. CHAR2B is |
2173 |
|
the two-byte form of C. Encoding is returned in *CHAR2B. If |
2174 |
|
TWO_BYTE_P is non-null, return non-zero there if font is two-byte. */ |
2175 |
|
int (*encode_char) P_ ((int c, XChar2b *char2b, |
2176 |
|
struct font_info *font_into, int *two_byte_p)); |
2177 |
|
|
2178 |
|
/* Compute left and right overhang of glyph string S. |
2179 |
|
A NULL pointer if platform does not support this. */ |
2180 |
|
void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s)); |
2181 |
|
|
2182 |
|
/* Draw a glyph string S. */ |
2183 |
|
void (*draw_glyph_string) P_ ((struct glyph_string *s)); |
2184 |
|
|
2185 |
}; |
}; |
2186 |
|
|
2187 |
/* The current interface for window-based redisplay. */ |
/* The current interface for window-based redisplay. */ |
2193 |
extern int (* estimate_mode_line_height_hook) P_ ((struct frame *, |
extern int (* estimate_mode_line_height_hook) P_ ((struct frame *, |
2194 |
enum face_id)); |
enum face_id)); |
2195 |
|
|
2196 |
|
|
2197 |
|
/* Return proper value to be used as baseline offset of font that has |
2198 |
|
ASCENT and DESCENT to draw characters by the font at the vertical |
2199 |
|
center of the line of frame F. |
2200 |
|
|
2201 |
|
Here, out task is to find the value of BOFF in the following figure; |
2202 |
|
|
2203 |
|
-------------------------+-----------+- |
2204 |
|
-+-+---------+-+ | | |
2205 |
|
| | | | | | |
2206 |
|
| | | | F_ASCENT F_HEIGHT |
2207 |
|
| | | ASCENT | | |
2208 |
|
HEIGHT | | | | | |
2209 |
|
| | |-|-+------+-----------|------- baseline |
2210 |
|
| | | | BOFF | | |
2211 |
|
| |---------|-+-+ | | |
2212 |
|
| | | DESCENT | | |
2213 |
|
-+-+---------+-+ F_DESCENT | |
2214 |
|
-------------------------+-----------+- |
2215 |
|
|
2216 |
|
-BOFF + DESCENT + (F_HEIGHT - HEIGHT) / 2 = F_DESCENT |
2217 |
|
BOFF = DESCENT + (F_HEIGHT - HEIGHT) / 2 - F_DESCENT |
2218 |
|
DESCENT = FONT->descent |
2219 |
|
HEIGHT = FONT_HEIGHT (FONT) |
2220 |
|
F_DESCENT = (F->output_data.x->font->descent |
2221 |
|
- F->output_data.x->baseline_offset) |
2222 |
|
F_HEIGHT = FRAME_LINE_HEIGHT (F) |
2223 |
|
*/ |
2224 |
|
|
2225 |
|
#define VCENTER_BASELINE_OFFSET(FONT, F) \ |
2226 |
|
(FONT_DESCENT (FONT) \ |
2227 |
|
+ (FRAME_LINE_HEIGHT ((F)) - FONT_HEIGHT ((FONT)) \ |
2228 |
|
+ (FRAME_LINE_HEIGHT ((F)) > FONT_HEIGHT ((FONT)))) / 2 \ |
2229 |
|
- (FONT_DESCENT (FRAME_FONT (F)) - FRAME_BASELINE_OFFSET (F))) |
2230 |
|
|
2231 |
|
|
2232 |
/*********************************************************************** |
/*********************************************************************** |
2233 |
Images |
Images |
2534 |
extern int help_echo_showing_p; |
extern int help_echo_showing_p; |
2535 |
extern int current_mode_line_height, current_header_line_height; |
extern int current_mode_line_height, current_header_line_height; |
2536 |
|
|
2537 |
|
#if GLYPH_DEBUG |
2538 |
|
extern void dump_glyph_string P_ ((struct glyph_string *)); |
2539 |
|
#endif |
2540 |
|
|
2541 |
|
extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *, |
2542 |
|
int *, int *)); |
2543 |
|
extern void x_produce_glyphs P_ ((struct it *)); |
2544 |
|
extern int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
2545 |
|
enum glyph_row_area, int, int, |
2546 |
|
enum draw_glyphs_face, int)); |
2547 |
|
|
2548 |
|
extern void notice_overwritten_cursor P_ ((struct window *, |
2549 |
|
enum glyph_row_area, |
2550 |
|
int, int, int, int)); |
2551 |
|
|
2552 |
/* Defined in sysdep.c */ |
/* Defined in sysdep.c */ |
2553 |
|
|
2554 |
void get_frame_size P_ ((int *, int *)); |
void get_frame_size P_ ((int *, int *)); |