diff options
| author | Kenichi Handa | 1999-12-27 05:05:19 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-12-27 05:05:19 +0000 |
| commit | 3305fc6a35c6dd66466813afb24d576e9d97b801 (patch) | |
| tree | 0fd7ae8c384ad5fe82ca9cad9163a54d60812496 /src | |
| parent | ae87e39643b1364a706e75ce7f50b4969782f350 (diff) | |
| download | emacs-3305fc6a35c6dd66466813afb24d576e9d97b801.tar.gz emacs-3305fc6a35c6dd66466813afb24d576e9d97b801.zip | |
(struct glyph): Make face_id and padding_p the top
level members. Change members in union `u'.
(GLYPH_EQUAL_P): Check also members face_id and padding_p.
(GLYPH_CHAR_AND_FACE_EQUAL_P): New macro.
(SET_CHAR_GLYPH): Adjusted for the change of struct glyph.
(CHAR_GLYPH_PADDING_P): Likewise.
(GLYPH_FROM_CHAR_GLYPH): Likewise. Always return -1 for multibyte
characters.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index eadf745d400..5516d13688c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -260,61 +260,38 @@ struct glyph | |||
| 260 | glyphs above or below it. */ | 260 | glyphs above or below it. */ |
| 261 | unsigned overlaps_vertically_p : 1; | 261 | unsigned overlaps_vertically_p : 1; |
| 262 | 262 | ||
| 263 | /* 1 means glyph is a padding glyph. Padding glyphs are used for | ||
| 264 | characters whose visual shape consists of more than one glyph | ||
| 265 | (e.g. Asian characters). All but the first glyph of such a glyph | ||
| 266 | sequence have the padding_p flag set. Only used for terminal | ||
| 267 | frames, and there only to minimize code changes. A better way | ||
| 268 | would probably be to use the width field of glyphs to express | ||
| 269 | padding. */ | ||
| 270 | unsigned padding_p : 1; | ||
| 271 | |||
| 272 | /* Face of the glyph. */ | ||
| 273 | unsigned face_id : 23; | ||
| 274 | |||
| 263 | /* A union of sub-structures for different glyph types. */ | 275 | /* A union of sub-structures for different glyph types. */ |
| 264 | union | 276 | union |
| 265 | { | 277 | { |
| 266 | /* Sub-structure for character glyphs (type == CHAR_GLYPH). */ | 278 | /* Character code for character glyphs (type == CHAR_GLYPH). */ |
| 267 | struct | 279 | unsigned ch; |
| 268 | { | ||
| 269 | /* Character code. */ | ||
| 270 | unsigned code : 19; | ||
| 271 | |||
| 272 | /* Character's face. */ | ||
| 273 | unsigned face_id : 11; | ||
| 274 | |||
| 275 | /* 1 means glyph is a padding glyph. Padding glyphs are used | ||
| 276 | for characters whose visual shape consists of more than one | ||
| 277 | glyph (e.g. Asian characters). All but the first glyph of | ||
| 278 | such a glyph sequence have the padding_p flag set. Only used | ||
| 279 | for terminal frames, and there only to minimize code changes. | ||
| 280 | A better way would probably be to use the width field of | ||
| 281 | glyphs to express padding. */ | ||
| 282 | unsigned padding_p : 1; | ||
| 283 | } | ||
| 284 | ch; | ||
| 285 | 280 | ||
| 286 | /* Sub-struct for composition (type == COMPOSITION_GLYPH) */ | 281 | /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH) */ |
| 287 | struct | 282 | unsigned cmp_id; |
| 288 | { | ||
| 289 | /* Composition identification number. */ | ||
| 290 | unsigned id : 21; | ||
| 291 | 283 | ||
| 292 | /* This composition's face. */ | 284 | /* Image ID for image glyphs (type == IMAGE_GLYPH). */ |
| 293 | unsigned face_id : 11; | 285 | unsigned img_id; |
| 294 | } | ||
| 295 | cmp; | ||
| 296 | /* Sub-structure for image glyphs (type == IMAGE_GLYPH). */ | ||
| 297 | struct | ||
| 298 | { | ||
| 299 | /* Image id. */ | ||
| 300 | unsigned id : 20; | ||
| 301 | |||
| 302 | /* Face under the image. */ | ||
| 303 | unsigned face_id : 12; | ||
| 304 | } | ||
| 305 | img; | ||
| 306 | 286 | ||
| 307 | /* Sub-structure for type == STRETCH_GLYPH. */ | 287 | /* Sub-structure for type == STRETCH_GLYPH. */ |
| 308 | struct | 288 | struct |
| 309 | { | 289 | { |
| 310 | /* The height of the glyph. */ | 290 | /* The height of the glyph. */ |
| 311 | unsigned height : 11; | 291 | unsigned height : 16; |
| 312 | 292 | ||
| 313 | /* The ascent of the glyph. */ | 293 | /* The ascent of the glyph. */ |
| 314 | unsigned ascent : 10; | 294 | unsigned ascent : 16; |
| 315 | |||
| 316 | /* The face of the stretch glyph. */ | ||
| 317 | unsigned face_id : 11; | ||
| 318 | } | 295 | } |
| 319 | stretch; | 296 | stretch; |
| 320 | 297 | ||
| @@ -334,19 +311,28 @@ struct glyph | |||
| 334 | #define GLYPH_EQUAL_P(X, Y) \ | 311 | #define GLYPH_EQUAL_P(X, Y) \ |
| 335 | ((X)->type == (Y)->type \ | 312 | ((X)->type == (Y)->type \ |
| 336 | && (X)->u.val == (Y)->u.val \ | 313 | && (X)->u.val == (Y)->u.val \ |
| 314 | && (X)->face_id == (Y)->face_id \ | ||
| 315 | && (X)->padding_p == (Y)->padding_p \ | ||
| 337 | && (X)->left_box_line_p == (Y)->left_box_line_p \ | 316 | && (X)->left_box_line_p == (Y)->left_box_line_p \ |
| 338 | && (X)->right_box_line_p == (Y)->right_box_line_p \ | 317 | && (X)->right_box_line_p == (Y)->right_box_line_p \ |
| 339 | && (X)->voffset == (Y)->voffset) | 318 | && (X)->voffset == (Y)->voffset) |
| 340 | 319 | ||
| 320 | /* Are character codes, faces, padding_ps of glyphs *X and *Y equal? */ | ||
| 321 | |||
| 322 | #define GLYPH_CHAR_AND_FACE_EQUAL_P(X, Y) \ | ||
| 323 | ((X)->u.ch == (Y)->u.ch \ | ||
| 324 | && (X)->face_id == (Y)->face_id \ | ||
| 325 | && (X)->padding_p == (Y)->padding_p) | ||
| 326 | |||
| 341 | /* Fill a character glyph GLYPH. CODE, FACE_ID, PADDING_P correspond | 327 | /* Fill a character glyph GLYPH. CODE, FACE_ID, PADDING_P correspond |
| 342 | to the bits defined for the typedef `GLYPH' in lisp.h. */ | 328 | to the bits defined for the typedef `GLYPH' in lisp.h. */ |
| 343 | 329 | ||
| 344 | #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \ | 330 | #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P) \ |
| 345 | do \ | 331 | do \ |
| 346 | { \ | 332 | { \ |
| 347 | (GLYPH).u.ch.code = (CODE); \ | 333 | (GLYPH).u.ch = (CODE); \ |
| 348 | (GLYPH).u.ch.face_id = (FACE_ID); \ | 334 | (GLYPH).face_id = (FACE_ID); \ |
| 349 | (GLYPH).u.ch.padding_p = (PADDING_P); \ | 335 | (GLYPH).padding_p = (PADDING_P); \ |
| 350 | } \ | 336 | } \ |
| 351 | while (0) | 337 | while (0) |
| 352 | 338 | ||
| @@ -357,18 +343,20 @@ struct glyph | |||
| 357 | SET_CHAR_GLYPH ((GLYPH), \ | 343 | SET_CHAR_GLYPH ((GLYPH), \ |
| 358 | FAST_GLYPH_CHAR ((FROM)), \ | 344 | FAST_GLYPH_CHAR ((FROM)), \ |
| 359 | FAST_GLYPH_FACE ((FROM)), \ | 345 | FAST_GLYPH_FACE ((FROM)), \ |
| 360 | ((FROM) & GLYPH_MASK_PADDING) != 0) | 346 | 0) |
| 361 | 347 | ||
| 362 | /* Construct a typedef'd GLYPH value from a character glyph GLYPH. */ | 348 | /* Construct a glyph code from a character glyph GLYPH. If the |
| 349 | character is multibyte, return -1 as we can't use glyph table for a | ||
| 350 | multibyte character. */ | ||
| 363 | 351 | ||
| 364 | #define GLYPH_FROM_CHAR_GLYPH(GLYPH) \ | 352 | #define GLYPH_FROM_CHAR_GLYPH(GLYPH) \ |
| 365 | ((GLYPH).u.ch.code \ | 353 | ((GLYPH).u.ch < 256 \ |
| 366 | | ((GLYPH).u.ch.face_id << CHARACTERBITS) \ | 354 | ? ((GLYPH).u.ch | ((GLYPH).face_id << 8)) \ |
| 367 | | ((GLYPH).u.ch.padding_p ? GLYPH_MASK_PADDING : 0)) | 355 | : -1) |
| 368 | 356 | ||
| 369 | /* Is GLYPH a padding glyph? */ | 357 | /* Is GLYPH a padding glyph? */ |
| 370 | 358 | ||
| 371 | #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).u.ch.padding_p | 359 | #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p |
| 372 | 360 | ||
| 373 | 361 | ||
| 374 | 362 | ||