shithub: freetype+ttf2subf

Download patch

ref: c3dc56b85c96193a9c06829e5ac319c46cf356ce
parent: 2a37b3055df315e571eeee9aa913fcc603588099
author: Werner Lemberg <[email protected]>
date: Mon Apr 19 02:13:50 EDT 2004

* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph),
src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to
FT_UInt.  From Lex Warners.


* src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change
from 2004-03-19.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'.

* src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with
`static.'.
Remove unused function `RepadBitmap'.
* src/pcf/pcfdrivr.c: Don't include pcfutil.h.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-04-18  Werner Lemberg  <[email protected]>
+
+	* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph),
+	src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to
+	FT_UInt.  From Lex Warners.
+
+2004-04-17  Chisato Yamauchi  <[email protected]>
+
+	* src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change
+	from 2004-03-19.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'.
+
+	* src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with
+	`static.'.
+	Remove unused function `RepadBitmap'.
+	* src/pcf/pcfdrivr.c: Don't include pcfutil.h.
+
 2004-04-16  Werner Lemberg  <[email protected]>
 
 	* builds/unix/freetype-config.in (usage): Fix and improve usage
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -478,10 +478,10 @@
 
 
             if ( FT_NEW_ARRAY( face->charset_encoding,
-                               strlen( charset_encoding->value.atom ) + 1 ) )
+                               ft_strlen( charset_encoding->value.atom ) + 1 ) )
               goto Exit;
             if ( FT_NEW_ARRAY( face->charset_registry,
-                               strlen( charset_registry->value.atom ) + 1 ) )
+                               ft_strlen( charset_registry->value.atom ) + 1 ) )
               goto Exit;
 
             ft_strcpy( face->charset_registry, charset_registry->value.atom );
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -37,7 +37,6 @@
 
 #include "pcf.h"
 #include "pcfdrivr.h"
-#include "pcfutil.h"
 #include "pcfread.h"
 
 #include "pcferror.h"
--- a/src/pcf/pcfutil.c
+++ b/src/pcf/pcfutil.c
@@ -25,7 +25,9 @@
  * Author:  Keith Packard, MIT X Consortium
  */
 
+/* Modified for use with FreeType */
 
+
 #include <ft2build.h>
 #include "pcfutil.h"
 
@@ -72,7 +74,7 @@
    *  Invert bit order within each BYTE of an array.
    */
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes )
   {
@@ -88,7 +90,7 @@
    *  Invert byte order within each 16-bits of an array.
    */
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes )
   {
@@ -107,7 +109,7 @@
    *  Invert byte order within each 32-bits of an array.
    */
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes )
   {
@@ -124,91 +126,6 @@
       buf[1] = buf[2];
       buf[2] = c;
     }
-  }
-
-
-  /*
-   *  Repad a bitmap.
-   */
-
-  int
-  RepadBitmap( char*         pSrc,
-               char*         pDst,
-               unsigned int  srcPad,
-               unsigned int  dstPad,
-               int           width,
-               int           height )
-  {
-    int   srcWidthBytes, dstWidthBytes;
-    int   row, col;
-    char  *pTmpSrc, *pTmpDst;
-
-
-    switch ( srcPad )
-    {
-    case 1:
-      srcWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      srcWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      srcWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      srcWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    switch ( dstPad )
-    {
-    case 1:
-      dstWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      dstWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      dstWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      dstWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    width = srcWidthBytes;
-    if ( width > dstWidthBytes )
-      width = dstWidthBytes;
-
-    pTmpSrc= pSrc;
-    pTmpDst= pDst;
-
-    for ( row = 0; row < height; row++ )
-    {
-      for ( col = 0; col < width; col++ )
-        *pTmpDst++ = *pTmpSrc++;
-
-      while ( col < dstWidthBytes )
-      {
-        *pTmpDst++ = '\0';
-        col++;
-      }
-      pTmpSrc += srcWidthBytes - width;
-    }
-
-    return dstWidthBytes * height;
   }
 
 
--- a/src/pcf/pcfutil.h
+++ b/src/pcf/pcfutil.h
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf fonts
 
-  Copyright 2000-2001 by
+  Copyright 2000, 2001, 2004 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,25 +32,18 @@
 #include <ft2build.h>
 
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes);
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes);
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes);
 
-  int
-  RepadBitmap( char*           pSrc,
-               char*           pDst,
-               unsigned int    srcPad,
-               unsigned int    dstPad,
-               int             width,
-               int             height);
 
 #endif /* __PCFUTIL_H__ */
 
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -276,7 +276,7 @@
                             SFNT_Header  sfnt )
   {
     FT_Error   error;
-    FT_ULong   format_tag, offset;
+    FT_ULong   font_format_tag, format_tag, offset;
     FT_Memory  memory = stream->memory;
 
     static const FT_Frame_Field  sfnt_header_fields[] =
@@ -318,10 +318,12 @@
     /*                                                                    */
     offset = FT_STREAM_POS();
 
-    if ( FT_READ_ULONG( format_tag ) )
+    if ( FT_READ_ULONG( font_format_tag ) )
       goto Exit;
 
-    if ( format_tag == TTAG_ttcf )
+    format_tag = font_format_tag;
+
+    if ( font_format_tag == TTAG_ttcf )
     {
       FT_Int  n;
 
@@ -353,8 +355,8 @@
       /* seek to the appropriate TrueType file, then read tag */
       offset = face->ttc_header.offsets[face_index];
 
-      if ( FT_STREAM_SEEK( offset ) ||
-           FT_READ_LONG( format_tag )                             )
+      if ( FT_STREAM_SEEK( offset )   ||
+           FT_READ_LONG( format_tag ) )
         goto Exit;
     }
 
@@ -375,7 +377,7 @@
     }
 
     /* disallow face index values > 0 for non-TTC files */
-    if ( format_tag != TTAG_ttcf && face_index > 0 )
+    if ( font_format_tag != TTAG_ttcf && face_index > 0 )
       error = SFNT_Err_Bad_Argument;
 
   Exit:
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -293,7 +293,7 @@
   static FT_Error
   Load_Glyph( TT_GlyphSlot  slot,
               TT_Size       size,
-              FT_UShort     glyph_index,
+              FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
     FT_Error  error;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1729,7 +1729,7 @@
   FT_LOCAL_DEF( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags )
   {
     SFNT_Service  sfnt;
@@ -1772,7 +1772,7 @@
 
       error = sfnt->load_sbit_image( face,
                                      (FT_ULong)size->strike_index,
-                                     (FT_UInt)glyph_index,
+                                     glyph_index,
                                      (FT_Int)load_flags,
                                      stream,
                                      &glyph->bitmap,
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -43,7 +43,7 @@
   FT_LOCAL( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags );