diff options
| author | Paul Eggert | 2012-09-06 01:04:49 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-09-06 01:04:49 -0700 |
| commit | a864ef14570715dc3233fbbf2e9da7aa8f29729e (patch) | |
| tree | d350c376998ae3bf0ef69f3d708f766e515a3465 /src | |
| parent | 0699fc18a5ea00b9a6d64b0e0ebf33b4723beb10 (diff) | |
| download | emacs-a864ef14570715dc3233fbbf2e9da7aa8f29729e.tar.gz emacs-a864ef14570715dc3233fbbf2e9da7aa8f29729e.zip | |
Use bool for booleans in font-related modules.
* font.c (font_intern_prop, font_style_to_value)
(font_style_symbolic, font_parse_xlfd, font_parse_fcname)
(generate_otf_features, font_check_otf_features, font_check_otf)
(font_match_p, font_list_entities, font_at):
* fontset.c (fontset_id_valid_p, reorder_font_vector
(fontset_find_font, Fset_fontset_font)
(face_suitable_for_char_p) [0]:
* ftfont.c (fc_initialized, ftfont_get_open_type_spec)
(ftfont_open, ftfont_text_extents, ftfont_check_otf):
(m17n_flt_initialized, ftfont_shape_by_flt):
* ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw):
* nsfont.m (nsfont_draw):
* w32font.c (w32font_draw):
* w32term.c (x_draw_glyphless_glyph_string_foreground):
Use bool for booleans.
* font.h: Adjust to above API changes.
(struct font, struct font_driver, struct font_driver_list):
Use bool for booleans.
(struct font): Remove useless member encoding_type.
All users removed.
* fontset.c, xftfont.c: Omit unnecessary static decls.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 25 | ||||
| -rw-r--r-- | src/font.c | 41 | ||||
| -rw-r--r-- | src/font.h | 45 | ||||
| -rw-r--r-- | src/fontset.c | 28 | ||||
| -rw-r--r-- | src/ftfont.c | 28 | ||||
| -rw-r--r-- | src/ftxfont.c | 22 | ||||
| -rw-r--r-- | src/nsfont.m | 11 | ||||
| -rw-r--r-- | src/w32font.c | 11 | ||||
| -rw-r--r-- | src/w32font.h | 2 | ||||
| -rw-r--r-- | src/xfont.c | 13 | ||||
| -rw-r--r-- | src/xftfont.c | 32 |
11 files changed, 124 insertions, 134 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 990cba396e3..2ca75d416af 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,28 @@ | |||
| 1 | 2012-09-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use bool for booleans in font-related modules. | ||
| 4 | * font.c (font_intern_prop, font_style_to_value) | ||
| 5 | (font_style_symbolic, font_parse_xlfd, font_parse_fcname) | ||
| 6 | (generate_otf_features, font_check_otf_features, font_check_otf) | ||
| 7 | (font_match_p, font_list_entities, font_at): | ||
| 8 | * fontset.c (fontset_id_valid_p, reorder_font_vector | ||
| 9 | (fontset_find_font, Fset_fontset_font) | ||
| 10 | (face_suitable_for_char_p) [0]: | ||
| 11 | * ftfont.c (fc_initialized, ftfont_get_open_type_spec) | ||
| 12 | (ftfont_open, ftfont_text_extents, ftfont_check_otf): | ||
| 13 | (m17n_flt_initialized, ftfont_shape_by_flt): | ||
| 14 | * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw): | ||
| 15 | * nsfont.m (nsfont_draw): | ||
| 16 | * w32font.c (w32font_draw): | ||
| 17 | * w32term.c (x_draw_glyphless_glyph_string_foreground): | ||
| 18 | Use bool for booleans. | ||
| 19 | * font.h: Adjust to above API changes. | ||
| 20 | (struct font, struct font_driver, struct font_driver_list): | ||
| 21 | Use bool for booleans. | ||
| 22 | (struct font): Remove useless member encoding_type. | ||
| 23 | All users removed. | ||
| 24 | * fontset.c, xftfont.c: Omit unnecessary static decls. | ||
| 25 | |||
| 1 | 2012-09-06 Dmitry Antipov <dmantipov@yandex.ru> | 26 | 2012-09-06 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 27 | ||
| 3 | * alloc.c (mark_object): Revert window marking code | 28 | * alloc.c (mark_object): Revert window marking code |
diff --git a/src/font.c b/src/font.c index cf9964f08f3..49a09bced28 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -216,13 +216,12 @@ static int num_font_drivers; | |||
| 216 | 216 | ||
| 217 | 217 | ||
| 218 | /* Return a Lispy value of a font property value at STR and LEN bytes. | 218 | /* Return a Lispy value of a font property value at STR and LEN bytes. |
| 219 | If STR is "*", return nil. | 219 | If STR is "*", return nil. If FORCE_SYMBOL, or if STR does not |
| 220 | If FORCE_SYMBOL is zero and all characters in STR are digits, | 220 | consist entirely of one or more digits, return a symbol interned |
| 221 | return an integer. Otherwise, return a symbol interned from | 221 | from STR. Otherwise, return an integer. */ |
| 222 | STR. */ | ||
| 223 | 222 | ||
| 224 | Lisp_Object | 223 | Lisp_Object |
| 225 | font_intern_prop (const char *str, ptrdiff_t len, int force_symbol) | 224 | font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) |
| 226 | { | 225 | { |
| 227 | ptrdiff_t i; | 226 | ptrdiff_t i; |
| 228 | Lisp_Object tem; | 227 | Lisp_Object tem; |
| @@ -306,7 +305,8 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec) | |||
| 306 | VAL is an integer. */ | 305 | VAL is an integer. */ |
| 307 | 306 | ||
| 308 | int | 307 | int |
| 309 | font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror) | 308 | font_style_to_value (enum font_property_index prop, Lisp_Object val, |
| 309 | bool noerror) | ||
| 310 | { | 310 | { |
| 311 | Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); | 311 | Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); |
| 312 | int len; | 312 | int len; |
| @@ -385,7 +385,8 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror | |||
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | Lisp_Object | 387 | Lisp_Object |
| 388 | font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face) | 388 | font_style_symbolic (Lisp_Object font, enum font_property_index prop, |
| 389 | bool for_face) | ||
| 389 | { | 390 | { |
| 390 | Lisp_Object val = AREF (font, prop); | 391 | Lisp_Object val = AREF (font, prop); |
| 391 | Lisp_Object table, elt; | 392 | Lisp_Object table, elt; |
| @@ -1101,7 +1102,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font) | |||
| 1101 | } | 1102 | } |
| 1102 | else | 1103 | else |
| 1103 | { | 1104 | { |
| 1104 | int wild_card_found = 0; | 1105 | bool wild_card_found = 0; |
| 1105 | Lisp_Object prop[XLFD_LAST_INDEX]; | 1106 | Lisp_Object prop[XLFD_LAST_INDEX]; |
| 1106 | 1107 | ||
| 1107 | if (FONT_ENTITY_P (font)) | 1108 | if (FONT_ENTITY_P (font)) |
| @@ -1337,7 +1338,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font) | |||
| 1337 | } | 1338 | } |
| 1338 | else if (*p == '-') | 1339 | else if (*p == '-') |
| 1339 | { | 1340 | { |
| 1340 | int decimal = 0, size_found = 1; | 1341 | bool decimal = 0, size_found = 1; |
| 1341 | for (q = p + 1; *q && *q != ':'; q++) | 1342 | for (q = p + 1; *q && *q != ':'; q++) |
| 1342 | if (! c_isdigit (*q)) | 1343 | if (! c_isdigit (*q)) |
| 1343 | { | 1344 | { |
| @@ -1938,7 +1939,7 @@ generate_otf_features (Lisp_Object spec, char *features) | |||
| 1938 | { | 1939 | { |
| 1939 | Lisp_Object val; | 1940 | Lisp_Object val; |
| 1940 | char *p; | 1941 | char *p; |
| 1941 | int asterisk; | 1942 | bool asterisk; |
| 1942 | 1943 | ||
| 1943 | p = features; | 1944 | p = features; |
| 1944 | *p = '\0'; | 1945 | *p = '\0'; |
| @@ -2302,11 +2303,12 @@ font_update_sort_order (int *order) | |||
| 2302 | } | 2303 | } |
| 2303 | } | 2304 | } |
| 2304 | 2305 | ||
| 2305 | static int | 2306 | static bool |
| 2306 | font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table) | 2307 | font_check_otf_features (Lisp_Object script, Lisp_Object langsys, |
| 2308 | Lisp_Object features, Lisp_Object table) | ||
| 2307 | { | 2309 | { |
| 2308 | Lisp_Object val; | 2310 | Lisp_Object val; |
| 2309 | int negative; | 2311 | bool negative; |
| 2310 | 2312 | ||
| 2311 | table = assq_no_quit (script, table); | 2313 | table = assq_no_quit (script, table); |
| 2312 | if (NILP (table)) | 2314 | if (NILP (table)) |
| @@ -2342,7 +2344,7 @@ font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object fe | |||
| 2342 | 2344 | ||
| 2343 | /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ | 2345 | /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ |
| 2344 | 2346 | ||
| 2345 | static int | 2347 | static bool |
| 2346 | font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) | 2348 | font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) |
| 2347 | { | 2349 | { |
| 2348 | Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; | 2350 | Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; |
| @@ -2376,7 +2378,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) | |||
| 2376 | /* Check if FONT (font-entity or font-object) matches with the font | 2378 | /* Check if FONT (font-entity or font-object) matches with the font |
| 2377 | specification SPEC. */ | 2379 | specification SPEC. */ |
| 2378 | 2380 | ||
| 2379 | int | 2381 | bool |
| 2380 | font_match_p (Lisp_Object spec, Lisp_Object font) | 2382 | font_match_p (Lisp_Object spec, Lisp_Object font) |
| 2381 | { | 2383 | { |
| 2382 | Lisp_Object prop[FONT_SPEC_MAX], *props; | 2384 | Lisp_Object prop[FONT_SPEC_MAX], *props; |
| @@ -2694,7 +2696,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec) | |||
| 2694 | Lisp_Object ftype, val; | 2696 | Lisp_Object ftype, val; |
| 2695 | Lisp_Object list = Qnil; | 2697 | Lisp_Object list = Qnil; |
| 2696 | int size; | 2698 | int size; |
| 2697 | int need_filtering = 0; | 2699 | bool need_filtering = 0; |
| 2698 | int i; | 2700 | int i; |
| 2699 | 2701 | ||
| 2700 | eassert (FONT_SPEC_P (spec)); | 2702 | eassert (FONT_SPEC_P (spec)); |
| @@ -3036,15 +3038,14 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, | |||
| 3036 | { | 3038 | { |
| 3037 | Lisp_Object font_entity; | 3039 | Lisp_Object font_entity; |
| 3038 | Lisp_Object prefer; | 3040 | Lisp_Object prefer; |
| 3039 | int result, i; | 3041 | int i; |
| 3040 | FRAME_PTR f = XFRAME (frame); | 3042 | FRAME_PTR f = XFRAME (frame); |
| 3041 | 3043 | ||
| 3042 | if (NILP (XCDR (entities)) | 3044 | if (NILP (XCDR (entities)) |
| 3043 | && ASIZE (XCAR (entities)) == 1) | 3045 | && ASIZE (XCAR (entities)) == 1) |
| 3044 | { | 3046 | { |
| 3045 | font_entity = AREF (XCAR (entities), 0); | 3047 | font_entity = AREF (XCAR (entities), 0); |
| 3046 | if (c < 0 | 3048 | if (c < 0 || font_has_char (f, font_entity, c) > 0) |
| 3047 | || (result = font_has_char (f, font_entity, c)) > 0) | ||
| 3048 | return font_entity; | 3049 | return font_entity; |
| 3049 | return Qnil; | 3050 | return Qnil; |
| 3050 | } | 3051 | } |
| @@ -3618,7 +3619,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, | |||
| 3618 | Lisp_Object string) | 3619 | Lisp_Object string) |
| 3619 | { | 3620 | { |
| 3620 | FRAME_PTR f; | 3621 | FRAME_PTR f; |
| 3621 | int multibyte; | 3622 | bool multibyte; |
| 3622 | Lisp_Object font_object; | 3623 | Lisp_Object font_object; |
| 3623 | 3624 | ||
| 3624 | multibyte = (NILP (string) | 3625 | multibyte = (NILP (string) |
diff --git a/src/font.h b/src/font.h index 3b90bc2ab8a..0475eb665dd 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -320,19 +320,10 @@ struct font | |||
| 320 | negative if that information is not in the font. */ | 320 | negative if that information is not in the font. */ |
| 321 | int underline_position; | 321 | int underline_position; |
| 322 | 322 | ||
| 323 | /* 1 if `vertical-centering-font-regexp' matches this font name. | 323 | /* True if `vertical-centering-font-regexp' matches this font name. |
| 324 | In this case, we render characters at vertical center positions | 324 | In this case, we render characters at vertical center positions |
| 325 | of lines. */ | 325 | of lines. */ |
| 326 | int vertical_centering; | 326 | bool vertical_centering; |
| 327 | |||
| 328 | /* Encoding type of the font. The value is one of | ||
| 329 | 0, 1, 2, or 3: | ||
| 330 | 0: code points 0x20..0x7F or 0x2020..0x7F7F are used | ||
| 331 | 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used | ||
| 332 | 2: code points 0x20A0..0x7FFF are used | ||
| 333 | 3: code points 0xA020..0xFF7F are used | ||
| 334 | If the member `font_encoder' is not NULL, this member is ignored. */ | ||
| 335 | unsigned char encoding_type; | ||
| 336 | 327 | ||
| 337 | /* The baseline position of a font is normally `ascent' value of the | 328 | /* The baseline position of a font is normally `ascent' value of the |
| 338 | font. However, there exist many fonts which don't set `ascent' to | 329 | font. However, there exist many fonts which don't set `ascent' to |
| @@ -506,9 +497,9 @@ struct font_driver | |||
| 506 | /* Symbol indicating the type of the font-driver. */ | 497 | /* Symbol indicating the type of the font-driver. */ |
| 507 | Lisp_Object type; | 498 | Lisp_Object type; |
| 508 | 499 | ||
| 509 | /* 1 iff the font's foundry, family, and adstyle names are case | 500 | /* True iff the font's foundry, family, and adstyle names are case |
| 510 | sensitive. */ | 501 | sensitive. */ |
| 511 | int case_sensitive; | 502 | bool case_sensitive; |
| 512 | 503 | ||
| 513 | /* Return a cache of font-entities on frame F. The cache must be a | 504 | /* Return a cache of font-entities on frame F. The cache must be a |
| 514 | cons whose cdr part is the actual cache area. */ | 505 | cons whose cdr part is the actual cache area. */ |
| @@ -592,11 +583,11 @@ struct font_driver | |||
| 592 | 583 | ||
| 593 | /* Optional. | 584 | /* Optional. |
| 594 | Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | 585 | Draw glyphs between FROM and TO of S->char2b at (X Y) pixel |
| 595 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | 586 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, |
| 596 | is nonzero, fill the background in advance. It is assured that | 587 | fill the background in advance. It is assured that WITH_BACKGROUND |
| 597 | WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ | 588 | is false when (FROM > 0 || TO < S->nchars). */ |
| 598 | int (*draw) (struct glyph_string *s, int from, int to, | 589 | int (*draw) (struct glyph_string *s, int from, int to, |
| 599 | int x, int y, int with_background); | 590 | int x, int y, bool with_background); |
| 600 | 591 | ||
| 601 | /* Optional. | 592 | /* Optional. |
| 602 | Store bitmap data for glyph-code CODE of FONT in BITMAP. It is | 593 | Store bitmap data for glyph-code CODE of FONT in BITMAP. It is |
| @@ -648,7 +639,7 @@ struct font_driver | |||
| 648 | short, return -1. */ | 639 | short, return -1. */ |
| 649 | int (*otf_drive) (struct font *font, Lisp_Object features, | 640 | int (*otf_drive) (struct font *font, Lisp_Object features, |
| 650 | Lisp_Object gstring_in, int from, int to, | 641 | Lisp_Object gstring_in, int from, int to, |
| 651 | Lisp_Object gstring_out, int idx, int alternate_subst); | 642 | Lisp_Object gstring_out, int idx, bool alternate_subst); |
| 652 | 643 | ||
| 653 | /* Optional. | 644 | /* Optional. |
| 654 | Make the font driver ready for frame F. Usually this function | 645 | Make the font driver ready for frame F. Usually this function |
| @@ -699,9 +690,9 @@ struct font_driver | |||
| 699 | 690 | ||
| 700 | Return non-zero if FONT_OBJECT can be used as a (cached) font | 691 | Return non-zero if FONT_OBJECT can be used as a (cached) font |
| 701 | for ENTITY on frame F. */ | 692 | for ENTITY on frame F. */ |
| 702 | int (*cached_font_ok) (struct frame *f, | 693 | bool (*cached_font_ok) (struct frame *f, |
| 703 | Lisp_Object font_object, | 694 | Lisp_Object font_object, |
| 704 | Lisp_Object entity); | 695 | Lisp_Object entity); |
| 705 | }; | 696 | }; |
| 706 | 697 | ||
| 707 | 698 | ||
| @@ -711,9 +702,9 @@ struct font_driver | |||
| 711 | 702 | ||
| 712 | struct font_driver_list | 703 | struct font_driver_list |
| 713 | { | 704 | { |
| 714 | /* 1 iff this driver is currently used. It is ignored in the global | 705 | /* True iff this driver is currently used. It is ignored in the global |
| 715 | font driver list.*/ | 706 | font driver list.*/ |
| 716 | int on; | 707 | bool on; |
| 717 | /* Pointer to the font driver. */ | 708 | /* Pointer to the font driver. */ |
| 718 | struct font_driver *driver; | 709 | struct font_driver *driver; |
| 719 | /* Pointer to the next element of the chain. */ | 710 | /* Pointer to the next element of the chain. */ |
| @@ -744,12 +735,12 @@ extern Lisp_Object find_font_encoding (Lisp_Object); | |||
| 744 | extern int font_registry_charsets (Lisp_Object, struct charset **, | 735 | extern int font_registry_charsets (Lisp_Object, struct charset **, |
| 745 | struct charset **); | 736 | struct charset **); |
| 746 | extern int font_style_to_value (enum font_property_index prop, | 737 | extern int font_style_to_value (enum font_property_index prop, |
| 747 | Lisp_Object name, int noerror); | 738 | Lisp_Object name, bool noerror); |
| 748 | extern Lisp_Object font_style_symbolic (Lisp_Object font, | 739 | extern Lisp_Object font_style_symbolic (Lisp_Object font, |
| 749 | enum font_property_index prop, | 740 | enum font_property_index prop, |
| 750 | int for_face); | 741 | bool for_face); |
| 751 | 742 | ||
| 752 | extern int font_match_p (Lisp_Object spec, Lisp_Object font); | 743 | extern bool font_match_p (Lisp_Object spec, Lisp_Object font); |
| 753 | extern Lisp_Object font_list_entities (Lisp_Object frame, | 744 | extern Lisp_Object font_list_entities (Lisp_Object frame, |
| 754 | Lisp_Object spec); | 745 | Lisp_Object spec); |
| 755 | 746 | ||
| @@ -774,7 +765,7 @@ extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); | |||
| 774 | extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); | 765 | extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); |
| 775 | 766 | ||
| 776 | extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, | 767 | extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, |
| 777 | int force_symbol); | 768 | bool force_symbol); |
| 778 | extern void font_update_sort_order (int *order); | 769 | extern void font_update_sort_order (int *order); |
| 779 | 770 | ||
| 780 | extern void font_parse_family_registry (Lisp_Object family, | 771 | extern void font_parse_family_registry (Lisp_Object family, |
diff --git a/src/fontset.c b/src/fontset.c index 01e38fe45e5..2b955fe6b11 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -185,21 +185,12 @@ void (*check_window_system_func) (void); | |||
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | /* Prototype declarations for static functions. */ | 187 | /* Prototype declarations for static functions. */ |
| 188 | static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 189 | static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, | ||
| 190 | int, int); | ||
| 191 | static void reorder_font_vector (Lisp_Object, struct font *); | ||
| 192 | static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int); | ||
| 193 | static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); | 188 | static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); |
| 194 | static Lisp_Object fontset_pattern_regexp (Lisp_Object); | ||
| 195 | static void accumulate_script_ranges (Lisp_Object, Lisp_Object, | ||
| 196 | Lisp_Object); | ||
| 197 | static void set_fontset_font (Lisp_Object, Lisp_Object); | ||
| 198 | 189 | ||
| 199 | /* Return 1 if ID is a valid fontset id, else return 0. | 190 | /* Return true if ID is a valid fontset id. |
| 200 | Optimized away if ENABLE_CHECKING is not defined. */ | 191 | Optimized away if ENABLE_CHECKING is not defined. */ |
| 201 | 192 | ||
| 202 | static int | 193 | static bool |
| 203 | fontset_id_valid_p (int id) | 194 | fontset_id_valid_p (int id) |
| 204 | { | 195 | { |
| 205 | return (id >= 0 && id < ASIZE (Vfontset_table) - 1); | 196 | return (id >= 0 && id < ASIZE (Vfontset_table) - 1); |
| @@ -413,7 +404,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) | |||
| 413 | Lisp_Object vec, font_object; | 404 | Lisp_Object vec, font_object; |
| 414 | int size; | 405 | int size; |
| 415 | int i; | 406 | int i; |
| 416 | int score_changed = 0; | 407 | bool score_changed = 0; |
| 417 | 408 | ||
| 418 | if (font) | 409 | if (font) |
| 419 | XSETFONT (font_object, font); | 410 | XSETFONT (font_object, font); |
| @@ -544,10 +535,11 @@ fontset_get_font_group (Lisp_Object fontset, int c) | |||
| 544 | ID is a charset-id that must be preferred, or -1 meaning no | 535 | ID is a charset-id that must be preferred, or -1 meaning no |
| 545 | preference. | 536 | preference. |
| 546 | 537 | ||
| 547 | If FALLBACK is nonzero, search only fallback fonts. */ | 538 | If FALLBACK, search only fallback fonts. */ |
| 548 | 539 | ||
| 549 | static Lisp_Object | 540 | static Lisp_Object |
| 550 | fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback) | 541 | fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, |
| 542 | bool fallback) | ||
| 551 | { | 543 | { |
| 552 | Lisp_Object vec, font_group; | 544 | Lisp_Object vec, font_group; |
| 553 | int i, charset_matched = 0, found_index; | 545 | int i, charset_matched = 0, found_index; |
| @@ -919,11 +911,11 @@ free_face_fontset (FRAME_PTR f, struct face *face) | |||
| 919 | 911 | ||
| 920 | 912 | ||
| 921 | #if 0 | 913 | #if 0 |
| 922 | /* Return 1 if FACE is suitable for displaying character C. | 914 | /* Return true if FACE is suitable for displaying character C. |
| 923 | Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P | 915 | Called from the macro FACE_SUITABLE_FOR_CHAR_P |
| 924 | when C is not an ASCII character. */ | 916 | when C is not an ASCII character. */ |
| 925 | 917 | ||
| 926 | int | 918 | bool |
| 927 | face_suitable_for_char_p (struct face *face, int c) | 919 | face_suitable_for_char_p (struct face *face, int c) |
| 928 | { | 920 | { |
| 929 | Lisp_Object fontset, rfont_def; | 921 | Lisp_Object fontset, rfont_def; |
| @@ -1470,7 +1462,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) | |||
| 1470 | Lisp_Object range_list; | 1462 | Lisp_Object range_list; |
| 1471 | struct charset *charset = NULL; | 1463 | struct charset *charset = NULL; |
| 1472 | Lisp_Object fontname; | 1464 | Lisp_Object fontname; |
| 1473 | int ascii_changed = 0; | 1465 | bool ascii_changed = 0; |
| 1474 | 1466 | ||
| 1475 | fontset = check_fontset_name (name, &frame); | 1467 | fontset = check_fontset_name (name, &frame); |
| 1476 | 1468 | ||
diff --git a/src/ftfont.c b/src/ftfont.c index 10b53411248..a85773a9a21 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -45,7 +45,7 @@ static Lisp_Object Qfreetype; | |||
| 45 | static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif; | 45 | static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif; |
| 46 | 46 | ||
| 47 | /* Flag to tell if FcInit is already called or not. */ | 47 | /* Flag to tell if FcInit is already called or not. */ |
| 48 | static int fc_initialized; | 48 | static bool fc_initialized; |
| 49 | 49 | ||
| 50 | /* Handle to a FreeType library instance. */ | 50 | /* Handle to a FreeType library instance. */ |
| 51 | static FT_Library ft_library; | 51 | static FT_Library ft_library; |
| @@ -65,7 +65,7 @@ struct ftfont_info | |||
| 65 | #ifdef HAVE_LIBOTF | 65 | #ifdef HAVE_LIBOTF |
| 66 | /* The following four members must be here in this order to be | 66 | /* The following four members must be here in this order to be |
| 67 | compatible with struct xftfont_info (in xftfont.c). */ | 67 | compatible with struct xftfont_info (in xftfont.c). */ |
| 68 | int maybe_otf; /* Flag to tell if this may be OTF or not. */ | 68 | bool maybe_otf; /* Flag to tell if this may be OTF or not. */ |
| 69 | OTF *otf; | 69 | OTF *otf; |
| 70 | #endif /* HAVE_LIBOTF */ | 70 | #endif /* HAVE_LIBOTF */ |
| 71 | FT_Size ft_size; | 71 | FT_Size ft_size; |
| @@ -543,9 +543,9 @@ struct font_driver ftfont_driver = | |||
| 543 | /* We can't draw a text without device dependent functions. */ | 543 | /* We can't draw a text without device dependent functions. */ |
| 544 | NULL, /* draw */ | 544 | NULL, /* draw */ |
| 545 | ftfont_get_bitmap, | 545 | ftfont_get_bitmap, |
| 546 | NULL, /* get_bitmap */ | ||
| 547 | NULL, /* free_bitmap */ | 546 | NULL, /* free_bitmap */ |
| 548 | NULL, /* get_outline */ | 547 | NULL, /* get_outline */ |
| 548 | NULL, /* free_outline */ | ||
| 549 | ftfont_anchor_point, | 549 | ftfont_anchor_point, |
| 550 | #ifdef HAVE_LIBOTF | 550 | #ifdef HAVE_LIBOTF |
| 551 | ftfont_otf_capability, | 551 | ftfont_otf_capability, |
| @@ -661,7 +661,8 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec) | |||
| 661 | { | 661 | { |
| 662 | struct OpenTypeSpec *spec = malloc (sizeof *spec); | 662 | struct OpenTypeSpec *spec = malloc (sizeof *spec); |
| 663 | Lisp_Object val; | 663 | Lisp_Object val; |
| 664 | int i, j, negative; | 664 | int i, j; |
| 665 | bool negative; | ||
| 665 | 666 | ||
| 666 | if (! spec) | 667 | if (! spec) |
| 667 | return NULL; | 668 | return NULL; |
| @@ -1185,7 +1186,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1185 | FT_Size ft_size; | 1186 | FT_Size ft_size; |
| 1186 | FT_UInt size; | 1187 | FT_UInt size; |
| 1187 | Lisp_Object val, filename, idx, cache, font_object; | 1188 | Lisp_Object val, filename, idx, cache, font_object; |
| 1188 | int scalable; | 1189 | bool scalable; |
| 1189 | int spacing; | 1190 | int spacing; |
| 1190 | char name[256]; | 1191 | char name[256]; |
| 1191 | int i, len; | 1192 | int i, len; |
| @@ -1243,7 +1244,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1243 | ftfont_info->ft_size = ft_face->size; | 1244 | ftfont_info->ft_size = ft_face->size; |
| 1244 | ftfont_info->index = XINT (idx); | 1245 | ftfont_info->index = XINT (idx); |
| 1245 | #ifdef HAVE_LIBOTF | 1246 | #ifdef HAVE_LIBOTF |
| 1246 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | 1247 | ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; |
| 1247 | ftfont_info->otf = NULL; | 1248 | ftfont_info->otf = NULL; |
| 1248 | #endif /* HAVE_LIBOTF */ | 1249 | #endif /* HAVE_LIBOTF */ |
| 1249 | /* This means that there's no need of transformation. */ | 1250 | /* This means that there's no need of transformation. */ |
| @@ -1392,7 +1393,8 @@ ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct | |||
| 1392 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | 1393 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
| 1393 | FT_Face ft_face = ftfont_info->ft_size->face; | 1394 | FT_Face ft_face = ftfont_info->ft_size->face; |
| 1394 | int width = 0; | 1395 | int width = 0; |
| 1395 | int i, first; | 1396 | int i; |
| 1397 | bool first; | ||
| 1396 | 1398 | ||
| 1397 | if (ftfont_info->ft_size != ft_face->size) | 1399 | if (ftfont_info->ft_size != ft_face->size) |
| 1398 | FT_Activate_Size (ftfont_info->ft_size); | 1400 | FT_Activate_Size (ftfont_info->ft_size); |
| @@ -1682,10 +1684,12 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec) | |||
| 1682 | struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; | 1684 | struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; |
| 1683 | OTF *otf = flt_font_ft->otf; | 1685 | OTF *otf = flt_font_ft->otf; |
| 1684 | OTF_Tag *tags; | 1686 | OTF_Tag *tags; |
| 1685 | int i, n, negative; | 1687 | int i, n; |
| 1688 | bool negative; | ||
| 1686 | 1689 | ||
| 1687 | if (FEATURE_ANY (0) && FEATURE_ANY (1)) | 1690 | if (FEATURE_ANY (0) && FEATURE_ANY (1)) |
| 1688 | /* Return 1 iff any of GSUB or GPOS support the script (and language). */ | 1691 | /* Return true iff any of GSUB or GPOS support the script (and |
| 1692 | language). */ | ||
| 1689 | return (otf | 1693 | return (otf |
| 1690 | && (OTF_check_features (otf, 0, spec->script, spec->langsys, | 1694 | && (OTF_check_features (otf, 0, spec->script, spec->langsys, |
| 1691 | NULL, 0) > 0 | 1695 | NULL, 0) > 0 |
| @@ -2390,7 +2394,7 @@ ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, | |||
| 2390 | 2394 | ||
| 2391 | static MFLTGlyphString gstring; | 2395 | static MFLTGlyphString gstring; |
| 2392 | 2396 | ||
| 2393 | static int m17n_flt_initialized; | 2397 | static bool m17n_flt_initialized; |
| 2394 | 2398 | ||
| 2395 | static Lisp_Object | 2399 | static Lisp_Object |
| 2396 | ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, | 2400 | ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, |
| @@ -2400,7 +2404,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, | |||
| 2400 | ptrdiff_t i; | 2404 | ptrdiff_t i; |
| 2401 | struct MFLTFontFT flt_font_ft; | 2405 | struct MFLTFontFT flt_font_ft; |
| 2402 | MFLT *flt = NULL; | 2406 | MFLT *flt = NULL; |
| 2403 | int with_variation_selector = 0; | 2407 | bool with_variation_selector = 0; |
| 2404 | 2408 | ||
| 2405 | if (! m17n_flt_initialized) | 2409 | if (! m17n_flt_initialized) |
| 2406 | { | 2410 | { |
| @@ -2421,7 +2425,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, | |||
| 2421 | break; | 2425 | break; |
| 2422 | c = LGLYPH_CHAR (g); | 2426 | c = LGLYPH_CHAR (g); |
| 2423 | if (CHAR_VARIATION_SELECTOR_P (c)) | 2427 | if (CHAR_VARIATION_SELECTOR_P (c)) |
| 2424 | with_variation_selector++; | 2428 | with_variation_selector = 1; |
| 2425 | } | 2429 | } |
| 2426 | 2430 | ||
| 2427 | len = i; | 2431 | len = i; |
diff --git a/src/ftxfont.c b/src/ftxfont.c index 6ebe0798b4e..c705ede62c4 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c | |||
| @@ -43,14 +43,6 @@ static | |||
| 43 | #endif | 43 | #endif |
| 44 | struct font_driver ftxfont_driver; | 44 | struct font_driver ftxfont_driver; |
| 45 | 45 | ||
| 46 | /* Prototypes for helper function. */ | ||
| 47 | static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long); | ||
| 48 | static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, | ||
| 49 | unsigned, int, int, XPoint *, int, int *, | ||
| 50 | int); | ||
| 51 | static void ftxfont_draw_background (FRAME_PTR, struct font *, GC, | ||
| 52 | int, int, int); | ||
| 53 | |||
| 54 | struct ftxfont_frame_data | 46 | struct ftxfont_frame_data |
| 55 | { | 47 | { |
| 56 | /* Background and foreground colors. */ | 48 | /* Background and foreground colors. */ |
| @@ -143,7 +135,9 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba | |||
| 143 | } | 135 | } |
| 144 | 136 | ||
| 145 | static int | 137 | static int |
| 146 | ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush) | 138 | ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, |
| 139 | unsigned int code, int x, int y, XPoint *p, int size, | ||
| 140 | int *n, bool flush) | ||
| 147 | { | 141 | { |
| 148 | struct font_bitmap bitmap; | 142 | struct font_bitmap bitmap; |
| 149 | unsigned char *b; | 143 | unsigned char *b; |
| @@ -232,13 +226,6 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y, | |||
| 232 | XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); | 226 | XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); |
| 233 | } | 227 | } |
| 234 | 228 | ||
| 235 | /* Prototypes for font-driver methods. */ | ||
| 236 | static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object); | ||
| 237 | static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object); | ||
| 238 | static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int); | ||
| 239 | static void ftxfont_close (FRAME_PTR, struct font *); | ||
| 240 | static int ftxfont_draw (struct glyph_string *, int, int, int, int, int); | ||
| 241 | |||
| 242 | static Lisp_Object | 229 | static Lisp_Object |
| 243 | ftxfont_list (Lisp_Object frame, Lisp_Object spec) | 230 | ftxfont_list (Lisp_Object frame, Lisp_Object spec) |
| 244 | { | 231 | { |
| @@ -280,7 +267,8 @@ ftxfont_close (FRAME_PTR f, struct font *font) | |||
| 280 | } | 267 | } |
| 281 | 268 | ||
| 282 | static int | 269 | static int |
| 283 | ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) | 270 | ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 271 | bool with_background) | ||
| 284 | { | 272 | { |
| 285 | FRAME_PTR f = s->f; | 273 | FRAME_PTR f = s->f; |
| 286 | struct face *face = s->face; | 274 | struct face *face = s->face; |
diff --git a/src/nsfont.m b/src/nsfont.m index 5bf4c01c961..1c9976ec6cc 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -625,7 +625,7 @@ static unsigned int nsfont_encode_char (struct font *font, int c); | |||
| 625 | static int nsfont_text_extents (struct font *font, unsigned int *code, | 625 | static int nsfont_text_extents (struct font *font, unsigned int *code, |
| 626 | int nglyphs, struct font_metrics *metrics); | 626 | int nglyphs, struct font_metrics *metrics); |
| 627 | static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | 627 | static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 628 | int with_background); | 628 | bool with_background); |
| 629 | 629 | ||
| 630 | struct font_driver nsfont_driver = | 630 | struct font_driver nsfont_driver = |
| 631 | { | 631 | { |
| @@ -833,7 +833,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 833 | font = (struct font *) font_info; | 833 | font = (struct font *) font_info; |
| 834 | font->pixel_size = [sfont pointSize]; | 834 | font->pixel_size = [sfont pointSize]; |
| 835 | font->driver = &nsfont_driver; | 835 | font->driver = &nsfont_driver; |
| 836 | font->encoding_type = FONT_ENCODING_NOT_DECIDED; | ||
| 837 | font->encoding_charset = -1; | 836 | font->encoding_charset = -1; |
| 838 | font->repertory_charset = -1; | 837 | font->repertory_charset = -1; |
| 839 | font->default_ascent = 0; | 838 | font->default_ascent = 0; |
| @@ -1042,12 +1041,12 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs, | |||
| 1042 | 1041 | ||
| 1043 | 1042 | ||
| 1044 | /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | 1043 | /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel |
| 1045 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | 1044 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, |
| 1046 | is nonzero, fill the background in advance. It is assured that | 1045 | fill the background in advance. It is assured that WITH_BACKGROUND |
| 1047 | WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ | 1046 | is false when (FROM > 0 || TO < S->nchars). */ |
| 1048 | static int | 1047 | static int |
| 1049 | nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | 1048 | nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 1050 | int with_background) | 1049 | bool with_background) |
| 1051 | /* NOTE: focus and clip must be set | 1050 | /* NOTE: focus and clip must be set |
| 1052 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ | 1051 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ |
| 1053 | { | 1052 | { |
diff --git a/src/w32font.c b/src/w32font.c index cfd453282dd..8b3a0e4312e 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -635,9 +635,9 @@ w32font_text_extents (struct font *font, unsigned *code, | |||
| 635 | /* w32 implementation of draw for font backend. | 635 | /* w32 implementation of draw for font backend. |
| 636 | Optional. | 636 | Optional. |
| 637 | Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | 637 | Draw glyphs between FROM and TO of S->char2b at (X Y) pixel |
| 638 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | 638 | position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, |
| 639 | is nonzero, fill the background in advance. It is assured that | 639 | fill the background in advance. It is assured that WITH_BACKGROUND |
| 640 | WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). | 640 | is false when (FROM > 0 || TO < S->nchars). |
| 641 | 641 | ||
| 642 | TODO: Currently this assumes that the colors and fonts are already | 642 | TODO: Currently this assumes that the colors and fonts are already |
| 643 | set in the DC. This seems to be true now, but maybe only due to | 643 | set in the DC. This seems to be true now, but maybe only due to |
| @@ -647,7 +647,7 @@ w32font_text_extents (struct font *font, unsigned *code, | |||
| 647 | 647 | ||
| 648 | int | 648 | int |
| 649 | w32font_draw (struct glyph_string *s, int from, int to, | 649 | w32font_draw (struct glyph_string *s, int from, int to, |
| 650 | int x, int y, int with_background) | 650 | int x, int y, bool with_background) |
| 651 | { | 651 | { |
| 652 | UINT options; | 652 | UINT options; |
| 653 | HRGN orig_clip = NULL; | 653 | HRGN orig_clip = NULL; |
| @@ -804,7 +804,7 @@ static int | |||
| 804 | w32font_otf_drive (struct font *font, Lisp_Object features, | 804 | w32font_otf_drive (struct font *font, Lisp_Object features, |
| 805 | Lisp_Object gstring_in, int from, int to, | 805 | Lisp_Object gstring_in, int from, int to, |
| 806 | Lisp_Object gstring_out, int idx, | 806 | Lisp_Object gstring_out, int idx, |
| 807 | int alternate_subst); | 807 | bool alternate_subst); |
| 808 | */ | 808 | */ |
| 809 | 809 | ||
| 810 | /* Internal implementation of w32font_list. | 810 | /* Internal implementation of w32font_list. |
| @@ -987,7 +987,6 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, | |||
| 987 | font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth; | 987 | font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth; |
| 988 | 988 | ||
| 989 | font->vertical_centering = 0; | 989 | font->vertical_centering = 0; |
| 990 | font->encoding_type = 0; | ||
| 991 | font->baseline_offset = 0; | 990 | font->baseline_offset = 0; |
| 992 | font->relative_compose = 0; | 991 | font->relative_compose = 0; |
| 993 | font->default_ascent = w32_font->metrics.tmAscent; | 992 | font->default_ascent = w32_font->metrics.tmAscent; |
diff --git a/src/w32font.h b/src/w32font.h index a29ddbe778c..8fa00a9b524 100644 --- a/src/w32font.h +++ b/src/w32font.h | |||
| @@ -77,7 +77,7 @@ int w32font_has_char (Lisp_Object entity, int c); | |||
| 77 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, | 77 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, |
| 78 | struct font_metrics *metrics); | 78 | struct font_metrics *metrics); |
| 79 | int w32font_draw (struct glyph_string *s, int from, int to, | 79 | int w32font_draw (struct glyph_string *s, int from, int to, |
| 80 | int x, int y, int with_background); | 80 | int x, int y, bool with_background); |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); | 83 | int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); |
diff --git a/src/xfont.c b/src/xfont.c index be9556d585a..7755b780815 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -126,7 +126,7 @@ static int xfont_has_char (Lisp_Object, int); | |||
| 126 | static unsigned xfont_encode_char (struct font *, int); | 126 | static unsigned xfont_encode_char (struct font *, int); |
| 127 | static int xfont_text_extents (struct font *, unsigned *, int, | 127 | static int xfont_text_extents (struct font *, unsigned *, int, |
| 128 | struct font_metrics *); | 128 | struct font_metrics *); |
| 129 | static int xfont_draw (struct glyph_string *, int, int, int, int, int); | 129 | static int xfont_draw (struct glyph_string *, int, int, int, int, bool); |
| 130 | static int xfont_check (FRAME_PTR, struct font *); | 130 | static int xfont_check (FRAME_PTR, struct font *); |
| 131 | 131 | ||
| 132 | struct font_driver xfont_driver = | 132 | struct font_driver xfont_driver = |
| @@ -217,9 +217,9 @@ xfont_encode_coding_xlfd (char *xlfd) | |||
| 217 | /* Check if CHARS (cons or vector) is supported by XFONT whose | 217 | /* Check if CHARS (cons or vector) is supported by XFONT whose |
| 218 | encoding charset is ENCODING (XFONT is NULL) or by a font whose | 218 | encoding charset is ENCODING (XFONT is NULL) or by a font whose |
| 219 | registry corresponds to ENCODING and REPERTORY. | 219 | registry corresponds to ENCODING and REPERTORY. |
| 220 | Return 1 if supported, return 0 otherwise. */ | 220 | Return true if supported. */ |
| 221 | 221 | ||
| 222 | static int | 222 | static bool |
| 223 | xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont, | 223 | xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont, |
| 224 | struct charset *encoding, struct charset *repertory) | 224 | struct charset *encoding, struct charset *repertory) |
| 225 | { | 225 | { |
| @@ -1019,7 +1019,8 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f | |||
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | static int | 1021 | static int |
| 1022 | xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) | 1022 | xfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 1023 | bool with_background) | ||
| 1023 | { | 1024 | { |
| 1024 | XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; | 1025 | XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; |
| 1025 | int len = to - from; | 1026 | int len = to - from; |
| @@ -1040,7 +1041,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac | |||
| 1040 | for (i = 0; i < len ; i++) | 1041 | for (i = 0; i < len ; i++) |
| 1041 | str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); | 1042 | str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); |
| 1042 | BLOCK_INPUT; | 1043 | BLOCK_INPUT; |
| 1043 | if (with_background > 0) | 1044 | if (with_background) |
| 1044 | { | 1045 | { |
| 1045 | if (s->padding_p) | 1046 | if (s->padding_p) |
| 1046 | for (i = 0; i < len; i++) | 1047 | for (i = 0; i < len; i++) |
| @@ -1066,7 +1067,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac | |||
| 1066 | } | 1067 | } |
| 1067 | 1068 | ||
| 1068 | BLOCK_INPUT; | 1069 | BLOCK_INPUT; |
| 1069 | if (with_background > 0) | 1070 | if (with_background) |
| 1070 | { | 1071 | { |
| 1071 | if (s->padding_p) | 1072 | if (s->padding_p) |
| 1072 | for (i = 0; i < len; i++) | 1073 | for (i = 0; i < len; i++) |
diff --git a/src/xftfont.c b/src/xftfont.c index 5e60ab0c4d3..404b9124099 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -52,7 +52,7 @@ struct xftfont_info | |||
| 52 | /* The following five members must be here in this order to be | 52 | /* The following five members must be here in this order to be |
| 53 | compatible with struct ftfont_info (in ftfont.c). */ | 53 | compatible with struct ftfont_info (in ftfont.c). */ |
| 54 | #ifdef HAVE_LIBOTF | 54 | #ifdef HAVE_LIBOTF |
| 55 | int maybe_otf; /* Flag to tell if this may be OTF or not. */ | 55 | bool maybe_otf; /* Flag to tell if this may be OTF or not. */ |
| 56 | OTF *otf; | 56 | OTF *otf; |
| 57 | #endif /* HAVE_LIBOTF */ | 57 | #endif /* HAVE_LIBOTF */ |
| 58 | FT_Size ft_size; | 58 | FT_Size ft_size; |
| @@ -92,7 +92,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * | |||
| 92 | else | 92 | else |
| 93 | { | 93 | { |
| 94 | XGCValues xgcv; | 94 | XGCValues xgcv; |
| 95 | int fg_done = 0, bg_done = 0; | 95 | bool fg_done = 0, bg_done = 0; |
| 96 | 96 | ||
| 97 | BLOCK_INPUT; | 97 | BLOCK_INPUT; |
| 98 | XGetGCValues (FRAME_X_DISPLAY (f), gc, | 98 | XGetGCValues (FRAME_X_DISPLAY (f), gc, |
| @@ -111,7 +111,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * | |||
| 111 | *bg = xftface_info->xft_fg, bg_done = 1; | 111 | *bg = xftface_info->xft_fg, bg_done = 1; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | if (fg_done + bg_done < 2) | 114 | if (! (fg_done & bg_done)) |
| 115 | { | 115 | { |
| 116 | XColor colors[2]; | 116 | XColor colors[2]; |
| 117 | 117 | ||
| @@ -137,19 +137,6 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | 139 | ||
| 140 | static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object); | ||
| 141 | static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object); | ||
| 142 | static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int); | ||
| 143 | static void xftfont_close (FRAME_PTR, struct font *); | ||
| 144 | static int xftfont_prepare_face (FRAME_PTR, struct face *); | ||
| 145 | static void xftfont_done_face (FRAME_PTR, struct face *); | ||
| 146 | static int xftfont_has_char (Lisp_Object, int); | ||
| 147 | static unsigned xftfont_encode_char (struct font *, int); | ||
| 148 | static int xftfont_text_extents (struct font *, unsigned *, int, | ||
| 149 | struct font_metrics *); | ||
| 150 | static int xftfont_draw (struct glyph_string *, int, int, int, int, int); | ||
| 151 | static int xftfont_end_for_frame (FRAME_PTR f); | ||
| 152 | |||
| 153 | struct font_driver xftfont_driver; | 140 | struct font_driver xftfont_driver; |
| 154 | 141 | ||
| 155 | static Lisp_Object | 142 | static Lisp_Object |
| @@ -470,7 +457,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 470 | font->underline_thickness = 0; | 457 | font->underline_thickness = 0; |
| 471 | } | 458 | } |
| 472 | #ifdef HAVE_LIBOTF | 459 | #ifdef HAVE_LIBOTF |
| 473 | xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | 460 | xftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; |
| 474 | xftfont_info->otf = NULL; | 461 | xftfont_info->otf = NULL; |
| 475 | #endif /* HAVE_LIBOTF */ | 462 | #endif /* HAVE_LIBOTF */ |
| 476 | xftfont_info->ft_size = ft_face->size; | 463 | xftfont_info->ft_size = ft_face->size; |
| @@ -630,7 +617,8 @@ xftfont_get_xft_draw (FRAME_PTR f) | |||
| 630 | } | 617 | } |
| 631 | 618 | ||
| 632 | static int | 619 | static int |
| 633 | xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) | 620 | xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, |
| 621 | bool with_background) | ||
| 634 | { | 622 | { |
| 635 | FRAME_PTR f = s->f; | 623 | FRAME_PTR f = s->f; |
| 636 | struct face *face = s->face; | 624 | struct face *face = s->face; |
| @@ -711,15 +699,17 @@ xftfont_end_for_frame (FRAME_PTR f) | |||
| 711 | return 0; | 699 | return 0; |
| 712 | } | 700 | } |
| 713 | 701 | ||
| 714 | static int | 702 | static bool |
| 715 | xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity) | 703 | xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, |
| 704 | Lisp_Object entity) | ||
| 716 | { | 705 | { |
| 717 | struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); | 706 | struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); |
| 718 | FcPattern *oldpat = info->xftfont->pattern; | 707 | FcPattern *oldpat = info->xftfont->pattern; |
| 719 | Display *display = FRAME_X_DISPLAY (f); | 708 | Display *display = FRAME_X_DISPLAY (f); |
| 720 | FcPattern *pat = FcPatternCreate (); | 709 | FcPattern *pat = FcPatternCreate (); |
| 721 | FcBool b1, b2; | 710 | FcBool b1, b2; |
| 722 | int ok = 0, i1, i2, r1, r2; | 711 | bool ok = 0; |
| 712 | int i1, i2, r1, r2; | ||
| 723 | 713 | ||
| 724 | xftfont_add_rendering_parameters (pat, entity); | 714 | xftfont_add_rendering_parameters (pat, entity); |
| 725 | XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); | 715 | XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); |