[cairo-commit] cairo/src cairo_ft_font.c,1.2,1.3

Keith Packard commit at pdx.freedesktop.org
Fri Oct 24 14:44:00 PDT 2003


Committed by: keithp

Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv3922/src

Modified Files:
	cairo_ft_font.c 
Log Message:
	* src/cairo_ft_font.c: (_cairo_ft_font_show_glyphs):
	A HORRIBLE KLUDGE to repad glyph images from freetype to
	meet libic requirements.


Index: cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cairo_ft_font.c	24 Oct 2003 18:01:37 -0000	1.2
--- cairo_ft_font.c	24 Oct 2003 21:43:58 -0000	1.3
***************
*** 454,463 ****
          if (width * height != 0)
          {
! 
!             mask = cairo_surface_create_for_image (glyphslot->bitmap.buffer, 
                                                    CAIRO_FORMAT_A8,
                                                    width, height, stride);
              if (mask == NULL)
                  return CAIRO_STATUS_NO_MEMORY;
  
              _cairo_surface_composite (operator, source, mask, surface,
--- 454,495 ----
          if (width * height != 0)
          {
! 	    unsigned char	*bitmap = glyphslot->bitmap.buffer;
! 	    
! 	    /*
! 	     * XXX 
! 	     * reformat to match libic alignment requirements.
! 	     * This should be done before rendering the glyph,
! 	     * but that requires using FT_Outline_Get_Bitmap
! 	     * function
! 	     */
! 	    if (stride & 3)
! 	    {
! 		int		nstride = (stride + 3) & ~3;
! 		unsigned char	*g, *b;
! 		int		h;
! 		
! 		bitmap = malloc (nstride * height);
! 		if (!bitmap)
! 		    return CAIRO_STATUS_NO_MEMORY;
! 		g = glyphslot->bitmap.buffer;
! 		b = bitmap;
! 		h = height;
! 		while (h--)
! 		{
! 		    memcpy (b, g, width);
! 		    b += nstride;
! 		    g += stride;
! 		}
! 		stride = nstride;
! 	    }
!             mask = cairo_surface_create_for_image (bitmap,
                                                    CAIRO_FORMAT_A8,
                                                    width, height, stride);
              if (mask == NULL)
+ 	    {
+ 		if (bitmap != glyphslot->bitmap.buffer)
+ 		    free (bitmap);
                  return CAIRO_STATUS_NO_MEMORY;
+ 	    }
  
              _cairo_surface_composite (operator, source, mask, surface,
***************
*** 468,471 ****
--- 500,505 ----
  
              cairo_surface_destroy (mask);
+ 	    if (bitmap != glyphslot->bitmap.buffer)
+ 		free (bitmap);
          }
      }  





More information about the cairo-commit mailing list