shithub: freetype+ttf2subf

Download patch

ref: 31dc8f98f6ab7d8091d43a76937b0d01adc8de5c
parent: f73a993750e28d0763db63c547d9761d49c96971
author: Werner Lemberg <[email protected]>
date: Tue Mar 29 04:37:07 EDT 2016

* src/pfr/pfrtypes.h: Replace all enums with macros.

We need `~FOO' to unset bits, and only with unsigned values (which
`enum' isn't normally) this works cleanly.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-29  Werner Lemberg  <[email protected]>
+
+	* src/pfr/pfrtypes.h: Replace all enums with macros.
+
+	We need `~FOO' to unset bits, and only with unsigned values (which
+	`enum' isn't normally) this works cleanly.
+
 2016-03-26  Werner Lemberg  <[email protected]>
 
 	[pfr] Robustify bitmap strike handling (#47514).
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -377,7 +377,7 @@
         if ( flags & PFR_LOG_2BYTE_STROKE )
           local++;
 
-        if ( (flags & PFR_LINE_JOIN_MASK) == PFR_LINE_JOIN_MITER )
+        if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )
           local += 3;
       }
       if ( flags & PFR_LOG_BOLD )
--- a/src/pfr/pfrtypes.h
+++ b/src/pfr/pfrtypes.h
@@ -69,14 +69,10 @@
 
 
   /* used in `color_flags' field of the PFR_Header */
-  typedef enum  PFR_HeaderFlags_
-  {
-    PFR_FLAG_BLACK_PIXEL   = 1,
-    PFR_FLAG_INVERT_BITMAP = 2
+#define PFR_FLAG_BLACK_PIXEL    0x01U
+#define PFR_FLAG_INVERT_BITMAP  0x02U
 
-  } PFR_HeaderFlags;
 
-
   /************************************************************************/
 
   typedef struct  PFR_LogFontRec_
@@ -96,42 +92,29 @@
   } PFR_LogFontRec, *PFR_LogFont;
 
 
-  typedef enum  PFR_LogFlags_
-  {
-    PFR_LOG_EXTRA_ITEMS  = 0x40,
-    PFR_LOG_2BYTE_BOLD   = 0x20,
-    PFR_LOG_BOLD         = 0x10,
-    PFR_LOG_2BYTE_STROKE = 8,
-    PFR_LOG_STROKE       = 4,
-    PFR_LINE_JOIN_MASK   = 3
+#define PFR_LINE_JOIN_MITER   0x00U
+#define PFR_LINE_JOIN_ROUND   0x01U
+#define PFR_LINE_JOIN_BEVEL   0x02U
+#define PFR_LINE_JOIN_MASK    ( PFR_LINE_JOIN_ROUND | PFR_LINE_JOIN_BEVEL )
 
-  } PFR_LogFlags;
+#define PFR_LOG_STROKE        0x04U
+#define PFR_LOG_2BYTE_STROKE  0x08U
+#define PFR_LOG_BOLD          0x10U
+#define PFR_LOG_2BYTE_BOLD    0x20U
+#define PFR_LOG_EXTRA_ITEMS   0x40U
 
 
-  typedef enum  PFR_LineJoinFlags_
-  {
-    PFR_LINE_JOIN_MITER = 0,
-    PFR_LINE_JOIN_ROUND = 1,
-    PFR_LINE_JOIN_BEVEL = 2
-
-  } PFR_LineJoinFlags;
-
-
   /************************************************************************/
 
-  typedef enum  PFR_BitmapFlags_
-  {
-    /* not part of the specification but used for implementation */
-    PFR_BITMAP_VALID_CHARCODES     = 0x80,
-    PFR_BITMAP_CHARCODES_VALIDATED = 0x40,
+#define PFR_BITMAP_2BYTE_CHARCODE  0x01U
+#define PFR_BITMAP_2BYTE_SIZE      0x02U
+#define PFR_BITMAP_3BYTE_OFFSET    0x04U
 
-    PFR_BITMAP_3BYTE_OFFSET   = 4,
-    PFR_BITMAP_2BYTE_SIZE     = 2,
-    PFR_BITMAP_2BYTE_CHARCODE = 1
+  /*not part of the specification but used for implementation */
+#define PFR_BITMAP_CHARCODES_VALIDATED  0x40U
+#define PFR_BITMAP_VALID_CHARCODES      0x80U
 
-  } PFR_BitmapFlags;
 
-
   typedef struct  PFR_BitmapCharRec_
   {
     FT_UInt    char_code;
@@ -141,17 +124,13 @@
   } PFR_BitmapCharRec, *PFR_BitmapChar;
 
 
-  typedef enum  PFR_StrikeFlags_
-  {
-    PFR_STRIKE_2BYTE_COUNT  = 0x10,
-    PFR_STRIKE_3BYTE_OFFSET = 0x08,
-    PFR_STRIKE_3BYTE_SIZE   = 0x04,
-    PFR_STRIKE_2BYTE_YPPM   = 0x02,
-    PFR_STRIKE_2BYTE_XPPM   = 0x01
+#define PFR_STRIKE_2BYTE_XPPM    0x01U
+#define PFR_STRIKE_2BYTE_YPPM    0x02U
+#define PFR_STRIKE_3BYTE_SIZE    0x04U
+#define PFR_STRIKE_3BYTE_OFFSET  0x08U
+#define PFR_STRIKE_2BYTE_COUNT   0x10U
 
-  } PFR_StrikeFlags;
 
-
   typedef struct  PFR_StrikeRec_
   {
     FT_UInt         x_ppm;
@@ -270,43 +249,31 @@
   } PFR_PhyFontRec, *PFR_PhyFont;
 
 
-  typedef enum  PFR_PhyFlags_
-  {
-    PFR_PHY_EXTRA_ITEMS      = 0x80,
-    PFR_PHY_3BYTE_GPS_OFFSET = 0x20,
-    PFR_PHY_2BYTE_GPS_SIZE   = 0x10,
-    PFR_PHY_ASCII_CODE       = 0x08,
-    PFR_PHY_PROPORTIONAL     = 0x04,
-    PFR_PHY_2BYTE_CHARCODE   = 0x02,
-    PFR_PHY_VERTICAL         = 0x01
+#define PFR_PHY_VERTICAL          0x01U
+#define PFR_PHY_2BYTE_CHARCODE    0x02U
+#define PFR_PHY_PROPORTIONAL      0x04U
+#define PFR_PHY_ASCII_CODE        0x08U
+#define PFR_PHY_2BYTE_GPS_SIZE    0x10U
+#define PFR_PHY_3BYTE_GPS_OFFSET  0x20U
+#define PFR_PHY_EXTRA_ITEMS       0x80U
 
-  } PFR_PhyFlags;
 
+#define PFR_KERN_2BYTE_CHAR  0x01U
+#define PFR_KERN_2BYTE_ADJ   0x02U
 
-  typedef enum PFR_KernFlags_
-  {
-    PFR_KERN_2BYTE_CHAR  = 0x01,
-    PFR_KERN_2BYTE_ADJ   = 0x02
 
-  } PFR_KernFlags;
-
-
   /************************************************************************/
 
-  typedef enum  PFR_GlyphFlags_
-  {
-    PFR_GLYPH_IS_COMPOUND = 0x80,
+#define PFR_GLYPH_YCOUNT         0x01U
+#define PFR_GLYPH_XCOUNT         0x02U
+#define PFR_GLYPH_1BYTE_XYCOUNT  0x04U
 
-    PFR_GLYPH_SINGLE_EXTRA_ITEMS   = 0x08,
-    PFR_GLYPH_COMPOUND_EXTRA_ITEMS = 0x40,
+#define PFR_GLYPH_SINGLE_EXTRA_ITEMS    0x08U
+#define PFR_GLYPH_COMPOUND_EXTRA_ITEMS  0x40U
 
-    PFR_GLYPH_1BYTE_XYCOUNT = 0x04,
-    PFR_GLYPH_XCOUNT        = 0x02,
-    PFR_GLYPH_YCOUNT        = 0x01
+#define PFR_GLYPH_IS_COMPOUND  0x80U
 
-  } PFR_GlyphFlags;
 
-
   /* controlled coordinate */
   typedef struct  PFR_CoordRec_
   {
@@ -328,14 +295,10 @@
   } PFR_SubGlyphRec, *PFR_SubGlyph;
 
 
-  typedef enum  PFR_SubgGlyphFlags_
-  {
-    PFR_SUBGLYPH_3BYTE_OFFSET = 0x80,
-    PFR_SUBGLYPH_2BYTE_SIZE   = 0x40,
-    PFR_SUBGLYPH_YSCALE       = 0x20,
-    PFR_SUBGLYPH_XSCALE       = 0x10
-
-  } PFR_SubGlyphFlags;
+#define PFR_SUBGLYPH_XSCALE        0x10U
+#define PFR_SUBGLYPH_YSCALE        0x20U
+#define PFR_SUBGLYPH_2BYTE_SIZE    0x40U
+#define PFR_SUBGLYPH_3BYTE_OFFSET  0x80U
 
 
   typedef struct  PFR_GlyphRec_