[cairo-commit] rcairo/packages/cairo/ext cairo.c, 1.8, 1.9 gen-Cairo.c, 1.2, 1.3

Oeyvind Kolaas commit at pdx.freedesktop.org
Fri Dec 10 05:30:50 PST 2004


Committed by: pippin

Update of /cvs/cairo/rcairo/packages/cairo/ext
In directory gabe:/tmp/cvs-serv6202/packages/cairo/ext

Modified Files:
	cairo.c gen-Cairo.c 
Log Message:
updates to extent handling

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/cairo.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo.c	22 Nov 2004 22:09:30 -0000	1.8
+++ cairo.c	10 Dec 2004 13:30:44 -0000	1.9
@@ -278,12 +278,22 @@
   cairo_text_extents (cr, STR2CSTR(utf8), &extents);
   hash = rb_hash_new ();
 
-  rb_hash_aset (hash, rb_str_new2("width"),  rb_float_new(extents.width));
-  rb_hash_aset (hash, rb_str_new2("height"), rb_float_new(extents.height));
-  rb_hash_aset (hash, rb_str_new2("x_bearing"), rb_float_new(extents.x_bearing));
-  rb_hash_aset (hash, rb_str_new2("y_bearing"), rb_float_new(extents.y_bearing));
-  rb_hash_aset (hash, rb_str_new2("x_advance"), rb_float_new(extents.x_advance));
-  rb_hash_aset (hash, rb_str_new2("y_advance"), rb_float_new(extents.y_advance));
+  rb_hash_aset (hash, ID2SYM(rb_intern("width")),
+                      rb_float_new(extents.width));
+
+  rb_hash_aset (hash, ID2SYM(rb_intern("height")),
+                      rb_float_new(extents.height));
+
+  rb_hash_aset (hash, ID2SYM(rb_intern("x_bearing")),
+                      rb_float_new(extents.x_bearing));
+
+  rb_hash_aset (hash, ID2SYM(rb_intern("y_bearing")),
+                      rb_float_new(extents.y_bearing));
+  rb_hash_aset (hash, ID2SYM(rb_intern("x_advance")),
+                      rb_float_new(extents.x_advance));
+
+  rb_hash_aset (hash, ID2SYM(rb_intern("y_advance")),
+                      rb_float_new(extents.y_advance));
 
   return hash;
 }

Index: gen-Cairo.c
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/ext/gen-Cairo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gen-Cairo.c	22 Nov 2004 22:09:30 -0000	1.2
+++ gen-Cairo.c	10 Dec 2004 13:30:44 -0000	1.3
@@ -381,10 +381,24 @@
                     VALUE slant,
                     VALUE weight)
 {
-  cairo_select_font (rcairo_get_cairo(self),
+  cairo_t *cr = rcairo_get_cairo (self);
+
+  cairo_select_font (cr,
                      STR2CSTR(family),
                      NUM2INT(slant),
                      NUM2INT(weight));
+    { /* FIXME XXX , hack to make sure font is 1 user space unit high */
+      cairo_font_t   *cur_font;
+      cairo_matrix_t *matrix;
+
+      matrix = cairo_matrix_create ();
+      cairo_matrix_set_identity (matrix);
+
+      cur_font = cairo_current_font (cr);
+      cairo_font_set_transform (cur_font, matrix);
+      cairo_set_font (cr, cur_font);
+      cairo_matrix_destroy (matrix);
+    }
   return Qnil;
 }
 




More information about the cairo-commit mailing list