shithub: freetype+ttf2subf

Download patch

ref: 233302a83f073f297d8ca58e4e31a7eac07a0fc7
parent: b1859049e2d7631c48dd738d5e10b92777a61d6c
author: Werner Lemberg <[email protected]>
date: Wed May 22 01:41:06 EDT 2002

* include/freetype/config/ftheader.h (FT_BEZIER_H): Removed.
(FT_BDF_H): New macro for accessing `ftbdf.h'.

* src/type42/t42drivr.c (hexval): Fix typo.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-05-22  Werner Lemberg  <[email protected]>
+
+	* include/freetype/config/ftheader.h (FT_BEZIER_H): Removed.
+	(FT_BDF_H): New macro for accessing `ftbdf.h'.
+
+	* src/type42/t42drivr.c (hexval): Fix typo.
+
 2002-05-21  Martin Muskens  <[email protected]>
 
 	* src/psaux/psobjs.c (T1Radix): New function.
@@ -8,12 +15,13 @@
 
 2002-05-21  David Turner  <[email protected]>
 
-	* src/bdf/bdflic.c: Removed compiler warning, and changed all tables
+	* src/bdf/bdflib.c: Removed compiler warning, and changed all tables
 	to the "static const" storage specifier (instead of simply
 	`static').
 
-	* src/type42/t32drivr.c, src/bdf/bdfdrivr.c: Removing compiler
-	warnings.
+	* src/type42/t42drivr.c (hexval): Use more efficient code.
+	Removing compiler warnings.
+	* src/bdf/bdfdrivr.c: Removing compiler warnings.
 
 	* include/freetype/internal/ftbdf.h, src/base/ftbdf.c,
 	src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -352,38 +352,38 @@
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
-  /*    FT_GLYPH_H                                                         */
+  /*    FT_BDF_H                                                           */
   /*                                                                       */
   /* @description:                                                         */
   /*    A macro used in #include statements to name the file containing    */
-  /*    the API of the optional glyph management component.                */
+  /*    the definitions of an API to access BDF-specific strings from a    */
+  /*    face.                                                              */
   /*                                                                       */
-#define FT_GLYPH_H  <freetype/ftglyph.h>
+#define FT_BDF_H  <freetype/ftbdf.h>
 
 
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
-  /*    FT_BBOX_H                                                          */
+  /*    FT_GLYPH_H                                                         */
   /*                                                                       */
   /* @description:                                                         */
   /*    A macro used in #include statements to name the file containing    */
-  /*    the API of the optional exact bounding box computation routines.   */
+  /*    the API of the optional glyph management component.                */
   /*                                                                       */
-#define FT_BBOX_H  <freetype/ftbbox.h>
+#define FT_GLYPH_H  <freetype/ftglyph.h>
 
 
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
-  /*    FT_BEZIER_H                                                        */
+  /*    FT_BBOX_H                                                          */
   /*                                                                       */
   /* @description:                                                         */
   /*    A macro used in #include statements to name the file containing    */
-  /*    a small useful API to handle bezier arcs.  Note that you _must_    */
-  /*    include FT_FREETYPE_H or FT_IMAGE_H before this header.            */
+  /*    the API of the optional exact bounding box computation routines.   */
   /*                                                                       */
-#define FT_BEZIER_H  <freetype/ftbezier.h>
+#define FT_BBOX_H  <freetype/ftbbox.h>
 
 
   /*************************************************************************/
--- a/include/freetype/ftbdf.h
+++ b/include/freetype/ftbdf.h
@@ -1,11 +1,31 @@
-#ifndef __FT_BDF_H__
-#define __FT_BDF_H__
+/***************************************************************************/
+/*                                                                         */
+/*  ftbdf.h                                                                */
+/*                                                                         */
+/*    FreeType API for accessing BDF-specific strings (specification).     */
+/*                                                                         */
+/*  Copyright 2002 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
 
+
+#ifndef __FTBDF_H__
+#define __FTBDF_H__
+
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+
 FT_BEGIN_HEADER
 
+
   FT_EXPORT( FT_Error )
   FT_Get_BDF_Charset_ID( FT_Face       face,
                          const char*  *acharset_encoding,
@@ -13,4 +33,7 @@
 
 FT_END_HEADER
 
-#endif /* __FT_BDF_H__ */
+#endif /* __FTBDF_H__ */
+
+
+/* END */
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -1,3 +1,21 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftbdf.c                                                                */
+/*                                                                         */
+/*    FreeType API for accessing BDF-specific strings (body).              */
+/*                                                                         */
+/*  Copyright 2002 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
 #include <ft2build.h>
 #include FT_INTERNAL_BDF_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
@@ -19,11 +37,13 @@
     {
       FT_Module  driver = (FT_Module) face->driver;
       
-      if ( driver->clazz && driver->clazz->module_name &&
+
+      if ( driver->clazz && driver->clazz->module_name         &&
            ft_strcmp( driver->clazz->module_name, "bdf" ) == 0 )
       {
-        BDF_Public_Face  bdf_face = (BDF_Public_Face) face;
+        BDF_Public_Face  bdf_face = (BDF_Public_Face)face;
         
+
         encoding = (const char*) bdf_face->charset_encoding;
         registry = (const char*) bdf_face->charset_registry;
         error    = 0;
@@ -38,3 +58,6 @@
     
     return error;
   }                         
+
+
+/* END */
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -194,10 +194,10 @@
                       xres->value.int32,
                       yres->value.int32 ));
           root->available_sizes->width =
-             (FT_Short)( prop->value.int32 * 75 / xres->value.int32 );
+            (FT_Short)( prop->value.int32 * 75 / xres->value.int32 );
              
           root->available_sizes->height =
-             (FT_Short)( prop->value.int32 * 75 / yres->value.int32 );
+            (FT_Short)( prop->value.int32 * 75 / yres->value.int32 );
         }
       }
       else
@@ -204,8 +204,8 @@
       {
         /* some fonts have broken SIZE declaration (jiskan24.bdf) */
         FT_ERROR(( "BDF_Face_Init: reading size\n" ));
-        root->available_sizes->width  = (FT_Short) font->point_size ;
-        root->available_sizes->height = (FT_Short) font->point_size ;
+        root->available_sizes->width  = (FT_Short)font->point_size ;
+        root->available_sizes->height = (FT_Short)font->point_size ;
       }
 
       /* encoding table */
@@ -221,7 +221,7 @@
         {
           (face->en_table[n]).enc = cur[n].encoding;
           FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding ));
-          (face->en_table[n]).glyph = (FT_Short) n;
+          (face->en_table[n]).glyph = (FT_Short)n;
         }
       }
 
@@ -367,10 +367,10 @@
           /* get the full bytes */
           for ( j = 0; j < ( bitmap->width >> 2 ); j++ )
           {
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xC0 ) >> 6);
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x30 ) >> 4);
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x0C ) >> 2);
-            bitmap->buffer[count++] = (FT_Byte)(  *pp & 0x03 );
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 );
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 );
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 );
+            bitmap->buffer[count++] = (FT_Byte)(   *pp & 0x03 );
 
             pp++;
           }
@@ -379,13 +379,13 @@
           switch ( bitmap->width & 3 )
           {
           case 3:
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xC0 ) >> 6);
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 );
             /* fall through */
           case 2:
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x30 ) >> 4);
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 );
             /* fall through */
           case 1:
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x0C ) >> 2);
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 );
             /* fall through */
           case 0:
             break;
@@ -408,8 +408,8 @@
           /* get the full bytes */
           for ( j = 0; j < ( bitmap->width >> 1 ); j++ )
           {
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xF0 ) >> 4);
-            bitmap->buffer[count++] = (FT_Byte)(  *pp & 0x0F );
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 );
+            bitmap->buffer[count++] = (FT_Byte)(   *pp & 0x0F );
 
             pp++;
           }
@@ -418,7 +418,7 @@
           switch ( bitmap->width & 1 )
           {
           case 1:
-            bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xF0 ) >> 4);
+            bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 );
             /* fall through */
           case 0:
             break;
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -928,12 +928,12 @@
     }
 
     for ( v = 0; isdigok( dmap, *s ); s++ )
-      v = (short)(v * base + a2i[(int)*s]);
+      v = (short)( v * base + a2i[(int)*s] );
 
     if ( end != 0 )
       *end = s;
 
-    return (short)(( !neg ) ? v : -v );
+    return (short)( ( !neg ) ? v : -v );
   }
 
 
@@ -1030,7 +1030,7 @@
     if ( propid >= _num_bdf_properties )
       return font->user_props + ( propid - _num_bdf_properties );
 
-    return (bdf_property_t*) _bdf_properties + propid;
+    return (bdf_property_t*)_bdf_properties + propid;
   }
 
 
@@ -1217,7 +1217,7 @@
 
     /* Restore the character that was saved before any return can happen. */
     if ( hold != -1 )
-      *ep = (char) hold;
+      *ep = (char)hold;
 
     /* If the property exists and is not an atom, just return here. */
     if ( p && p->format != BDF_ATOM )
@@ -1684,7 +1684,7 @@
       for ( i = 0, *bp = 0; i < nibbles; i++ )
       {
         c = line[i];
-        *bp = (FT_Byte)(( *bp << 4 ) + a2i[c]);
+        *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
         if ( i + 1 < nibbles && ( i & 1 ) )
           *++bp = 0;
       }
@@ -1764,8 +1764,8 @@
       glyph->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 );
 
       /* Generate the ascent and descent of the character. */
-      glyph->bbx.ascent  = (short)(glyph->bbx.height + glyph->bbx.y_offset);
-      glyph->bbx.descent = (short)(-glyph->bbx.y_offset);
+      glyph->bbx.ascent  = (short)( glyph->bbx.height + glyph->bbx.y_offset );
+      glyph->bbx.descent = (short)( -glyph->bbx.y_offset );
 
       /* Determine the overall font bounding box as the characters are */
       /* loaded so corrections can be done later if indicated.         */
@@ -1829,7 +1829,7 @@
 
       /* Allocate enough space for the bitmap. */
       glyph->bpr   = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3;
-      glyph->bytes = (unsigned short)(glyph->bpr * glyph->bbx.height);
+      glyph->bytes = (unsigned short)( glyph->bpr * glyph->bbx.height );
 
       if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) )
         goto Exit;
@@ -2032,7 +2032,7 @@
         error = hash_init( &(font->proptbl), memory );
         if ( error )
           goto Exit;
-        for ( i = 0, prop = (bdf_property_t*) _bdf_properties;
+        for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
               i < _num_bdf_properties; i++, prop++ )
         {
           error = hash_insert( prop->name, (void *)i,
@@ -2200,7 +2200,7 @@
 
     FT_MEM_SET( &p, 0, sizeof ( _bdf_parse_t ) );
 
-    p.opts   = (bdf_options_t*)(( opts != 0 ) ? opts : &_bdf_opts);
+    p.opts   = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
     p.minlb  = 32767;
     p.memory = extmemory;  /* only during font creation */
 
@@ -2236,7 +2236,7 @@
         {
           FT_TRACE2(( "bdf_load_font: " ACMSG3,
                       p.font->bbx.width, p.maxrb - p.minlb ));
-          p.font->bbx.width = (unsigned short)(p.maxrb - p.minlb);
+          p.font->bbx.width = (unsigned short)( p.maxrb - p.minlb );
           p.font->modified  = 1;
         }
 
@@ -2261,7 +2261,7 @@
           FT_TRACE2(( "bdf_load_font: " ACMSG6,
                       p.font->bbx.descent, p.maxds ));
           p.font->bbx.descent  = p.maxds;
-          p.font->bbx.y_offset = (short)(-p.maxds);
+          p.font->bbx.y_offset = (short)( -p.maxds );
           p.font->modified     = 1;
         }
 
@@ -2269,7 +2269,7 @@
         {
           FT_TRACE2(( "bdf_load_font: " ACMSG7,
                       p.font->bbx.height, p.maxas + p.maxds ));
-          p.font->bbx.height = (unsigned short)(p.maxas + p.maxds);
+          p.font->bbx.height = (unsigned short)( p.maxas + p.maxds );
         }
 
         if ( p.flags & _BDF_SWIDTH_ADJ )
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -591,7 +591,7 @@
       goto Exit;
     }
       
-    d = (FT_UInt)( v - 'A' );
+    d = (FT_UInt)( v - 'a' );
     if ( d < 6 )
     {
       d += 10;