[cairo-commit] cairo-demo/png ChangeLog,1.3,1.4 text.c,1.4,1.5

Carl Worth commit at pdx.freedesktop.org
Tue Dec 16 07:23:38 PST 2003


Committed by: cworth

Update of /cvs/cairo/cairo-demo/png
In directory pdx:/tmp/cvs-serv16079

Modified Files:
	ChangeLog text.c 
Log Message:

        * text.c (box_text):
        (box_glyphs): Add calls to cairo_text_path and cairo_glyph_path to
        demonstrate how to draw stroked (outlined) text.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ChangeLog	16 Dec 2003 03:01:54 -0000	1.3
--- ChangeLog	16 Dec 2003 15:23:36 -0000	1.4
***************
*** 1,2 ****
--- 1,8 ----
+ 2003-12-16  Carl Worth  <cworth at isi.edu>
+ 
+ 	* text.c (box_text):
+ 	(box_glyphs): Add calls to cairo_text_path and cairo_glyph_path to
+ 	demonstrate how to draw stroked (outlined) text.
+ 
  2003-12-15  Carl Worth  <cworth at isi.edu>
  

Index: text.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/text.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** text.c	16 Dec 2003 03:01:54 -0000	1.4
--- text.c	16 Dec 2003 15:23:36 -0000	1.5
***************
*** 50,64 ****
      cairo_text_extents_t extents;
  
      cairo_text_extents (cr, TEXT, &extents);
      line_width = cairo_current_line_width (cr);
      cairo_rectangle (cr,
! 		     x + extents.x_bearing - line_width / 2.0,
! 		     y + extents.y_bearing - line_width / 2.0,
! 		     extents.width  + line_width,
! 		     extents.height + line_width);
      cairo_stroke (cr);
  
      cairo_move_to (cr, x, y);
!     cairo_show_text (cr, TEXT);
  }
  
--- 50,72 ----
      cairo_text_extents_t extents;
  
+     cairo_save (cr);
+ 
      cairo_text_extents (cr, TEXT, &extents);
      line_width = cairo_current_line_width (cr);
      cairo_rectangle (cr,
! 		     x + extents.x_bearing - line_width,
! 		     y + extents.y_bearing - line_width,
! 		     extents.width  + 2 * line_width,
! 		     extents.height + 2 * line_width);
      cairo_stroke (cr);
  
      cairo_move_to (cr, x, y);
!     cairo_show_text (cr, utf8);
!     cairo_text_path (cr, utf8);
!     cairo_set_rgb_color (cr, 1, 0, 0);
!     cairo_set_line_width (cr, 1.0);
!     cairo_stroke (cr);
! 
!     cairo_restore (cr);
  }
  
***************
*** 71,81 ****
      cairo_text_extents_t extents;
  
      cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
      line_width = cairo_current_line_width (cr);
      cairo_rectangle (cr,
! 		     x + extents.x_bearing - line_width / 2.0,
! 		     y + extents.y_bearing - line_width / 2.0,
! 		     extents.width  + line_width,
! 		     extents.height + line_width);
      cairo_stroke (cr);
  
--- 79,91 ----
      cairo_text_extents_t extents;
  
+     cairo_save (cr);
+ 
      cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
      line_width = cairo_current_line_width (cr);
      cairo_rectangle (cr,
! 		     x + extents.x_bearing - line_width,
! 		     y + extents.y_bearing - line_width,
! 		     extents.width  + 2 * line_width,
! 		     extents.height + 2 * line_width);
      cairo_stroke (cr);
  
***************
*** 85,92 ****
--- 95,108 ----
      }
      cairo_show_glyphs (cr, glyphs, num_glyphs);
+     cairo_glyph_path (cr, glyphs, num_glyphs);
+     cairo_set_rgb_color (cr, 1, 0, 0);
+     cairo_set_line_width (cr, 1.0);
+     cairo_stroke (cr);
      for (i=0; i < num_glyphs; i++) {
  	glyphs[i].x -= x;
  	glyphs[i].y -= y;
      }
+ 
+     cairo_restore (cr);
  }
  
***************
*** 109,112 ****
--- 125,129 ----
  
      cairo_set_rgb_color (cr, 0., 0., 0.);
+     cairo_set_line_width (cr, 2.0);
  
      cairo_save (cr);





More information about the cairo-commit mailing list