freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Type42 actualisation


From: Detlef Würkner
Subject: Re: [Devel] Type42 actualisation
Date: Sun, 09 Jun 2002 08:53:30 +0200

address@hidden (Roberto Alameda) wrote:

> On Thu, 2002-06-06 at 00:41, Detlef Würkner wrote:
[...]
> Detlef, you got it. Thanks!!
> There was an error in the FT_Size handling.
> 
> The attached version works fine with all tested programs.
> I put some additional documentation, also.
> Could you put it into the CVS?

Sorry, I can't, but I can translate your new version into a diff
for the actual CVS source and confirm that this version seems to
work with both ftstring and ftview:

----8<----
--- freetype2-current/src/type42/t42drivr.c.ori Sat Jun  8 07:09:21 2002
+++ freetype2-current/src/type42/t42drivr.c     Sun Jun  9 06:24:36 2002
@@ -14,6 +14,19 @@
 /*                                                                         */
 /***************************************************************************/
 
+/* This driver implements Type42 fonts as described in the                 */
+/* Technical Note #5012 from Adobe, with these limitations:                */
+/* 1) CID Fonts are not currently supported.                               */
+/* 2) Incremental fonts making use of the GlyphDirectory keyword           */
+/*    will be loaded, but the rendering will be using the TrueType tables. */
+/* 3) The sfnts array is expected to be ASCII, not binary.                 */
+/* 4) As for Type1 fonts, CDevProc is not supported                        */
+/* 5) The Metrics dictionary is not supported                              */
+/* 6) AFM metrics are not supported                                        */
+/* In other words, this driver supports Type42 fonts derived from          */
+/* TrueType fonts in a non-CID manner, as done by usual conversion         */
+/* programs.                                                               */
+
 
 #include "t42drivr.h"
 #include "t42objs.h"
--- freetype2-current/src/type42/t42parse.c.ori Sat Jun  8 07:11:34 2002
+++ freetype2-current/src/type42/t42parse.c     Sun Jun  9 06:47:49 2002
@@ -56,6 +56,10 @@
   t42_parse_sfnts( T42_Face    face,
                    T42_Loader  loader );
 
+  static void
+  t42_parse_cid( T42_Face    face,
+                 T42_Loader  loader );
+
 
   static const
   T1_FieldRec  t42_keywords[] = {
@@ -90,6 +94,7 @@
     T1_FIELD_CALLBACK( "Encoding",    t42_parse_encoding )
     T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings )
     T1_FIELD_CALLBACK( "sfnts",       t42_parse_sfnts )
+    T1_FIELD_CALLBACK( "CIDFontType", t42_parse_cid )
 
     { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 }
   };
@@ -693,6 +698,21 @@
     error = T42_Err_Invalid_File_Format;
 
   Fail:
+    parser->root.error = error;
+  }
+
+
+  static void
+  t42_parse_cid( T42_Face    face,
+                 T42_Loader  loader )
+  {
+    T42_Parser  parser = &loader->parser;
+    FT_Error    error;
+
+
+    FT_ERROR(( "t42_parse_cid: CID fonts in type42 not supported!\n" ));
+    error = T42_Err_Invalid_File_Format;
+
     parser->root.error = error;
   }
 
--- freetype2-current/src/type42/t42objs.c.ori  Sat Jun  8 07:10:29 2002
+++ freetype2-current/src/type42/t42objs.c      Sun Jun  9 06:41:00 2002
@@ -632,8 +632,18 @@
     FT_Error  error   = T42_Err_Ok;
 
 
-    error = FT_New_Size( t42face->ttf_face, &ttsize );
-    size->ttsize = ttsize;
+    if ( face->size == NULL && t42face->ttf_face->size)
+    {
+      /* First size for this face */
+      size->ttsize = t42face->ttf_face->size;
+    }
+    else
+    {
+      error = FT_New_Size( t42face->ttf_face, &ttsize );
+      if (t42face->ttf_face->size == NULL)
+        t42face->ttf_face->size = ttsize;
+      size->ttsize = ttsize;
+    }
 
     return error;
   }
@@ -665,7 +675,7 @@
     FT_Error      error   = T42_Err_Ok;
 
 
-    if ( face->glyph == NULL )
+    if ( face->glyph == NULL && t42face->ttf_face->glyph )
     {
       /* First glyph slot for this face */
       slot->ttslot = t42face->ttf_face->glyph;
@@ -673,6 +683,8 @@
     else
     {
       error = FT_New_GlyphSlot( t42face->ttf_face, &ttslot );
+      if ( t42face->ttf_face->glyph == NULL )
+        t42face->ttf_face->glyph = ttslot;
       slot->ttslot = ttslot;
     }
 
@@ -712,6 +724,7 @@
     T42_Face  t42face = (T42_Face)face;
 
 
+    t42face->ttf_face->size = size->ttsize;
     return FT_Set_Char_Size( t42face->ttf_face,
                              char_width,
                              char_height,
@@ -729,6 +742,7 @@
     T42_Face  t42face = (T42_Face)face;
 
 
+    t42face->ttf_face->size = size->ttsize;
     return FT_Set_Pixel_Sizes( t42face->ttf_face,
                                pixel_width,
                                pixel_height );
----8<----

Ciao, Detlef
-- 
_ // address@hidden
\X/  Detlef Wuerkner, Langgoens/Germany



reply via email to

[Prev in Thread] Current Thread [Next in Thread]