[cairo-commit] cairo-ocaml/test font.ml,1.3,1.4 Makefile,1.8,1.9
Olivier Andrieu
commit at pdx.freedesktop.org
Mon Jul 18 14:10:29 PDT 2005
- Previous message: [cairo-commit]
cairo-ocaml/src svg_cairo.mli, 1.3, 1.4 svg_cairo.ml,
1.3, 1.4 ml_svg_cairo.c, 1.3, 1.4 ml_cairo_wrappers.h, 1.9,
1.10 ml_cairo_surface.c, 1.2, 1.3 ml_cairo_status.c, 1.6,
1.7 ml_cairo_pattern.c, 1.1, 1.2 ml_cairo_path.c, 1.4,
1.5 ml_cairo.h, 1.10, 1.11 ml_cairo.c, 1.22, 1.23 cairo.mli,
1.17, 1.18 cairo.ml, 1.15, 1.16
- Next message: [cairo-commit] cairo-ocaml ChangeLog,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: oandrieu
Update of /cvs/cairo/cairo-ocaml/test
In directory gabe:/tmp/cvs-serv5619/test
Modified Files:
font.ml Makefile
Log Message:
* src/cairo_ft.ml, src/cairo_ft.mli, src/ml_cairo_ft.c: re-enable
freetype font backend bindings
* test/font.ml: adapt
* src/cairo.mli, src/cairo_png.mli: use `Any surface instead of 'a
surface everywhere
Index: font.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/test/font.ml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- font.ml 2 Mar 2005 18:52:29 -0000 1.3
+++ font.ml 18 Jul 2005 21:10:27 -0000 1.4
@@ -14,34 +14,32 @@
if Sys.file_exists font_arg
then
let face = Cairo_ft.new_face ft font_arg in
- let font = Cairo_ft.font_create_for_ft_face face in
+ let font = Cairo_ft.font_face_create_for_ft_face face 0 in
(font, (fun () -> Cairo_ft.done_face face))
- else
+ else begin
let pattern = Cairo_ft.fc_name_parse font_arg in
- let font = Cairo_ft.font_create ft pattern in
+ let font = Cairo_ft.font_face_create_for_pattern pattern in
(font, ignore)
+ end
in
- let cr = Cairo.create () in
- let file = Cairo_channel.open_out "test_font.png" in
- Cairo.set_target_png ~cr ~file Cairo.FORMAT_ARGB32 ~width:200 ~height:200 ;
+ let s = Cairo.image_surface_create Cairo.FORMAT_ARGB32 ~width:200 ~height:200 in
+ let cr = Cairo.create s in
- Cairo.set_font ~cr ~font ;
+ Cairo.set_font_face cr font ;
- Cairo.scale_font cr 20. ;
+ Cairo.set_font_size cr 20. ;
Cairo.move_to cr 10. 10. ;
Cairo.rotate cr (pi /. 2.) ;
Cairo.show_text cr "Hello World !" ;
- Cairo.finalise_target ~cr ;
- Cairo_channel.close file ;
+ Cairo_png.surface_write_to_file s "test_font.png" ;
clean_up () ;
Cairo_ft.done_freetype ft
let _ =
if Array.length Sys.argv < 2 then exit 1 ;
- main Sys.argv.(1)
-
-
-
+ try main Sys.argv.(1)
+ with Cairo.Error s ->
+ Printf.eprintf "Cairo error: '%s'\n%!" (Cairo.string_of_status s)
Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/test/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Makefile 22 May 2005 20:03:15 -0000 1.8
+++ Makefile 18 Jul 2005 21:10:27 -0000 1.9
@@ -3,7 +3,7 @@
TARGETS = basket kapow
ifdef LABLGTKDIR
-TARGETS += text demo spline knockout # font
+TARGETS += text demo spline knockout font
ifdef GTKCAIRO_CFLAGS
TARGETS += cube
endif
- Previous message: [cairo-commit]
cairo-ocaml/src svg_cairo.mli, 1.3, 1.4 svg_cairo.ml,
1.3, 1.4 ml_svg_cairo.c, 1.3, 1.4 ml_cairo_wrappers.h, 1.9,
1.10 ml_cairo_surface.c, 1.2, 1.3 ml_cairo_status.c, 1.6,
1.7 ml_cairo_pattern.c, 1.1, 1.2 ml_cairo_path.c, 1.4,
1.5 ml_cairo.h, 1.10, 1.11 ml_cairo.c, 1.22, 1.23 cairo.mli,
1.17, 1.18 cairo.ml, 1.15, 1.16
- Next message: [cairo-commit] cairo-ocaml ChangeLog,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list