shithub: freetype+ttf2subf

Download patch

ref: f5fe6e2f17d2326c637d8ccd18af219709d15bcd
parent: 50486df1e6a9a66d5df287efea94b8c1c14a1084
author: Alexei Podtelezhnikov <[email protected]>
date: Mon Aug 13 05:01:53 EDT 2018

[bdf] Use unsigned types.

* src/bdf/bdf.h (bdf_glyph_t): Unsign `encoding'.
(bdf_font_t): Unsign `default_char'.
* src/bdf/bdfdrivr.h (BDF_encoding_el): Unsign `enc'.

* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_glyphs,
_bdf_parse_start): Updated accordingly.
* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Ditto.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-08-13  Alexei Podtelezhnikov  <[email protected]>
+
+	[bdf] Use unsigned types.
+
+	* src/bdf/bdf.h (bdf_glyph_t): Unsign `encoding'.
+	(bdf_font_t): Unsign `default_char'.
+	* src/bdf/bdfdrivr.h (BDF_encoding_el): Unsign `enc'.
+
+	* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_glyphs,
+	_bdf_parse_start): Updated accordingly.
+	* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Ditto.
+
 2018-08-13  Werner Lemberg  <[email protected]>
 
 	* src/type42/t42parse.c (t42_parse_sfnts): One more format check.
@@ -97,7 +109,7 @@
 
 	* src/pcf/pcf.h (PCF_ParsePropertyRec): Use unsigned `name' and
 	`value'.
-	* src/pcf/pcfread.c (pcf_get_propeerties, pcf_load_font): Updated
+	* src/pcf/pcfread.c (pcf_get_properties, pcf_load_font): Updated
 	parsing code and handling of AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE,
 	RESOLUTION_X and RESOLUTION_Y.
 
--- a/src/bdf/bdf.h
+++ b/src/bdf/bdf.h
@@ -147,7 +147,7 @@
   typedef struct  bdf_glyph_t_
   {
     char*           name;        /* Glyph name.                          */
-    long            encoding;    /* Glyph encoding.                      */
+    unsigned long   encoding;    /* Glyph encoding.                      */
     unsigned short  swidth;      /* Scalable width.                      */
     unsigned short  dwidth;      /* Device width.                        */
     bdf_bbx_t       bbx;         /* Glyph bounding box.                  */
@@ -185,7 +185,7 @@
 
     unsigned short   monowidth;      /* Logical width for monowidth font.   */
 
-    long             default_char;   /* Encoding of the default glyph.      */
+    unsigned long    default_char;   /* Encoding of the default glyph.      */
 
     long             font_ascent;    /* Font ascent.                        */
     long             font_descent;   /* Font descent.                       */
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -106,7 +106,7 @@
 
 
       mid  = ( min + max ) >> 1;
-      code = (FT_ULong)encodings[mid].enc;
+      code = encodings[mid].enc;
 
       if ( charcode == code )
       {
@@ -146,7 +146,7 @@
 
 
       mid  = ( min + max ) >> 1;
-      code = (FT_ULong)encodings[mid].enc;
+      code = encodings[mid].enc;
 
       if ( charcode == code )
       {
@@ -165,7 +165,7 @@
     charcode = 0;
     if ( min < cmap->num_encodings )
     {
-      charcode = (FT_ULong)encodings[min].enc;
+      charcode = encodings[min].enc;
       result   = encodings[min].glyph + 1;
     }
 
--- a/src/bdf/bdfdrivr.h
+++ b/src/bdf/bdfdrivr.h
@@ -39,7 +39,7 @@
 
   typedef struct  BDF_encoding_el_
   {
-    FT_Long    enc;
+    FT_ULong   enc;
     FT_UShort  glyph;
 
   } BDF_encoding_el;
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -197,10 +197,10 @@
 #define ACMSG10  "DWIDTH field missing at line %ld.  Set to glyph width.\n"
 #define ACMSG11  "SIZE bits per pixel field adjusted to %hd.\n"
 #define ACMSG12  "Duplicate encoding %ld (%s) changed to unencoded.\n"
-#define ACMSG13  "Glyph %ld extra rows removed.\n"
-#define ACMSG14  "Glyph %ld extra columns removed.\n"
+#define ACMSG13  "Glyph %lu extra rows removed.\n"
+#define ACMSG14  "Glyph %lu extra columns removed.\n"
 #define ACMSG15  "Incorrect glyph count: %ld indicated but %ld found.\n"
-#define ACMSG16  "Glyph %ld missing columns padded with zero bits.\n"
+#define ACMSG16  "Glyph %lu missing columns padded with zero bits.\n"
 #define ACMSG17  "Adjusting number of glyphs to %ld.\n"
 
   /* Error messages. */
@@ -1232,7 +1232,7 @@
     /* present, and the SPACING property should override the default       */
     /* spacing.                                                            */
     if ( _bdf_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-      font->default_char = fp->value.l;
+      font->default_char = fp->value.ul;
     else if ( _bdf_strncmp( name, "FONT_ASCENT", 11 ) == 0 )
       font->font_ascent = fp->value.l;
     else if ( _bdf_strncmp( name, "FONT_DESCENT", 12 ) == 0 )
@@ -1508,7 +1508,7 @@
 
         glyph           = font->glyphs + font->glyphs_used++;
         glyph->name     = p->glyph_name;
-        glyph->encoding = p->glyph_enc;
+        glyph->encoding = (unsigned long)p->glyph_enc;
 
         /* Reset the initial glyph info. */
         p->glyph_name = NULL;
@@ -1532,7 +1532,7 @@
 
           glyph           = font->unencoded + font->unencoded_used;
           glyph->name     = p->glyph_name;
-          glyph->encoding = (long)font->unencoded_used++;
+          glyph->encoding = font->unencoded_used++;
 
           /* Reset the initial glyph info. */
           p->glyph_name = NULL;
@@ -1983,7 +1983,7 @@
       if ( error )
         goto Exit;
       p->font->spacing      = p->opts->font_spacing;
-      p->font->default_char = -1;
+      p->font->default_char = ~0UL;
 
       goto Exit;
     }