[cairo-commit] cairo/src cairo_font.c,1.16,1.17 cairo_ft_font.c,1.9,1.10 cairo_gstate.c,1.34,1.35 cairoint.h,1.44,1.45

Carl Worth commit at pdx.freedesktop.org
Mon Dec 15 14:20:58 PST 2003


Committed by: cworth

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

Modified Files:
	cairo_font.c cairo_ft_font.c cairo_gstate.c cairoint.h 
Log Message:

        * src/cairoint.h: font->show_glyphs no longer accepts an offset
        point.

        * src/cairo_ft_font.c (_utf8_to_glyphs):
        (_cairo_ft_font_text_extents):
        (_cairo_ft_font_show_text):
        (_cairo_ft_font_text_path): _utf8_to_glyphs now accepts a point by
        which each glyph should be offset.
        (cairo_ft_font_backend): Remove evil void * casts on function
        pointers.

        * src/cairo_font.c (_cairo_font_show_glyphs): Fix to not require a
        current point.

        * src/cairo_gstate.c (_cairo_gstate_show_text):
        (setup_text_rendering_context): Move initialization of current
        device-space point from setup_text_rendering_context to
        _cairo_gstate_show_text.
        (_cairo_gstate_show_glyphs): Fix to not reference current point.


Index: cairo_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_font.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** cairo_font.c	12 Dec 2003 20:00:50 -0000	1.16
--- cairo_font.c	15 Dec 2003 22:20:56 -0000	1.17
***************
*** 125,135 ****
                           cairo_surface_t        *source,
                           cairo_surface_t        *surface,
- 			 double                 x,
- 			 double                 y,
                           cairo_glyph_t          *glyphs,
                           int                    num_glyphs)
  {
      return font->backend->show_glyphs(font, operator, source, 
! 				      surface, x, y, glyphs, num_glyphs);
  }
  
--- 125,133 ----
                           cairo_surface_t        *source,
                           cairo_surface_t        *surface,
                           cairo_glyph_t          *glyphs,
                           int                    num_glyphs)
  {
      return font->backend->show_glyphs(font, operator, source, 
! 				      surface, glyphs, num_glyphs);
  }
  

Index: cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** cairo_ft_font.c	12 Dec 2003 20:00:50 -0000	1.9
--- cairo_ft_font.c	15 Dec 2003 22:20:56 -0000	1.10
***************
*** 322,325 ****
--- 322,327 ----
  _utf8_to_glyphs (cairo_font_t        *font,
  		 const unsigned char *utf8,
+ 		 double		     x0,
+ 		 double		     y0,
  		 cairo_glyph_t       **glyphs,
  		 size_t              *nglyphs)
***************
*** 352,357 ****
      {            
          (*glyphs)[i].index = FT_Get_Char_Index (ft->face, ucs4[i]);
!         (*glyphs)[i].x = x;
!         (*glyphs)[i].y = y;
  
          FT_Load_Glyph (ft->face, (*glyphs)[i].index, FT_LOAD_DEFAULT);
--- 354,359 ----
      {            
          (*glyphs)[i].index = FT_Get_Char_Index (ft->face, ucs4[i]);
!         (*glyphs)[i].x = x0 + x;
!         (*glyphs)[i].y = y0 + y;
  
          FT_Load_Glyph (ft->face, (*glyphs)[i].index, FT_LOAD_DEFAULT);
***************
*** 410,414 ****
      cairo_status_t status = CAIRO_STATUS_SUCCESS;
  
!     if (_utf8_to_glyphs (font, utf8, &glyphs, &nglyphs))
      {
          status = _cairo_ft_font_glyph_extents (font, glyphs, nglyphs, 
--- 412,416 ----
      cairo_status_t status = CAIRO_STATUS_SUCCESS;
  
!     if (_utf8_to_glyphs (font, utf8, 0, 0, &glyphs, &nglyphs))
      {
          status = _cairo_ft_font_glyph_extents (font, glyphs, nglyphs, 
***************
*** 426,431 ****
                              cairo_surface_t     *source,
                              cairo_surface_t     *surface,
-                             double              x0,
-                             double              y0,
                              const cairo_glyph_t *glyphs,
                              int                 num_glyphs)
--- 428,431 ----
***************
*** 462,467 ****
  	bitmap = glyphslot->bitmap.buffer;
     
! 	x = x0 + glyphs[i].x;
! 	y = y0 + glyphs[i].y;      
  
          /* X gets upset with zero-sized images (such as whitespace) */
--- 462,467 ----
  	bitmap = glyphslot->bitmap.buffer;
     
! 	x = glyphs[i].x;
! 	y = glyphs[i].y;      
  
          /* X gets upset with zero-sized images (such as whitespace) */
***************
*** 534,542 ****
      size_t nglyphs;
      
!     if (_utf8_to_glyphs (font, utf8, &glyphs, &nglyphs))
      {
          cairo_status_t res;
          res = _cairo_ft_font_show_glyphs (font, operator, 
!                                           source, surface, x0, y0, 
                                            glyphs, nglyphs);      
          free (glyphs);
--- 534,542 ----
      size_t nglyphs;
      
!     if (_utf8_to_glyphs (font, utf8, x0, y0, &glyphs, &nglyphs))
      {
          cairo_status_t res;
          res = _cairo_ft_font_show_glyphs (font, operator, 
!                                           source, surface,
                                            glyphs, nglyphs);      
          free (glyphs);
***************
*** 572,576 ****
      size_t nglyphs;
      
!     if (_utf8_to_glyphs (font, utf8, &glyphs, &nglyphs))
      {
          cairo_status_t res;
--- 572,576 ----
      size_t nglyphs;
      
!     if (_utf8_to_glyphs (font, utf8, 0, 0, &glyphs, &nglyphs))
      {
          cairo_status_t res;
***************
*** 608,620 ****
  
  const struct cairo_font_backend cairo_ft_font_backend = {
!     font_extents:          (void *) _cairo_ft_font_font_extents,
!     text_extents:          (void *) _cairo_ft_font_text_extents,
!     glyph_extents:         (void *) _cairo_ft_font_glyph_extents,
!     show_text:             (void *) _cairo_ft_font_show_text,
!     show_glyphs:           (void *) _cairo_ft_font_show_glyphs,
!     text_path:             (void *) _cairo_ft_font_text_path,
!     glyph_path:            (void *) _cairo_ft_font_glyph_path,
!     create:                (void *) _cairo_ft_font_create,
!     copy:                  (void *) _cairo_ft_font_copy,
!     destroy:               (void *) _cairo_ft_font_destroy
  };
--- 608,620 ----
  
  const struct cairo_font_backend cairo_ft_font_backend = {
!     _cairo_ft_font_font_extents,
!     _cairo_ft_font_text_extents,
!     _cairo_ft_font_glyph_extents,
!     _cairo_ft_font_show_text,
!     _cairo_ft_font_show_glyphs,
!     _cairo_ft_font_text_path,
!     _cairo_ft_font_glyph_path,
!     _cairo_ft_font_create,
!     _cairo_ft_font_copy,
!     _cairo_ft_font_destroy
  };

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** cairo_gstate.c	11 Dec 2003 19:12:59 -0000	1.34
--- cairo_gstate.c	15 Dec 2003 22:20:56 -0000	1.35
***************
*** 1673,1695 ****
  static cairo_status_t 
  setup_text_rendering_context(cairo_gstate_t *gstate, 
- 			     double *x, double *y,
  			     cairo_matrix_t *user_to_source)
  {
      cairo_status_t status;
      cairo_matrix_t device_to_source;
-   
-     /* XXX: I believe this is correct, but it would be much more clear
-        to have some explicit current_point accesor functions, (one for
-        user- and one for device-space). */
  
-     if (gstate->has_current_point) {
- 	*x = gstate->current_point.x;
- 	*y = gstate->current_point.y;
-     } else {
- 	*x = 0;
- 	*y = 0;
- 	cairo_matrix_transform_point (&gstate->ctm, x, y);
-     }
-   
      status = _cairo_gstate_ensure_source (gstate);
      if (status)
--- 1673,1681 ----
***************
*** 1725,1730 ****
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
      
!     status = setup_text_rendering_context(gstate, &x, &y, &user_to_source);
      if (status)
  	return status;
--- 1711,1729 ----
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
+ 
+     /* XXX: I believe this is correct, but it would be much more clear
+        to have some explicit current_point accesor functions, (one for
+        user- and one for device-space). */
+ 
+     if (gstate->has_current_point) {
+ 	x = gstate->current_point.x;
+ 	y = gstate->current_point.y;
+     } else {
+ 	x = 0;
+ 	y = 0;
+ 	cairo_matrix_transform_point (&gstate->ctm, &x, &y);
+     }
      
!     status = setup_text_rendering_context(gstate, &user_to_source);
      if (status)
  	return status;
***************
*** 1750,1754 ****
  {
      cairo_status_t status;
-     double x, y;
      cairo_matrix_t user_to_source;
      cairo_matrix_t saved_font_matrix;
--- 1749,1752 ----
***************
*** 1768,1772 ****
      }
      
!     status = setup_text_rendering_context (gstate, &x, &y, &user_to_source);
      if (status)
  	return status;
--- 1766,1770 ----
      }
      
!     status = setup_text_rendering_context (gstate, &user_to_source);
      if (status)
  	return status;
***************
*** 1777,1781 ****
      status = _cairo_font_show_glyphs (gstate->font, 
  				      gstate->operator, gstate->source,
! 				      gstate->surface, x, y, 
  				      transformed_glyphs, num_glyphs);
      
--- 1775,1779 ----
      status = _cairo_font_show_glyphs (gstate->font, 
  				      gstate->operator, gstate->source,
! 				      gstate->surface,
  				      transformed_glyphs, num_glyphs);
      

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** cairoint.h	11 Dec 2003 21:04:39 -0000	1.44
--- cairoint.h	15 Dec 2003 22:20:56 -0000	1.45
***************
*** 276,281 ****
  				      cairo_surface_t     *source,
  				      cairo_surface_t     *surface,
- 				      double              x,
- 				      double              y,
  				      const cairo_glyph_t *glyphs,
  				      int                 num_glyphs);
--- 276,279 ----
***************
*** 882,887 ****
                           cairo_surface_t        *source,
                           cairo_surface_t        *surface,
-                          double                 x,
-                          double                 y,
                           cairo_glyph_t          *glyphs,
                           int                    num_glyphs);
--- 880,883 ----





More information about the cairo-commit mailing list