Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / freetype2 / src / src / pcf / pcfdrivr.c
index b34e542..af2a2d9 100644 (file)
@@ -2,7 +2,8 @@
 
     FreeType font driver for pcf files
 
-    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by
+    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009,
+                  2010 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,8 +33,10 @@ THE SOFTWARE.
 #include FT_INTERNAL_OBJECTS_H
 #include FT_GZIP_H
 #include FT_LZW_H
+#include FT_BZIP2_H
 #include FT_ERRORS_H
 #include FT_BDF_H
+#include FT_TRUETYPE_IDS_H 
 
 #include "pcf.h"
 #include "pcfdrivr.h"
@@ -227,7 +230,8 @@ THE SOFTWARE.
         {
           prop = &face->properties[i];
 
-          if ( prop ) {
+          if ( prop )
+          {
             FT_FREE( prop->name );
             if ( prop->isString )
               FT_FREE( prop->value.atom );
@@ -246,11 +250,11 @@ THE SOFTWARE.
 
     FT_TRACE4(( "PCF_Face_Done: done face\n" ));
 
-    /* close gzip/LZW stream if any */
-    if ( pcfface->stream == &face->gzip_stream )
+    /* close compressed stream if any */
+    if ( pcfface->stream == &face->comp_stream )
     {
-      FT_Stream_Close( &face->gzip_stream );
-      pcfface->stream = face->gzip_source;
+      FT_Stream_Close( &face->comp_stream );
+      pcfface->stream = face->comp_source;
     }
   }
 
@@ -275,8 +279,9 @@ THE SOFTWARE.
     {
       PCF_Face_Done( pcfface );
 
-#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \
-    defined( FT_CONFIG_OPTION_USE_LZW )
+#if defined( FT_CONFIG_OPTION_USE_ZLIB )  || \
+    defined( FT_CONFIG_OPTION_USE_LZW )   || \
+    defined( FT_CONFIG_OPTION_USE_BZIP2 )
 
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
       {
@@ -284,7 +289,7 @@ THE SOFTWARE.
 
 
         /* this didn't work, try gzip support! */
-        error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
+        error2 = FT_Stream_OpenGzip( &face->comp_stream, stream );
         if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature )
           goto Fail;
 
@@ -299,7 +304,7 @@ THE SOFTWARE.
 
 
         /* this didn't work, try LZW support! */
-        error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream );
+        error3 = FT_Stream_OpenLZW( &face->comp_stream, stream );
         if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature )
           goto Fail;
 
@@ -307,11 +312,26 @@ THE SOFTWARE.
       }
 #endif /* FT_CONFIG_OPTION_USE_LZW */
 
+#ifdef FT_CONFIG_OPTION_USE_BZIP2
+      if ( error )
+      {
+        FT_Error  error4;
+
+
+        /* this didn't work, try Bzip2 support! */
+        error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream );
+        if ( FT_ERROR_BASE( error4 ) == FT_Err_Unimplemented_Feature )
+          goto Fail;
+
+        error = error4;
+      }
+#endif /* FT_CONFIG_OPTION_USE_BZIP2 */
+
       if ( error )
         goto Fail;
 
-      face->gzip_source = stream;
-      pcfface->stream   = &face->gzip_stream;
+      face->comp_source = stream;
+      pcfface->stream   = &face->comp_stream;
 
       stream = pcfface->stream;
 
@@ -319,7 +339,9 @@ THE SOFTWARE.
       if ( error )
         goto Fail;
 
-#else /* !(FT_CONFIG_OPTION_USE_ZLIB || FT_CONFIG_OPTION_USE_LZW) */
+#else /* !(FT_CONFIG_OPTION_USE_ZLIB ||
+           FT_CONFIG_OPTION_USE_LZW ||
+           FT_CONFIG_OPTION_USE_BZIP2) */
 
       goto Fail;
 
@@ -358,14 +380,15 @@ THE SOFTWARE.
 
         charmap.face        = FT_FACE( face );
         charmap.encoding    = FT_ENCODING_NONE;
-        charmap.platform_id = 0;
-        charmap.encoding_id = 0;
+        /* initial platform/encoding should indicate unset status? */
+        charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
+        charmap.encoding_id = TT_APPLE_ID_DEFAULT;
 
         if ( unicode_charmap )
         {
           charmap.encoding    = FT_ENCODING_UNICODE;
-          charmap.platform_id = 3;
-          charmap.encoding_id = 1;
+          charmap.platform_id = TT_PLATFORM_MICROSOFT;
+          charmap.encoding_id = TT_MS_ID_UNICODE_CS;
         }
 
         error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );