[perl-Cairo] Wrap the toy font face API



commit 2b59dc4edf4a65878573d81a1b26c2749c8989af
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Apr 30 17:19:44 2011 +0200

    Wrap the toy font face API

 CairoFont.xs  |   16 ++++++++++++++++
 t/CairoFont.t |   18 +++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/CairoFont.xs b/CairoFont.xs
index f5a060b..41a4331 100644
--- a/CairoFont.xs
+++ b/CairoFont.xs
@@ -77,6 +77,22 @@ MODULE = Cairo	PACKAGE = Cairo::ToyFontFace	PREFIX = cairo_toy_font_face_
 BOOT:
 	cairo_perl_set_isa ("Cairo::ToyFontFace", "Cairo::FontFace");
 
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
+
+# cairo_font_face_t * cairo_toy_font_face_create (const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
+cairo_font_face_t_noinc *
+cairo_toy_font_face_create (class, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
+    C_ARGS:
+	family, slant, weight
+
+const char * cairo_toy_font_face_get_family (cairo_font_face_t *font_face);
+
+cairo_font_slant_t  cairo_toy_font_face_get_slant (cairo_font_face_t *font_face);
+
+cairo_font_weight_t  cairo_toy_font_face_get_weight (cairo_font_face_t *font_face);
+
+#endif
+
 # --------------------------------------------------------------------------- #
 
 MODULE = Cairo::Font	PACKAGE = Cairo::ScaledFont	PREFIX = cairo_scaled_font_
diff --git a/t/CairoFont.t b/t/CairoFont.t
index e596a1e..f9571dc 100644
--- a/t/CairoFont.t
+++ b/t/CairoFont.t
@@ -11,7 +11,7 @@ use strict;
 use warnings;
 use utf8;
 
-use Test::More tests => 23;
+use Test::More tests => 29;
 
 use constant IMG_WIDTH => 256;
 use constant IMG_HEIGHT => 256;
@@ -95,3 +95,19 @@ SKIP: {
 	$cr->show_text_glyphs ($text, $glyphs, $clusters, $flags);
 	is ($cr->status, 'success');
 }
+
+# --------------------------------------------------------------------------- #
+
+SKIP: {
+	skip 'toy font face', 6
+		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 8, 0);
+
+	my $face = Cairo::ToyFontFace->create ('Sans', 'italic', 'bold');
+	isa_ok ($face, 'Cairo::ToyFontFace');
+	isa_ok ($face, 'Cairo::FontFace');
+	is ($face->status, 'success');
+
+	is ($face->get_family, 'Sans');
+	is ($face->get_slant, 'italic');
+	is ($face->get_weight, 'bold');
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]