emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109899: Use bool for booleans in fon


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109899: Use bool for booleans in font-related modules.
Date: Thu, 06 Sep 2012 01:04:49 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109899
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2012-09-06 01:04:49 -0700
message:
  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.
modified:
  src/ChangeLog
  src/font.c
  src/font.h
  src/fontset.c
  src/ftfont.c
  src/ftxfont.c
  src/nsfont.m
  src/w32font.c
  src/w32font.h
  src/xfont.c
  src/xftfont.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-06 07:10:25 +0000
+++ b/src/ChangeLog     2012-09-06 08:04:49 +0000
@@ -1,3 +1,28 @@
+2012-09-06  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * alloc.c (mark_object): Revert window marking code

=== modified file 'src/font.c'
--- a/src/font.c        2012-09-01 06:38:52 +0000
+++ b/src/font.c        2012-09-06 08:04:49 +0000
@@ -216,13 +216,12 @@
 
 
 /* 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 @@
    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 @@
 }
 
 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 @@
     }
   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 @@
        }
       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 @@
 {
   Lisp_Object val;
   char *p;
-  int asterisk;
+  bool asterisk;
 
   p = features;
   *p = '\0';
@@ -2302,11 +2303,12 @@
     }
 }
 
-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 @@
 
 /* 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 @@
 /* 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 @@
   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 @@
 {
   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 @@
         Lisp_Object string)
 {
   FRAME_PTR f;
-  int multibyte;
+  bool multibyte;
   Lisp_Object font_object;
 
   multibyte = (NILP (string)

=== modified file 'src/font.h'
--- a/src/font.h        2012-09-02 16:56:31 +0000
+++ b/src/font.h        2012-09-06 08:04:49 +0000
@@ -320,19 +320,10 @@
      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 @@
   /* 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 @@
 
   /* 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 @@
      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 @@
 
      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_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 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_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,

=== modified file 'src/fontset.c'
--- a/src/fontset.c     2012-08-22 07:20:42 +0000
+++ b/src/fontset.c     2012-09-06 08:04:49 +0000
@@ -185,21 +185,12 @@
 
 
 /* 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 @@
   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 @@
    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 @@
 
 
 #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 @@
   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);
 

=== modified file 'src/ftfont.c'
--- a/src/ftfont.c      2012-09-04 17:34:54 +0000
+++ b/src/ftfont.c      2012-09-06 08:04:49 +0000
@@ -45,7 +45,7 @@
 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 @@
 #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 @@
     /* 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 @@
 {
   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 @@
   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_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 @@
   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 @@
   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 @@
 
 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 @@
   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 @@
        break;
       c = LGLYPH_CHAR (g);
       if (CHAR_VARIATION_SELECTOR_P (c))
-       with_variation_selector++;
+       with_variation_selector = 1;
     }
 
   len = i;

=== modified file 'src/ftxfont.c'
--- a/src/ftxfont.c     2012-07-05 18:35:48 +0000
+++ b/src/ftxfont.c     2012-09-06 08:04:49 +0000
@@ -43,14 +43,6 @@
 #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 @@
 }
 
 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 @@
   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 @@
 }
 
 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;

=== modified file 'src/nsfont.m'
--- a/src/nsfont.m      2012-09-04 17:34:54 +0000
+++ b/src/nsfont.m      2012-09-06 08:04:49 +0000
@@ -625,7 +625,7 @@
 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 @@
   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 @@
 
 
 /* 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 */
 {

=== modified file 'src/w32font.c'
--- a/src/w32font.c     2012-08-15 14:20:16 +0000
+++ b/src/w32font.c     2012-09-06 08:04:49 +0000
@@ -635,9 +635,9 @@
 /* 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 @@
 
 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 @@
 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 @@
   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;

=== modified file 'src/w32font.h'
--- a/src/w32font.h     2012-09-01 06:38:52 +0000
+++ b/src/w32font.h     2012-09-06 08:04:49 +0000
@@ -77,7 +77,7 @@
 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);

=== modified file 'src/xfont.c'
--- a/src/xfont.c       2012-09-02 16:56:31 +0000
+++ b/src/xfont.c       2012-09-06 08:04:49 +0000
@@ -126,7 +126,7 @@
 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 @@
 /* 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 @@
 }
 
 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 @@
       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 @@
     }
 
   BLOCK_INPUT;
-  if (with_background > 0)
+  if (with_background)
     {
       if (s->padding_p)
        for (i = 0; i < len; i++)

=== modified file 'src/xftfont.c'
--- a/src/xftfont.c     2012-08-16 06:57:48 +0000
+++ b/src/xftfont.c     2012-09-06 08:04:49 +0000
@@ -52,7 +52,7 @@
   /* 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 @@
   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 @@
            *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 @@
 }
 
 
-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 @@
       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 @@
 }
 
 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 @@
   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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]