Thu 24 Dec 2009 01:26:52 PM UTC, original submission:
This may not be strictly a bug, but related to the way Ghostscript uses FreeType.
Because PostScript files often contain incrementally downloaded Type 1 and TrueType fonts, we must use the incremental option for FreeType.
When doing so GS relies upon the callback to supply the correct glyph data to FreeType for processing. In particular Ghostscript does not alter the 'num_glyphs' member of the FreeType 'face' structure when new glyphs become available.
This means that the num_glyphs field is always at its initial value (0 for Type 1 fonts). Howdver, there is a specific test in T1_Load_Glyph (t1gload.c, ~line 290) :
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
{
error = T1_Err_Invalid_Argument;
goto Exit;
}
Because we don't update num_glyphs, this test always fails, and we get an invalid argument error return.
I would suggest that this should be guarded with a #ifndef FT_CONFIG_OPTION_INCREMENTAL preprocessor directive. This allows the incremental interface to run as expected and the callback duly returns the correct data.
By inspection there are two other locations where this may be a problem, FNT_Load_Glyph (winfnt.c, line 961) and Load_Glyph (ttdriver.c, line 301). I don't have test cases which cause these to fail, though I'm unsure at the moment why the TrueType case doesn't cause us a problem.
I've attached unified diff files of the patches I've made locally to FreeType, please let me know if you need more details.
|