shithub: freetype+ttf2subf

Download patch

ref: 41c2ed8143c36badb594fbe52a920947bd980539
parent: 25c2f8820fe9585e14463d83dd394facbefafc35
author: Werner Lemberg <[email protected]>
date: Sun Feb 22 10:57:47 EST 2015

[pshinter] Use macros for (unsigned) flags, not enumerations.

* src/pshinter/pshalgo.h (PSH_Hint_Flags): Replace with macros.
Updated.
* src/pshinter/pshrec.h (PS_Hint_Flags): Replace with macros.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2015-02-22  Werner Lemberg  <[email protected]>
 
+	[pshinter] Use macros for (unsigned) flags, not enumerations.
+
+	* src/pshinter/pshalgo.h (PSH_Hint_Flags): Replace with macros.
+	Updated.
+	* src/pshinter/pshrec.h (PS_Hint_Flags): Replace with macros.
+
+2015-02-22  Werner Lemberg  <[email protected]>
+
 	* src/pshinter/pshrec.c: Simplify.
 	(ps_hints_open, ps_hints_stem): Remove switch statement.
 
--- a/src/pshinter/pshalgo.h
+++ b/src/pshinter/pshalgo.h
@@ -30,17 +30,14 @@
   /* handle to Hint structure */
   typedef struct PSH_HintRec_*  PSH_Hint;
 
+
   /* hint bit-flags */
-  typedef enum  PSH_Hint_Flags_
-  {
-    PSH_HINT_GHOST  = PS_HINT_FLAG_GHOST,
-    PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
-    PSH_HINT_ACTIVE = 4,
-    PSH_HINT_FITTED = 8
+#define PSH_HINT_GHOST   PS_HINT_FLAG_GHOST
+#define PSH_HINT_BOTTOM  PS_HINT_FLAG_BOTTOM
+#define PSH_HINT_ACTIVE  4U
+#define PSH_HINT_FITTED  8U
 
-  } PSH_Hint_Flags;
 
-
 #define psh_hint_is_active( x )  ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )
 #define psh_hint_is_ghost( x )   ( ( (x)->flags & PSH_HINT_GHOST  ) != 0 )
 #define psh_hint_is_fitted( x )  ( ( (x)->flags & PSH_HINT_FITTED ) != 0 )
@@ -49,6 +46,7 @@
 #define psh_hint_deactivate( x )  (x)->flags &= ~PSH_HINT_ACTIVE
 #define psh_hint_set_fitted( x )  (x)->flags |=  PSH_HINT_FITTED
 
+
   /* hint structure */
   typedef struct  PSH_HintRec_
   {
@@ -112,15 +110,13 @@
 #define PSH_DIR_IS_VERTICAL( d )    PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
 
 
- /* the following bit-flags are computed once by the glyph */
- /* analyzer, for both dimensions                          */
-  enum
-  {
-    PSH_POINT_OFF    = 1,   /* point is off the curve */
-    PSH_POINT_SMOOTH = 2,   /* point is smooth        */
-    PSH_POINT_INFLEX = 4    /* point is inflection    */
-  };
+  /* the following bit-flags are computed once by the glyph */
+  /* analyzer, for both dimensions                          */
+#define PSH_POINT_OFF     1U      /* point is off the curve */
+#define PSH_POINT_SMOOTH  2U      /* point is smooth        */
+#define PSH_POINT_INFLEX  4U      /* point is inflection    */
 
+
 #define psh_point_is_smooth( p )  ( (p)->flags & PSH_POINT_SMOOTH )
 #define psh_point_is_off( p )     ( (p)->flags & PSH_POINT_OFF    )
 #define psh_point_is_inflex( p )  ( (p)->flags & PSH_POINT_INFLEX )
@@ -129,17 +125,16 @@
 #define psh_point_set_off( p )     (p)->flags |= PSH_POINT_OFF
 #define psh_point_set_inflex( p )  (p)->flags |= PSH_POINT_INFLEX
 
+
   /* the following bit-flags are re-computed for each dimension */
-  enum
-  {
-    PSH_POINT_STRONG   = 16,   /* point is strong                           */
-    PSH_POINT_FITTED   = 32,   /* point is already fitted                   */
-    PSH_POINT_EXTREMUM = 64,   /* point is local extremum                   */
-    PSH_POINT_POSITIVE = 128,  /* extremum has positive contour flow        */
-    PSH_POINT_NEGATIVE = 256,  /* extremum has negative contour flow        */
-    PSH_POINT_EDGE_MIN = 512,  /* point is aligned to left/bottom stem edge */
-    PSH_POINT_EDGE_MAX = 1024  /* point is aligned to top/right stem edge   */
-  };
+#define PSH_POINT_STRONG      16U /* point is strong                           */
+#define PSH_POINT_FITTED      32U /* point is already fitted                   */
+#define PSH_POINT_EXTREMUM    64U /* point is local extremum                   */
+#define PSH_POINT_POSITIVE   128U /* extremum has positive contour flow        */
+#define PSH_POINT_NEGATIVE   256U /* extremum has negative contour flow        */
+#define PSH_POINT_EDGE_MIN   512U /* point is aligned to left/bottom stem edge */
+#define PSH_POINT_EDGE_MAX  1024U /* point is aligned to top/right stem edge   */
+
 
 #define psh_point_is_strong( p )    ( (p)->flags2 & PSH_POINT_STRONG )
 #define psh_point_is_fitted( p )    ( (p)->flags2 & PSH_POINT_FITTED )
--- a/src/pshinter/pshrec.h
+++ b/src/pshinter/pshrec.h
@@ -61,12 +61,8 @@
 
 
   /* hint flags */
-  typedef enum  PS_Hint_Flags_
-  {
-    PS_HINT_FLAG_GHOST  = 1,
-    PS_HINT_FLAG_BOTTOM = 2
-
-  } PS_Hint_Flags;
+#define PS_HINT_FLAG_GHOST   1U
+#define PS_HINT_FLAG_BOTTOM  2U
 
 
   /* hint descriptor */