freetype-devel
[Top][All Lists]
Advanced

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

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


From: Graham Asher
Subject: [Devel] RE: glyphs with no pixels are not tolerated by the renderers
Date: Tue, 14 Jan 2003 09:18:26 -0000

Yesterday I said this:

<<<<<<
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.
>>>>>>

I'd like to modify my views based on what I have found out since then. The
empty bitmaps were produced by outlines for which all points were (0,0).
This was caused by an erroneous font transformation in my code. However, I
still believe the changes mentioned above should be done, because it's not
the job of a renderer to reject any legal outline; and any sequence of
points should be legal for an outline. This policy is in line with the
general principles of modularisation and context-free-ness.

Graham Asher




reply via email to

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