freetype-devel
[Top][All Lists]
Advanced

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

[Devel] glyphs with no pixels are not tolerated by the renderers


From: Graham Asher
Subject: [Devel] glyphs with no pixels are not tolerated by the renderers
Date: Mon, 13 Jan 2003 14:56:36 -0000

Working on the GhostScript-to-FreeType bridge today I found that a certain
PostScript file was failing because it contained glyphs with outlines that
produced empty bitmaps. The problem is that in  ft_raster1_render in
ftrend1.c, the statement

    if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
      goto Exit;

creates a buffer into which the bitmap is rendered. It succeeds if (pitch *
height) is zero, but of course in that case bitmap->buffer remains null. The
function ft_black_render in ftraster.c is then called, but it returns an
error when running this statement:

    if ( !target_map || !target_map->buffer )
      return Raster_Err_Invalid;

My fix is to change lines 194-5 of ftrend1.c from

    /* render outline into the bitmap */
    error = render->raster_render( render->raster, &params );

to

  /* render outline into the bitmap if outline is of non-zero size */
  if ( bitmap->buffer )
      error = render->raster_render( render->raster, &params );

This solves the problem.

Also, although no difficulty has occurred with anti-aliased rendering, I
suggest making the same change to ftsmooth.c: lines 198-199 are also changed
to exactly the same replacement lines.

I'd be grateful for comments or suggestions of a simpler fix.

Graham Asher




reply via email to

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