freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Re: FreeType 2.1.2's cmap detection broken?


From: Anthony Fok
Subject: Re: [Devel] Re: FreeType 2.1.2's cmap detection broken?
Date: Mon, 2 Sep 2002 05:46:32 +0800
User-agent: Mutt/1.4i

On Wed, Aug 14, 2002 at 07:45:20AM +0200, Werner LEMBERG wrote:
> 
> > >Two of the three cmaps of opens___.ttf are indeed buggy, and the
> > >current validation tests in FT 2.1.2 reject them.
> >
> > Although I have never seen it documented there are other fonts
> > beside opens___.ttf which use a range offset of 0xffff to mean "No
> > glyph". So PfaEdit did have a special check for this case. I've put
> > in a warning though.
> 
> It seems we should add something similar.  David?

How about the patch below?  George's PfaEdit code (parsettf.c) is
helpful indeed.  :-)

By the way, how do we go about checking the platform_id and encoding_id
from within tt_cmap4_validate()?  Or perhaps the "n != num_segs - 1"
test is good enough?

(Note: a small, unrelated typo fix to include/freetype/internal/ftobjs.h is
below too.)

Thanks,

Anthony

--- freetype-2.1.2~/src/sfnt/ttcmap0.c  2002-09-02 05:26:10.000000000 +0800
+++ freetype-2.1.2/src/sfnt/ttcmap0.c   2002-09-02 05:24:34.000000000 +0800
@@ -680,7 +680,7 @@
             FT_INVALID_DATA;
         }
 
-        if ( offset )
+        if ( offset && offset != 0xFFFFU )
         {
           p += offset;  /* start of glyph id array */
 
@@ -708,6 +708,15 @@
             }
           }
         }
+        /* Some fonts (erroneously?) use a range offset of 0xFFFF */
+        /* to mean missing glyph in cmap table                    */
+        /*                                                        */
+        else if ( offset == 0xFFFFU )
+        {
+          if ( n != num_segs - 1                    ||
+               valid->level >= FT_VALIDATE_PARANOID )
+            FT_INVALID_DATA;
+        }
 
         last = end;
       }
--- freetype-2.1.2~/include/freetype/internal/ftobjs.h  2002-09-02 
04:20:33.000000000 +0800
+++ freetype-2.1.2/include/freetype/internal/ftobjs.h   2002-09-02 
05:25:06.000000000 +0800
@@ -112,7 +112,7 @@
   /*   return an error later when trying to load the glyph).               */
   /*                                                                       */
   /*   It also check that fields that must be a multiple of 2, 4, or 8     */
-  /*   dont' have incorrect values, etc.                                   */
+  /*   don't have incorrect values, etc.                                   */
   /*                                                                       */
   /* FT_VALIDATE_PARANOID ::                                               */
   /*   Only for font debugging.  Checks that a table follows the           */


-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   <address@hidden> http://www.thizlinux.com/
Debian Chinese Project <address@hidden>       http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!           http://www.olvc.ab.ca/



reply via email to

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