summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-09-06 01:04:49 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-09-06 01:04:49 -0700
commita864ef14570715dc3233fbbf2e9da7aa8f29729e (patch)
treed350c376998ae3bf0ef69f3d708f766e515a3465
parent0699fc18a5ea00b9a6d64b0e0ebf33b4723beb10 (diff)
downloademacs-a864ef14570715dc3233fbbf2e9da7aa8f29729e.tar.gz
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.
-rw-r--r--src/ChangeLog25
-rw-r--r--src/font.c41
-rw-r--r--src/font.h45
-rw-r--r--src/fontset.c28
-rw-r--r--src/ftfont.c28
-rw-r--r--src/ftxfont.c22
-rw-r--r--src/nsfont.m11
-rw-r--r--src/w32font.c11
-rw-r--r--src/w32font.h2
-rw-r--r--src/xfont.c13
-rw-r--r--src/xftfont.c32
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 @@
+2012-09-06 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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.
+
2012-09-06 Dmitry Antipov <dmantipov@yandex.ru>
* 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;
/* Return a Lispy value of a font property value at STR and LEN bytes.
- If STR is "*", return nil.
- If FORCE_SYMBOL is zero and all characters in STR are digits,
- return an integer. Otherwise, return a symbol interned from
- STR. */
+ If STR is "*", return nil. If FORCE_SYMBOL, or if STR does not
+ consist entirely of one or more digits, return a symbol interned
+ from STR. Otherwise, return an integer. */
Lisp_Object
-font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
+font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
{
ptrdiff_t i;
Lisp_Object tem;
@@ -306,7 +305,8 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec)
VAL is an integer. */
int
-font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror)
+font_style_to_value (enum font_property_index prop, Lisp_Object val,
+ bool noerror)
{
Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
int len;
@@ -385,7 +385,8 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
}
Lisp_Object
-font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face)
+font_style_symbolic (Lisp_Object font, enum font_property_index prop,
+ bool for_face)
{
Lisp_Object val = AREF (font, prop);
Lisp_Object table, elt;
@@ -1101,7 +1102,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
}
else
{
- int wild_card_found = 0;
+ bool wild_card_found = 0;
Lisp_Object prop[XLFD_LAST_INDEX];
if (FONT_ENTITY_P (font))
@@ -1337,7 +1338,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
}
else if (*p == '-')
{
- int decimal = 0, size_found = 1;
+ bool decimal = 0, size_found = 1;
for (q = p + 1; *q && *q != ':'; q++)
if (! c_isdigit (*q))
{
@@ -1938,7 +1939,7 @@ generate_otf_features (Lisp_Object spec, char *features)
{
Lisp_Object val;
char *p;
- int asterisk;
+ bool asterisk;
p = features;
*p = '\0';
@@ -2302,11 +2303,12 @@ font_update_sort_order (int *order)
}
}
-static int
-font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table)
+static bool
+font_check_otf_features (Lisp_Object script, Lisp_Object langsys,
+ Lisp_Object features, Lisp_Object table)
{
Lisp_Object val;
- int negative;
+ bool negative;
table = assq_no_quit (script, table);
if (NILP (table))
@@ -2342,7 +2344,7 @@ font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object fe
/* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */
-static int
+static bool
font_check_otf (Lisp_Object spec, Lisp_Object otf_capability)
{
Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil;
@@ -2376,7 +2378,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability)
/* Check if FONT (font-entity or font-object) matches with the font
specification SPEC. */
-int
+bool
font_match_p (Lisp_Object spec, Lisp_Object font)
{
Lisp_Object prop[FONT_SPEC_MAX], *props;
@@ -2694,7 +2696,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
Lisp_Object ftype, val;
Lisp_Object list = Qnil;
int size;
- int need_filtering = 0;
+ bool need_filtering = 0;
int i;
eassert (FONT_SPEC_P (spec));
@@ -3036,15 +3038,14 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
{
Lisp_Object font_entity;
Lisp_Object prefer;
- int result, i;
+ int i;
FRAME_PTR f = XFRAME (frame);
if (NILP (XCDR (entities))
&& ASIZE (XCAR (entities)) == 1)
{
font_entity = AREF (XCAR (entities), 0);
- if (c < 0
- || (result = font_has_char (f, font_entity, c)) > 0)
+ if (c < 0 || font_has_char (f, font_entity, c) > 0)
return font_entity;
return Qnil;
}
@@ -3618,7 +3619,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
Lisp_Object string)
{
FRAME_PTR f;
- int multibyte;
+ bool multibyte;
Lisp_Object font_object;
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
negative if that information is not in the font. */
int underline_position;
- /* 1 if `vertical-centering-font-regexp' matches this font name.
+ /* True if `vertical-centering-font-regexp' matches this font name.
In this case, we render characters at vertical center positions
of lines. */
- int vertical_centering;
-
- /* Encoding type of the font. The value is one of
- 0, 1, 2, or 3:
- 0: code points 0x20..0x7F or 0x2020..0x7F7F are used
- 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used
- 2: code points 0x20A0..0x7FFF are used
- 3: code points 0xA020..0xFF7F are used
- If the member `font_encoder' is not NULL, this member is ignored. */
- unsigned char encoding_type;
+ bool vertical_centering;
/* The baseline position of a font is normally `ascent' value of the
font. However, there exist many fonts which don't set `ascent' to
@@ -506,9 +497,9 @@ struct font_driver
/* Symbol indicating the type of the font-driver. */
Lisp_Object type;
- /* 1 iff the font's foundry, family, and adstyle names are case
+ /* True iff the font's foundry, family, and adstyle names are case
sensitive. */
- int case_sensitive;
+ bool case_sensitive;
/* Return a cache of font-entities on frame F. The cache must be a
cons whose cdr part is the actual cache area. */
@@ -592,11 +583,11 @@ struct font_driver
/* Optional.
Draw glyphs between FROM and TO of S->char2b at (X Y) pixel
- position of frame F with S->FACE and S->GC. If WITH_BACKGROUND
- is nonzero, fill the background in advance. It is assured that
- WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars). */
int (*draw) (struct glyph_string *s, int from, int to,
- int x, int y, int with_background);
+ int x, int y, bool with_background);
/* Optional.
Store bitmap data for glyph-code CODE of FONT in BITMAP. It is
@@ -648,7 +639,7 @@ struct font_driver
short, return -1. */
int (*otf_drive) (struct font *font, Lisp_Object features,
Lisp_Object gstring_in, int from, int to,
- Lisp_Object gstring_out, int idx, int alternate_subst);
+ Lisp_Object gstring_out, int idx, bool alternate_subst);
/* Optional.
Make the font driver ready for frame F. Usually this function
@@ -699,9 +690,9 @@ struct font_driver
Return non-zero if FONT_OBJECT can be used as a (cached) font
for ENTITY on frame F. */
- int (*cached_font_ok) (struct frame *f,
- Lisp_Object font_object,
- Lisp_Object entity);
+ bool (*cached_font_ok) (struct frame *f,
+ Lisp_Object font_object,
+ Lisp_Object entity);
};
@@ -711,9 +702,9 @@ struct font_driver
struct font_driver_list
{
- /* 1 iff this driver is currently used. It is ignored in the global
+ /* True iff this driver is currently used. It is ignored in the global
font driver list.*/
- int on;
+ bool on;
/* Pointer to the font driver. */
struct font_driver *driver;
/* Pointer to the next element of the chain. */
@@ -744,12 +735,12 @@ extern Lisp_Object find_font_encoding (Lisp_Object);
extern int font_registry_charsets (Lisp_Object, struct charset **,
struct charset **);
extern int font_style_to_value (enum font_property_index prop,
- Lisp_Object name, int noerror);
+ Lisp_Object name, bool noerror);
extern Lisp_Object font_style_symbolic (Lisp_Object font,
enum font_property_index prop,
- int for_face);
+ bool for_face);
-extern int font_match_p (Lisp_Object spec, Lisp_Object font);
+extern bool font_match_p (Lisp_Object spec, Lisp_Object font);
extern Lisp_Object font_list_entities (Lisp_Object frame,
Lisp_Object spec);
@@ -774,7 +765,7 @@ extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name);
extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
- int force_symbol);
+ bool force_symbol);
extern void font_update_sort_order (int *order);
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);
/* Prototype declarations for static functions. */
-static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
-static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *,
- int, int);
-static void reorder_font_vector (Lisp_Object, struct font *);
-static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int);
static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object);
-static Lisp_Object fontset_pattern_regexp (Lisp_Object);
-static void accumulate_script_ranges (Lisp_Object, Lisp_Object,
- Lisp_Object);
-static void set_fontset_font (Lisp_Object, Lisp_Object);
-/* Return 1 if ID is a valid fontset id, else return 0.
+/* Return true if ID is a valid fontset id.
Optimized away if ENABLE_CHECKING is not defined. */
-static int
+static bool
fontset_id_valid_p (int id)
{
return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
@@ -413,7 +404,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
Lisp_Object vec, font_object;
int size;
int i;
- int score_changed = 0;
+ bool score_changed = 0;
if (font)
XSETFONT (font_object, font);
@@ -544,10 +535,11 @@ fontset_get_font_group (Lisp_Object fontset, int c)
ID is a charset-id that must be preferred, or -1 meaning no
preference.
- If FALLBACK is nonzero, search only fallback fonts. */
+ If FALLBACK, search only fallback fonts. */
static Lisp_Object
-fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback)
+fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id,
+ bool fallback)
{
Lisp_Object vec, font_group;
int i, charset_matched = 0, found_index;
@@ -919,11 +911,11 @@ free_face_fontset (FRAME_PTR f, struct face *face)
#if 0
-/* Return 1 if FACE is suitable for displaying character C.
- Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
+/* 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. */
-int
+bool
face_suitable_for_char_p (struct face *face, int c)
{
Lisp_Object fontset, rfont_def;
@@ -1470,7 +1462,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
Lisp_Object range_list;
struct charset *charset = NULL;
Lisp_Object fontname;
- int ascii_changed = 0;
+ bool ascii_changed = 0;
fontset = check_fontset_name (name, &frame);
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;
static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif;
/* Flag to tell if FcInit is already called or not. */
-static int fc_initialized;
+static bool fc_initialized;
/* Handle to a FreeType library instance. */
static FT_Library ft_library;
@@ -65,7 +65,7 @@ struct ftfont_info
#ifdef HAVE_LIBOTF
/* The following four members must be here in this order to be
compatible with struct xftfont_info (in xftfont.c). */
- int maybe_otf; /* Flag to tell if this may be OTF or not. */
+ bool maybe_otf; /* Flag to tell if this may be OTF or not. */
OTF *otf;
#endif /* HAVE_LIBOTF */
FT_Size ft_size;
@@ -543,9 +543,9 @@ struct font_driver ftfont_driver =
/* We can't draw a text without device dependent functions. */
NULL, /* draw */
ftfont_get_bitmap,
- NULL, /* get_bitmap */
NULL, /* free_bitmap */
NULL, /* get_outline */
+ NULL, /* free_outline */
ftfont_anchor_point,
#ifdef HAVE_LIBOTF
ftfont_otf_capability,
@@ -661,7 +661,8 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
{
struct OpenTypeSpec *spec = malloc (sizeof *spec);
Lisp_Object val;
- int i, j, negative;
+ int i, j;
+ bool negative;
if (! spec)
return NULL;
@@ -1185,7 +1186,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
FT_Size ft_size;
FT_UInt size;
Lisp_Object val, filename, idx, cache, font_object;
- int scalable;
+ bool scalable;
int spacing;
char name[256];
int i, len;
@@ -1243,7 +1244,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
ftfont_info->ft_size = ft_face->size;
ftfont_info->index = XINT (idx);
#ifdef HAVE_LIBOTF
- ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
+ ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
ftfont_info->otf = NULL;
#endif /* HAVE_LIBOTF */
/* 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
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
FT_Face ft_face = ftfont_info->ft_size->face;
int width = 0;
- int i, first;
+ int i;
+ bool first;
if (ftfont_info->ft_size != ft_face->size)
FT_Activate_Size (ftfont_info->ft_size);
@@ -1682,10 +1684,12 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec)
struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
OTF *otf = flt_font_ft->otf;
OTF_Tag *tags;
- int i, n, negative;
+ int i, n;
+ bool negative;
if (FEATURE_ANY (0) && FEATURE_ANY (1))
- /* Return 1 iff any of GSUB or GPOS support the script (and language). */
+ /* Return true iff any of GSUB or GPOS support the script (and
+ language). */
return (otf
&& (OTF_check_features (otf, 0, spec->script, spec->langsys,
NULL, 0) > 0
@@ -2390,7 +2394,7 @@ ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in,
static MFLTGlyphString gstring;
-static int m17n_flt_initialized;
+static bool m17n_flt_initialized;
static Lisp_Object
ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
@@ -2400,7 +2404,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
ptrdiff_t i;
struct MFLTFontFT flt_font_ft;
MFLT *flt = NULL;
- int with_variation_selector = 0;
+ bool with_variation_selector = 0;
if (! m17n_flt_initialized)
{
@@ -2421,7 +2425,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
break;
c = LGLYPH_CHAR (g);
if (CHAR_VARIATION_SELECTOR_P (c))
- with_variation_selector++;
+ with_variation_selector = 1;
}
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
#endif
struct font_driver ftxfont_driver;
-/* Prototypes for helper function. */
-static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long);
-static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *,
- unsigned, int, int, XPoint *, int, int *,
- int);
-static void ftxfont_draw_background (FRAME_PTR, struct font *, GC,
- int, int, int);
-
struct ftxfont_frame_data
{
/* Background and foreground colors. */
@@ -143,7 +135,9 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
}
static int
-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)
+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, bool flush)
{
struct font_bitmap bitmap;
unsigned char *b;
@@ -232,13 +226,6 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground);
}
-/* Prototypes for font-driver methods. */
-static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object);
-static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object);
-static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int);
-static void ftxfont_close (FRAME_PTR, struct font *);
-static int ftxfont_draw (struct glyph_string *, int, int, int, int, int);
-
static Lisp_Object
ftxfont_list (Lisp_Object frame, Lisp_Object spec)
{
@@ -280,7 +267,8 @@ ftxfont_close (FRAME_PTR f, struct font *font)
}
static int
-ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
FRAME_PTR f = s->f;
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);
static int nsfont_text_extents (struct font *font, unsigned int *code,
int nglyphs, struct font_metrics *metrics);
static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
- int with_background);
+ bool with_background);
struct font_driver nsfont_driver =
{
@@ -833,7 +833,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
font = (struct font *) font_info;
font->pixel_size = [sfont pointSize];
font->driver = &nsfont_driver;
- font->encoding_type = FONT_ENCODING_NOT_DECIDED;
font->encoding_charset = -1;
font->repertory_charset = -1;
font->default_ascent = 0;
@@ -1042,12 +1041,12 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
/* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel
- position of frame F with S->FACE and S->GC. If WITH_BACKGROUND
- is nonzero, fill the background in advance. It is assured that
- WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars). */
static int
nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
- int with_background)
+ bool with_background)
/* NOTE: focus and clip must be set
also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */
{
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,
/* w32 implementation of draw for font backend.
Optional.
Draw glyphs between FROM and TO of S->char2b at (X Y) pixel
- position of frame F with S->FACE and S->GC. If WITH_BACKGROUND
- is nonzero, fill the background in advance. It is assured that
- WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars).
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars).
TODO: Currently this assumes that the colors and fonts are already
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,
int
w32font_draw (struct glyph_string *s, int from, int to,
- int x, int y, int with_background)
+ int x, int y, bool with_background)
{
UINT options;
HRGN orig_clip = NULL;
@@ -804,7 +804,7 @@ static int
w32font_otf_drive (struct font *font, Lisp_Object features,
Lisp_Object gstring_in, int from, int to,
Lisp_Object gstring_out, int idx,
- int alternate_subst);
+ bool alternate_subst);
*/
/* Internal implementation of w32font_list.
@@ -987,7 +987,6 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth;
font->vertical_centering = 0;
- font->encoding_type = 0;
font->baseline_offset = 0;
font->relative_compose = 0;
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);
int w32font_text_extents (struct font *font, unsigned *code, int nglyphs,
struct font_metrics *metrics);
int w32font_draw (struct glyph_string *s, int from, int to,
- int x, int y, int with_background);
+ int x, int y, bool with_background);
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);
static unsigned xfont_encode_char (struct font *, int);
static int xfont_text_extents (struct font *, unsigned *, int,
struct font_metrics *);
-static int xfont_draw (struct glyph_string *, int, int, int, int, int);
+static int xfont_draw (struct glyph_string *, int, int, int, int, bool);
static int xfont_check (FRAME_PTR, struct font *);
struct font_driver xfont_driver =
@@ -217,9 +217,9 @@ xfont_encode_coding_xlfd (char *xlfd)
/* Check if CHARS (cons or vector) is supported by XFONT whose
encoding charset is ENCODING (XFONT is NULL) or by a font whose
registry corresponds to ENCODING and REPERTORY.
- Return 1 if supported, return 0 otherwise. */
+ Return true if supported. */
-static int
+static bool
xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont,
struct charset *encoding, struct charset *repertory)
{
@@ -1019,7 +1019,8 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f
}
static int
-xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont;
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
for (i = 0; i < len ; i++)
str[i] = XCHAR2B_BYTE2 (s->char2b + from + i);
BLOCK_INPUT;
- if (with_background > 0)
+ if (with_background)
{
if (s->padding_p)
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
}
BLOCK_INPUT;
- if (with_background > 0)
+ if (with_background)
{
if (s->padding_p)
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
/* The following five members must be here in this order to be
compatible with struct ftfont_info (in ftfont.c). */
#ifdef HAVE_LIBOTF
- int maybe_otf; /* Flag to tell if this may be OTF or not. */
+ bool maybe_otf; /* Flag to tell if this may be OTF or not. */
OTF *otf;
#endif /* HAVE_LIBOTF */
FT_Size ft_size;
@@ -92,7 +92,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
else
{
XGCValues xgcv;
- int fg_done = 0, bg_done = 0;
+ bool fg_done = 0, bg_done = 0;
BLOCK_INPUT;
XGetGCValues (FRAME_X_DISPLAY (f), gc,
@@ -111,7 +111,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
*bg = xftface_info->xft_fg, bg_done = 1;
}
- if (fg_done + bg_done < 2)
+ if (! (fg_done & bg_done))
{
XColor colors[2];
@@ -137,19 +137,6 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
}
-static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object);
-static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object);
-static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int);
-static void xftfont_close (FRAME_PTR, struct font *);
-static int xftfont_prepare_face (FRAME_PTR, struct face *);
-static void xftfont_done_face (FRAME_PTR, struct face *);
-static int xftfont_has_char (Lisp_Object, int);
-static unsigned xftfont_encode_char (struct font *, int);
-static int xftfont_text_extents (struct font *, unsigned *, int,
- struct font_metrics *);
-static int xftfont_draw (struct glyph_string *, int, int, int, int, int);
-static int xftfont_end_for_frame (FRAME_PTR f);
-
struct font_driver xftfont_driver;
static Lisp_Object
@@ -470,7 +457,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
font->underline_thickness = 0;
}
#ifdef HAVE_LIBOTF
- xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
+ xftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
xftfont_info->otf = NULL;
#endif /* HAVE_LIBOTF */
xftfont_info->ft_size = ft_face->size;
@@ -630,7 +617,8 @@ xftfont_get_xft_draw (FRAME_PTR f)
}
static int
-xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
FRAME_PTR f = s->f;
struct face *face = s->face;
@@ -711,15 +699,17 @@ xftfont_end_for_frame (FRAME_PTR f)
return 0;
}
-static int
-xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity)
+static bool
+xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object,
+ Lisp_Object entity)
{
struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object);
FcPattern *oldpat = info->xftfont->pattern;
Display *display = FRAME_X_DISPLAY (f);
FcPattern *pat = FcPatternCreate ();
FcBool b1, b2;
- int ok = 0, i1, i2, r1, r2;
+ bool ok = 0;
+ int i1, i2, r1, r2;
xftfont_add_rendering_parameters (pat, entity);
XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);