bugThe FreeType Project - Bugs: bug #25495, empty 'glyf' tables are recognized...

 
 

bug #25495: empty 'glyf' tables are recognized as missing.

Submitted by:  bram tassyns <bramt>
Submitted on:  Thu 05 Feb 2009 09:47:38 AM UTC  
 
Severity: 3 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.9

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 10 Feb 2009 08:51:36 AM UTC, comment #10:

Tested OK

bram tassyns <bramt>
Mon 09 Feb 2009 10:21:01 PM UTC, comment #9:

OK, found the problem. Should be fixed now. Please test.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 09 Feb 2009 12:33:10 PM UTC, comment #8:

Sry, I was confused and combined two bugs into one :s.

If you want to reproduce this error you can use ftdump to dump the attached sample file. If you do this you'll see that the EM size, bounding box, ... is 0. However if you apply the fix I proposed you get the actual values from the font 1000, (-240,-206):(1252,945),...

This is why the font causes issues later on in our code.

bram tassyns <bramt>
Mon 09 Feb 2009 08:26:57 AM UTC, comment #7:

The only thing special we do with freetype in our own build is override the file IO calls to accept UTF8 path names.

GPathName and GBuffer are our own classes but i don't think this should cause any problems.

The complete call is:

FT_Error
GFFactoryFont::CreateFace( const GPathName& inData,
int32_t inFace,
FT_Face& outFace )
{
GBuffer thePath;
inData
.GetCrossPlatformString()
.GetBuffer( thePath, GENCUTF8 );

outFace = 0;
FT_Error theError = FT_New_Face( mLibrary, (const char*)thePath.GetPtr(), inFace, &outFace );
....

after this call theError is not 0.

I'll try to reproduce it with only the freetype2/ft2demos code and add a better usable snippet. But i'm having some trouble upgrading my automake on mac.

bram tassyns <bramt>
Mon 09 Feb 2009 08:18:01 AM UTC, comment #6:

I've just used a different program linked to FreeType, and
it fails too (since I don't have the sources I can't debug
this further). Apparently, it depends how FT_New_Face is
called, and the demo programs don't cover this problematic
case.

So I really need a compilable code snippet to find out the
problem.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 09 Feb 2009 08:00:08 AM UTC, comment #5:

Please follow README.CVS.

Alternatively, say `make devel; make'.

It's very mysterious that `FT_New_Face' fails.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 09 Feb 2009 07:38:39 AM UTC, comment #4:

I only call FT_New_Face, this call already returns an error.

I tried the CVS version in our code and it still fails. However I couldn't build the cvs version the normal way: cd <directory>;./configure;make . So i couldn't test it with ftview.

What extra steps do i need to build from the CVS version (compared to when you download the zip file containing the sources)?

bram tassyns <bramt>
Sun 08 Feb 2009 09:12:45 AM UTC, comment #3:

I can't repeat the problem with ftview, using the current CVS.
The font loads just fine without any errors.

Please provide a compilable code snippet which exhibits the
problem (this is, what you do differently compared to ftview).

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Fri 06 Feb 2009 09:45:59 AM UTC, comment #2:

I attached a sample file containing a subsetted truetype font.
This font was extracted from a pdf. The pdf only uses a space character (which has an empty glyph). But when we try to extract the outline we get an error from freetype. I believe freetype should return the empty glyph instead of failing to parse the font.

bram tassyns <bramt>
Fri 06 Feb 2009 09:10:03 AM UTC, comment #1:

The patch you suggest is exactly what I want to avoid, this is,
making `glyf' a special case in tt_face_lookup_table.

Can you post a sample font together with some code so that I
can debug the problem in more detail? I assume that a fix should
be straightforward.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 05 Feb 2009 09:47:38 AM UTC, original submission:

ttload.cpp, tt_face_lookup_table ignores empty 'glyf' tables. However it possible to have an empty 'glyf' table (for example in subsetted fonts that only have the 'space' character left).

If you parse a font with an empty 'glyf' table you get infinite results for the glyph metrics because this call is used to determine if the font is an outline font or a bitmap font.

This bug was already submitted in #25010 for 2.3.7, but it still is an issue in 2.3.8.

proposed fix:

/* For compatibility with Windows, we consider */
/* zero-length tables the same as missing tables. */
if ( entry->Tag == tag ) {
if ( entry->Length != 0 )
{
FT_TRACE4(( "found table.\n" ));
return entry;
}
#ifdef FT_DEBUG_LEVEL_TRACE
zero_length = TRUE;
#endif
}

should be replaced by:

/* For compatibility with Windows, we consider */
/* zero-length tables the same as missing tables. */
if ( entry->Tag == tag ) {
if ( entry->Length != 0 || tag == TTAG_glyf )
{
FT_TRACE4(( "found table.\n" ));
return entry;
}
#ifdef FT_DEBUG_LEVEL_TRACE
zero_length = TRUE;
#endif
}

bram tassyns <bramt>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #17412:  UniversExtend-subset.ttf added by bramt (7KiB - application/octet-stream - Correct font with empty 'glyf' table (extracted from a pdf))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by bramt (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 09 Feb 2009 10:21:01 PM UTCwlStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.9
    Fri 06 Feb 2009 09:43:47 AM UTCbramtAttached File-=>Added UniversExtend-subset.ttf, #17412
    Fri 06 Feb 2009 09:10:03 AM UTCwlStatusNone=>Need Info
      Assigned toNone=>wl

    Back to the top


    Powered by Savane 3.1-cleanup1