cairo 1.8.3-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cairo might be problematic. Click here for more details.
- data/AUTHORS +4 -0
- data/COPYING +59 -0
- data/GPL +340 -0
- data/NEWS +163 -0
- data/Rakefile +190 -0
- data/doc/doc.css +91 -0
- data/doc/en/cairo-antialias.html +38 -0
- data/doc/en/cairo-clip-not-representable-error.html +47 -0
- data/doc/en/cairo-color-base.html +69 -0
- data/doc/en/cairo-color-cmyk.html +157 -0
- data/doc/en/cairo-color-hsv.html +137 -0
- data/doc/en/cairo-color-rgb.html +142 -0
- data/doc/en/cairo-color-x11.html +173 -0
- data/doc/en/cairo-color.html +238 -0
- data/doc/en/cairo-content.html +37 -0
- data/doc/en/cairo-context-blur.html +39 -0
- data/doc/en/cairo-context-circle.html +39 -0
- data/doc/en/cairo-context-color.html +39 -0
- data/doc/en/cairo-context-path.html +44 -0
- data/doc/en/cairo-context-rectangle.html +39 -0
- data/doc/en/cairo-context-triangle.html +39 -0
- data/doc/en/cairo-context.html +643 -0
- data/doc/en/cairo-error.html +44 -0
- data/doc/en/cairo-extend.html +38 -0
- data/doc/en/cairo-file-not-found.html +47 -0
- data/doc/en/cairo-fill-rule.html +36 -0
- data/doc/en/cairo-filter.html +40 -0
- data/doc/en/cairo-font-extents.html +129 -0
- data/doc/en/cairo-font-face.html +38 -0
- data/doc/en/cairo-font-options.html +139 -0
- data/doc/en/cairo-font-slant.html +37 -0
- data/doc/en/cairo-font-type-mismatch.html +47 -0
- data/doc/en/cairo-font-weight.html +36 -0
- data/doc/en/cairo-format.html +46 -0
- data/doc/en/cairo-glyph.html +99 -0
- data/doc/en/cairo-gradient-pattern.html +74 -0
- data/doc/en/cairo-hint-metrics.html +37 -0
- data/doc/en/cairo-hint-style.html +39 -0
- data/doc/en/cairo-image-surface.html +82 -0
- data/doc/en/cairo-invalid-clusters.html +47 -0
- data/doc/en/cairo-invalid-content-error.html +47 -0
- data/doc/en/cairo-invalid-dash-error.html +47 -0
- data/doc/en/cairo-invalid-dsc-comment-error.html +47 -0
- data/doc/en/cairo-invalid-format-error.html +47 -0
- data/doc/en/cairo-invalid-index-error.html +47 -0
- data/doc/en/cairo-invalid-matrix-error.html +47 -0
- data/doc/en/cairo-invalid-path-data-error.html +47 -0
- data/doc/en/cairo-invalid-pop-group-error.html +47 -0
- data/doc/en/cairo-invalid-restore-error.html +47 -0
- data/doc/en/cairo-invalid-slant.html +47 -0
- data/doc/en/cairo-invalid-status-error.html +47 -0
- data/doc/en/cairo-invalid-stride-error.html +47 -0
- data/doc/en/cairo-invalid-string-error.html +47 -0
- data/doc/en/cairo-invalid-visual-error.html +47 -0
- data/doc/en/cairo-invalid-weight.html +47 -0
- data/doc/en/cairo-line-cap.html +37 -0
- data/doc/en/cairo-line-join.html +37 -0
- data/doc/en/cairo-linear-pattern.html +60 -0
- data/doc/en/cairo-matrix.html +259 -0
- data/doc/en/cairo-negative-count.html +47 -0
- data/doc/en/cairo-no-current-point-error.html +47 -0
- data/doc/en/cairo-null-pointer-error.html +47 -0
- data/doc/en/cairo-operator.html +48 -0
- data/doc/en/cairo-paper-parse-error.html +47 -0
- data/doc/en/cairo-paper-unknown-paper-name.html +66 -0
- data/doc/en/cairo-paper-unknown-unit.html +66 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.html +66 -0
- data/doc/en/cairo-paper.html +184 -0
- data/doc/en/cairo-path-close-path.html +49 -0
- data/doc/en/cairo-path-curve-to.html +49 -0
- data/doc/en/cairo-path-data-type.html +38 -0
- data/doc/en/cairo-path-data.html +98 -0
- data/doc/en/cairo-path-line-to.html +49 -0
- data/doc/en/cairo-path-move-to.html +49 -0
- data/doc/en/cairo-path.html +155 -0
- data/doc/en/cairo-pattern-type-mismatch-error.html +47 -0
- data/doc/en/cairo-pattern.html +99 -0
- data/doc/en/cairo-pdf-surface.html +57 -0
- data/doc/en/cairo-point.html +74 -0
- data/doc/en/cairo-ps-level.html +49 -0
- data/doc/en/cairo-ps-surface.html +92 -0
- data/doc/en/cairo-quartz-image-surface.html +57 -0
- data/doc/en/cairo-quartz-surface.html +57 -0
- data/doc/en/cairo-radial-pattern.html +60 -0
- data/doc/en/cairo-read-error.html +47 -0
- data/doc/en/cairo-rectangle.html +89 -0
- data/doc/en/cairo-scaled-font.html +94 -0
- data/doc/en/cairo-solid-pattern.html +62 -0
- data/doc/en/cairo-subpixel-order.html +39 -0
- data/doc/en/cairo-surface-finished-error.html +47 -0
- data/doc/en/cairo-surface-pattern.html +57 -0
- data/doc/en/cairo-surface-type-mismatch-error.html +47 -0
- data/doc/en/cairo-surface.html +121 -0
- data/doc/en/cairo-svg-surface.html +77 -0
- data/doc/en/cairo-svg-version.html +49 -0
- data/doc/en/cairo-temp-file-error.html +47 -0
- data/doc/en/cairo-text-cluster-flag.html +35 -0
- data/doc/en/cairo-text-cluster.html +84 -0
- data/doc/en/cairo-text-extents.html +144 -0
- data/doc/en/cairo-toy-font-face.html +67 -0
- data/doc/en/cairo-user-font-error.html +47 -0
- data/doc/en/cairo-user-font-face-text-to-glyphs-data.html +94 -0
- data/doc/en/cairo-user-font-face.html +72 -0
- data/doc/en/cairo-user-font-immutable.html +47 -0
- data/doc/en/cairo-win32-printing-surface.html +57 -0
- data/doc/en/cairo-win32-surface.html +62 -0
- data/doc/en/cairo-write-error.html +47 -0
- data/doc/en/cairo.html +131 -0
- data/doc/en/index.html +1154 -0
- data/doc/index.html +18 -0
- data/doc/ja/cairo-antialias.html +57 -0
- data/doc/ja/cairo-clip-not-representable-error.html +56 -0
- data/doc/ja/cairo-color-base.html +75 -0
- data/doc/ja/cairo-color-cmyk.html +152 -0
- data/doc/ja/cairo-color-hsv.html +135 -0
- data/doc/ja/cairo-color-rgb.html +145 -0
- data/doc/ja/cairo-color-x11.html +183 -0
- data/doc/ja/cairo-color.html +317 -0
- data/doc/ja/cairo-content.html +51 -0
- data/doc/ja/cairo-context-blur.html +53 -0
- data/doc/ja/cairo-context-circle.html +54 -0
- data/doc/ja/cairo-context-color.html +52 -0
- data/doc/ja/cairo-context-path.html +77 -0
- data/doc/ja/cairo-context-rectangle.html +60 -0
- data/doc/ja/cairo-context-triangle.html +47 -0
- data/doc/ja/cairo-context.html +1542 -0
- data/doc/ja/cairo-error.html +56 -0
- data/doc/ja/cairo-extend.html +56 -0
- data/doc/ja/cairo-file-not-found.html +51 -0
- data/doc/ja/cairo-fill-rule.html +58 -0
- data/doc/ja/cairo-filter.html +43 -0
- data/doc/ja/cairo-font-extents.html +164 -0
- data/doc/ja/cairo-font-face.html +55 -0
- data/doc/ja/cairo-font-options.html +189 -0
- data/doc/ja/cairo-font-slant.html +50 -0
- data/doc/ja/cairo-font-type-mismatch.html +52 -0
- data/doc/ja/cairo-font-weight.html +47 -0
- data/doc/ja/cairo-format.html +81 -0
- data/doc/ja/cairo-glyph.html +115 -0
- data/doc/ja/cairo-gradient-pattern.html +119 -0
- data/doc/ja/cairo-hint-metrics.html +57 -0
- data/doc/ja/cairo-hint-style.html +64 -0
- data/doc/ja/cairo-image-surface.html +131 -0
- data/doc/ja/cairo-invalid-clusters.html +55 -0
- data/doc/ja/cairo-invalid-content-error.html +54 -0
- data/doc/ja/cairo-invalid-dash-error.html +54 -0
- data/doc/ja/cairo-invalid-dsc-comment-error.html +54 -0
- data/doc/ja/cairo-invalid-format-error.html +54 -0
- data/doc/ja/cairo-invalid-index-error.html +54 -0
- data/doc/ja/cairo-invalid-matrix-error.html +54 -0
- data/doc/ja/cairo-invalid-path-data-error.html +54 -0
- data/doc/ja/cairo-invalid-pop-group-error.html +54 -0
- data/doc/ja/cairo-invalid-restore-error.html +55 -0
- data/doc/ja/cairo-invalid-slant.html +57 -0
- data/doc/ja/cairo-invalid-status-error.html +55 -0
- data/doc/ja/cairo-invalid-stride-error.html +55 -0
- data/doc/ja/cairo-invalid-string-error.html +54 -0
- data/doc/ja/cairo-invalid-visual-error.html +57 -0
- data/doc/ja/cairo-invalid-weight.html +57 -0
- data/doc/ja/cairo-line-cap.html +50 -0
- data/doc/ja/cairo-line-join.html +53 -0
- data/doc/ja/cairo-linear-pattern.html +87 -0
- data/doc/ja/cairo-matrix.html +354 -0
- data/doc/ja/cairo-negative-count.html +52 -0
- data/doc/ja/cairo-no-current-point-error.html +54 -0
- data/doc/ja/cairo-null-pointer-error.html +54 -0
- data/doc/ja/cairo-operator.html +51 -0
- data/doc/ja/cairo-paper-parse-error.html +55 -0
- data/doc/ja/cairo-paper-unknown-paper-name.html +76 -0
- data/doc/ja/cairo-paper-unknown-unit.html +75 -0
- data/doc/ja/cairo-paper-unrecognized-paper-description.html +76 -0
- data/doc/ja/cairo-paper.html +357 -0
- data/doc/ja/cairo-path-close-path.html +57 -0
- data/doc/ja/cairo-path-curve-to.html +70 -0
- data/doc/ja/cairo-path-data-type.html +53 -0
- data/doc/ja/cairo-path-data.html +127 -0
- data/doc/ja/cairo-path-line-to.html +62 -0
- data/doc/ja/cairo-path-move-to.html +62 -0
- data/doc/ja/cairo-path.html +144 -0
- data/doc/ja/cairo-pattern-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-pattern.html +128 -0
- data/doc/ja/cairo-pdf-surface.html +86 -0
- data/doc/ja/cairo-point.html +90 -0
- data/doc/ja/cairo-ps-level.html +62 -0
- data/doc/ja/cairo-ps-surface.html +214 -0
- data/doc/ja/cairo-quartz-image-surface.html +75 -0
- data/doc/ja/cairo-quartz-surface.html +93 -0
- data/doc/ja/cairo-radial-pattern.html +93 -0
- data/doc/ja/cairo-read-error.html +55 -0
- data/doc/ja/cairo-rectangle.html +109 -0
- data/doc/ja/cairo-scaled-font.html +180 -0
- data/doc/ja/cairo-solid-pattern.html +87 -0
- data/doc/ja/cairo-subpixel-order.html +57 -0
- data/doc/ja/cairo-surface-finished-error.html +54 -0
- data/doc/ja/cairo-surface-pattern.html +68 -0
- data/doc/ja/cairo-surface-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-surface.html +213 -0
- data/doc/ja/cairo-svg-surface.html +114 -0
- data/doc/ja/cairo-svg-version.html +66 -0
- data/doc/ja/cairo-temp-file-error.html +50 -0
- data/doc/ja/cairo-text-cluster-flag.html +46 -0
- data/doc/ja/cairo-text-cluster.html +102 -0
- data/doc/ja/cairo-text-extents.html +163 -0
- data/doc/ja/cairo-toy-font-face.html +107 -0
- data/doc/ja/cairo-user-font-error.html +55 -0
- data/doc/ja/cairo-user-font-face-text-to-glyphs-data.html +156 -0
- data/doc/ja/cairo-user-font-face.html +268 -0
- data/doc/ja/cairo-user-font-immutable.html +54 -0
- data/doc/ja/cairo-win32-printing-surface.html +80 -0
- data/doc/ja/cairo-win32-surface.html +100 -0
- data/doc/ja/cairo-write-error.html +55 -0
- data/doc/ja/cairo.html +177 -0
- data/doc/ja/index.html +1156 -0
- data/ext/cairo/cairo.def +104 -0
- data/ext/cairo/extconf.rb +80 -0
- data/ext/cairo/rb_cairo.c +104 -0
- data/ext/cairo/rb_cairo.h +275 -0
- data/ext/cairo/rb_cairo_constants.c +478 -0
- data/ext/cairo/rb_cairo_context.c +1693 -0
- data/ext/cairo/rb_cairo_exception.c +354 -0
- data/ext/cairo/rb_cairo_font_extents.c +200 -0
- data/ext/cairo/rb_cairo_font_face.c +713 -0
- data/ext/cairo/rb_cairo_font_options.c +197 -0
- data/ext/cairo/rb_cairo_glyph.c +161 -0
- data/ext/cairo/rb_cairo_matrix.c +366 -0
- data/ext/cairo/rb_cairo_path.c +459 -0
- data/ext/cairo/rb_cairo_pattern.c +540 -0
- data/ext/cairo/rb_cairo_private.c +242 -0
- data/ext/cairo/rb_cairo_private.h +114 -0
- data/ext/cairo/rb_cairo_scaled_font.c +235 -0
- data/ext/cairo/rb_cairo_surface.c +1371 -0
- data/ext/cairo/rb_cairo_text_cluster.c +151 -0
- data/ext/cairo/rb_cairo_text_extents.c +221 -0
- data/extconf.rb +45 -0
- data/lib/1.8/cairo.so +0 -0
- data/lib/1.9/cairo.so +0 -0
- data/lib/cairo.rb +151 -0
- data/lib/cairo/color.rb +267 -0
- data/lib/cairo/colors.rb +656 -0
- data/lib/cairo/constants.rb +24 -0
- data/lib/cairo/context.rb +29 -0
- data/lib/cairo/context/blur.rb +45 -0
- data/lib/cairo/context/circle.rb +9 -0
- data/lib/cairo/context/color.rb +11 -0
- data/lib/cairo/context/path.rb +116 -0
- data/lib/cairo/context/rectangle.rb +33 -0
- data/lib/cairo/context/triangle.rb +12 -0
- data/lib/cairo/paper.rb +183 -0
- data/lib/cairo/papers.rb +41 -0
- data/lib/cairo/path.rb +15 -0
- data/lib/cairo/point.rb +7 -0
- data/misc/update-colors.rb +143 -0
- data/pkg-config.rb +313 -0
- data/samples/agg/README +4 -0
- data/samples/agg/aa_test.rb +304 -0
- data/samples/blur.rb +47 -0
- data/samples/pac.rb +99 -0
- data/samples/pac2.rb +171 -0
- data/samples/png.rb +45 -0
- data/samples/scalable.rb +56 -0
- data/samples/text-on-path.rb +60 -0
- data/samples/text2.rb +131 -0
- data/test-unit/Rakefile +30 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/lib/test/unit.rb +280 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
- data/test-unit/lib/test/unit/assertions.rb +722 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +254 -0
- data/test-unit/lib/test/unit/collector.rb +43 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +135 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color.rb +61 -0
- data/test-unit/lib/test/unit/diff.rb +524 -0
- data/test-unit/lib/test/unit/error.rb +124 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +110 -0
- data/test-unit/lib/test/unit/fixture.rb +185 -0
- data/test-unit/lib/test/unit/notification.rb +125 -0
- data/test-unit/lib/test/unit/omission.rb +143 -0
- data/test-unit/lib/test/unit/pending.rb +146 -0
- data/test-unit/lib/test/unit/priority.rb +146 -0
- data/test-unit/lib/test/unit/runner/console.rb +46 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +281 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/tc_adder.rb +18 -0
- data/test-unit/sample/tc_subtracter.rb +18 -0
- data/test-unit/sample/ts_examples.rb +7 -0
- data/test-unit/test/collector/test_descendant.rb +135 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_load.rb +333 -0
- data/test-unit/test/collector/test_objectspace.rb +98 -0
- data/test-unit/test/run-test.rb +13 -0
- data/test-unit/test/test_assertions.rb +693 -0
- data/test-unit/test/test_attribute.rb +86 -0
- data/test-unit/test/test_color.rb +37 -0
- data/test-unit/test/test_diff.rb +477 -0
- data/test-unit/test/test_emacs_runner.rb +60 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_fixture.rb +252 -0
- data/test-unit/test/test_notification.rb +33 -0
- data/test-unit/test/test_omission.rb +81 -0
- data/test-unit/test/test_pending.rb +70 -0
- data/test-unit/test/test_priority.rb +89 -0
- data/test-unit/test/test_testcase.rb +430 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit_test_util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/cairo-test-utils.rb +18 -0
- data/test/run-test.rb +28 -0
- data/test/test_color.rb +17 -0
- data/test/test_constants.rb +16 -0
- data/test/test_context.rb +105 -0
- data/test/test_exception.rb +27 -0
- data/test/test_font_extents.rb +36 -0
- data/test/test_font_face.rb +244 -0
- data/test/test_font_options.rb +13 -0
- data/test/test_paper.rb +81 -0
- data/test/test_pkg_config.rb +123 -0
- data/test/test_scaled_font.rb +34 -0
- data/test/test_surface.rb +41 -0
- data/test/test_text_cluster.rb +32 -0
- data/test/test_text_extents.rb +40 -0
- data/test/test_text_to_glyphs_data.rb +51 -0
- data/tmp/x86-mingw32/cairo/1.8.7/fake.rb +6 -0
- data/tmp/x86-mingw32/cairo/1.8.7/mkmf.rb +1836 -0
- data/tmp/x86-mingw32/cairo/1.8.7/rbconfig.rb +183 -0
- data/tmp/x86-mingw32/cairo/1.9.2/fake.rb +6 -0
- data/tmp/x86-mingw32/cairo/1.9.2/mkmf.rb +2079 -0
- data/tmp/x86-mingw32/cairo/1.9.2/rbconfig.rb +226 -0
- metadata +437 -0
@@ -0,0 +1,242 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-17 07:21:42 $
|
7
|
+
*
|
8
|
+
* Copyright 2005-2008 Kouhei Sutou <kou@cozmixng.org>
|
9
|
+
*
|
10
|
+
* This file is made available under the same terms as Ruby
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
#include "rb_cairo.h"
|
15
|
+
#include "rb_cairo_private.h"
|
16
|
+
|
17
|
+
static ID cr_id_normalize_const_name;
|
18
|
+
static ID cr_id_objects;
|
19
|
+
static ID cr_id_dup;
|
20
|
+
static ID cr_id_inspect;
|
21
|
+
static ID cr_id_exit_application;
|
22
|
+
|
23
|
+
VALUE
|
24
|
+
rb_cairo__float_array (double *values, unsigned count)
|
25
|
+
{
|
26
|
+
VALUE result;
|
27
|
+
unsigned i;
|
28
|
+
|
29
|
+
result = rb_ary_new2 (count);
|
30
|
+
for (i = 0; i < count; i++)
|
31
|
+
{
|
32
|
+
rb_ary_push (result, rb_float_new (values[i]));
|
33
|
+
}
|
34
|
+
return result;
|
35
|
+
}
|
36
|
+
|
37
|
+
void
|
38
|
+
rb_cairo__glyphs_to_array (VALUE rb_array, cairo_glyph_t *glyphs, int length)
|
39
|
+
{
|
40
|
+
int i;
|
41
|
+
|
42
|
+
for (i = 0; i < length; i++)
|
43
|
+
{
|
44
|
+
memcpy ((char *) &glyphs[i],
|
45
|
+
(char *) RVAL2CRGLYPH (rb_ary_entry (rb_array, i)),
|
46
|
+
sizeof (cairo_glyph_t));
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
VALUE
|
51
|
+
rb_cairo__const_get (VALUE name, const char *prefix)
|
52
|
+
{
|
53
|
+
VALUE rb_normalized_name;
|
54
|
+
char *const_name, *normalized_name;
|
55
|
+
size_t prefix_len, normalized_name_len;
|
56
|
+
|
57
|
+
rb_normalized_name = rb_funcall (rb_mCairo,
|
58
|
+
cr_id_normalize_const_name, 1, name);
|
59
|
+
normalized_name = RVAL2CSTR (rb_normalized_name);
|
60
|
+
|
61
|
+
prefix_len = strlen (prefix);
|
62
|
+
normalized_name_len = strlen (normalized_name);
|
63
|
+
|
64
|
+
const_name = ALLOCA_N (char, prefix_len + normalized_name_len + 1);
|
65
|
+
strncpy (const_name, prefix, prefix_len);
|
66
|
+
strncpy (const_name + prefix_len, normalized_name, normalized_name_len);
|
67
|
+
const_name[prefix_len + normalized_name_len] = '\0';
|
68
|
+
|
69
|
+
return rb_const_get (rb_mCairo, rb_intern (const_name));
|
70
|
+
}
|
71
|
+
|
72
|
+
cairo_bool_t
|
73
|
+
rb_cairo__is_kind_of (VALUE object, VALUE klass)
|
74
|
+
{
|
75
|
+
return RVAL2CBOOL (rb_obj_is_kind_of (object, klass));
|
76
|
+
}
|
77
|
+
|
78
|
+
rb_cairo__object_holder_t *
|
79
|
+
rb_cairo__object_holder_new (VALUE klass, VALUE object)
|
80
|
+
{
|
81
|
+
rb_cairo__object_holder_t *holder;
|
82
|
+
|
83
|
+
holder = ALLOC(rb_cairo__object_holder_t);
|
84
|
+
rb_cairo__gc_guard_add (klass, object);
|
85
|
+
holder->object = object;
|
86
|
+
return holder;
|
87
|
+
}
|
88
|
+
|
89
|
+
void
|
90
|
+
rb_cairo__object_holder_free (VALUE klass, void *ptr)
|
91
|
+
{
|
92
|
+
rb_cairo__object_holder_t *holder = ptr;
|
93
|
+
|
94
|
+
if (!NIL_P (holder->object))
|
95
|
+
rb_cairo__gc_guard_remove (klass, holder->object);
|
96
|
+
|
97
|
+
xfree (holder);
|
98
|
+
}
|
99
|
+
|
100
|
+
void
|
101
|
+
rb_cairo__initialize_gc_guard_holder_class (VALUE klass)
|
102
|
+
{
|
103
|
+
rb_ivar_set (klass, cr_id_objects, rb_hash_new ());
|
104
|
+
}
|
105
|
+
|
106
|
+
void
|
107
|
+
rb_cairo__gc_guard_add (VALUE klass, VALUE object)
|
108
|
+
{
|
109
|
+
rb_hash_aset (rb_ivar_get (klass, cr_id_objects), object, Qnil);
|
110
|
+
}
|
111
|
+
|
112
|
+
void
|
113
|
+
rb_cairo__gc_guard_remove (VALUE klass, VALUE object)
|
114
|
+
{
|
115
|
+
rb_hash_delete (rb_ivar_get (klass, cr_id_objects), object);
|
116
|
+
}
|
117
|
+
|
118
|
+
VALUE
|
119
|
+
rb_cairo__gc_guarded_objects (VALUE klass)
|
120
|
+
{
|
121
|
+
return rb_funcall (rb_ivar_get (klass, cr_id_objects), cr_id_dup, 0);
|
122
|
+
}
|
123
|
+
|
124
|
+
const char *
|
125
|
+
rb_cairo__inspect (VALUE object)
|
126
|
+
{
|
127
|
+
VALUE inspected;
|
128
|
+
|
129
|
+
inspected = rb_funcall (object, cr_id_inspect, 0);
|
130
|
+
return RSTRING_PTR (inspected);
|
131
|
+
}
|
132
|
+
|
133
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
134
|
+
VALUE
|
135
|
+
rb_cairo__glyphs_to_ruby_object (cairo_glyph_t *glyphs, int num_glyphs)
|
136
|
+
{
|
137
|
+
int i;
|
138
|
+
VALUE rb_glyphs;
|
139
|
+
|
140
|
+
rb_glyphs = rb_ary_new2 (num_glyphs);
|
141
|
+
for (i = 0; i < num_glyphs; i++)
|
142
|
+
{
|
143
|
+
RARRAY_PTR (rb_glyphs)[i] = CRGLYPH2RVAL (glyphs + i);
|
144
|
+
}
|
145
|
+
|
146
|
+
return rb_glyphs;
|
147
|
+
}
|
148
|
+
|
149
|
+
void
|
150
|
+
rb_cairo__glyphs_from_ruby_object (VALUE rb_glyphs,
|
151
|
+
cairo_glyph_t **glyphs, int *num_glyphs)
|
152
|
+
{
|
153
|
+
int i, len;
|
154
|
+
|
155
|
+
if (NIL_P (rb_glyphs))
|
156
|
+
{
|
157
|
+
*num_glyphs = -1;
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
|
161
|
+
len = RARRAY_LEN (rb_glyphs);
|
162
|
+
if (*num_glyphs < len)
|
163
|
+
*glyphs = cairo_glyph_allocate (len);
|
164
|
+
*num_glyphs = len;
|
165
|
+
for (i = 0; i < len; i++)
|
166
|
+
{
|
167
|
+
cairo_glyph_t *glyph;
|
168
|
+
|
169
|
+
glyph = *glyphs + i;
|
170
|
+
*glyph = *(RVAL2CRGLYPH (RARRAY_PTR (rb_glyphs)[i]));
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
VALUE
|
175
|
+
rb_cairo__text_clusters_to_ruby_object (cairo_text_cluster_t *clusters,
|
176
|
+
int num_clusters)
|
177
|
+
{
|
178
|
+
int i;
|
179
|
+
VALUE rb_clusters;
|
180
|
+
|
181
|
+
rb_clusters = rb_ary_new2 (num_clusters);
|
182
|
+
for (i = 0; i < num_clusters; i++)
|
183
|
+
{
|
184
|
+
RARRAY_PTR (rb_clusters)[i] = CRTEXTCLUSTER2RVAL (clusters + i);
|
185
|
+
}
|
186
|
+
|
187
|
+
return rb_clusters;
|
188
|
+
}
|
189
|
+
|
190
|
+
void
|
191
|
+
rb_cairo__text_clusters_from_ruby_object (VALUE rb_clusters,
|
192
|
+
cairo_text_cluster_t **clusters,
|
193
|
+
int *num_clusters)
|
194
|
+
{
|
195
|
+
int i, len;
|
196
|
+
|
197
|
+
if (NIL_P (rb_clusters))
|
198
|
+
{
|
199
|
+
*num_clusters = -1;
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
|
203
|
+
len = RARRAY_LEN (rb_clusters);
|
204
|
+
if (*num_clusters < len)
|
205
|
+
*clusters = cairo_text_cluster_allocate (len);
|
206
|
+
*num_clusters = len;
|
207
|
+
for (i = 0; i < len; i++)
|
208
|
+
{
|
209
|
+
cairo_text_cluster_t *cluster;
|
210
|
+
|
211
|
+
cluster = *clusters + i;
|
212
|
+
*cluster = *(RVAL2CRTEXTCLUSTER (RARRAY_PTR (rb_clusters)[i]));
|
213
|
+
}
|
214
|
+
}
|
215
|
+
#endif
|
216
|
+
|
217
|
+
VALUE
|
218
|
+
rb_cairo__invoke_callback (cr_callback_func_t func, VALUE data)
|
219
|
+
{
|
220
|
+
int state = 0;
|
221
|
+
VALUE result, exception;
|
222
|
+
|
223
|
+
result = rb_protect (func, data, &state);
|
224
|
+
if (state)
|
225
|
+
{
|
226
|
+
exception = RB_ERRINFO;
|
227
|
+
if (exception)
|
228
|
+
rb_funcall (rb_mCairo, cr_id_exit_application, 2,
|
229
|
+
exception, INT2NUM (EXIT_FAILURE));
|
230
|
+
}
|
231
|
+
return result;
|
232
|
+
}
|
233
|
+
|
234
|
+
void
|
235
|
+
Init_cairo_private (void)
|
236
|
+
{
|
237
|
+
cr_id_normalize_const_name = rb_intern ("normalize_const_name");
|
238
|
+
cr_id_objects = rb_intern ("objects");
|
239
|
+
cr_id_dup = rb_intern ("dup");
|
240
|
+
cr_id_inspect = rb_intern ("inspect");
|
241
|
+
cr_id_exit_application = rb_intern ("exit_application");
|
242
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-17 07:21:42 $
|
7
|
+
*
|
8
|
+
* Copyright 2005-2008 Kouhei Sutou <kou@cozmixng.org>
|
9
|
+
*
|
10
|
+
* This file is made available under the same terms as Ruby
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef RB_CAIRO_PRIVATE_H
|
15
|
+
#define RB_CAIRO_PRIVATE_H
|
16
|
+
|
17
|
+
#define CR_TRUE 1
|
18
|
+
#define CR_FALSE 0
|
19
|
+
|
20
|
+
#define CAIRO_INT_STATUS_UNSUPPORTED 100
|
21
|
+
|
22
|
+
#define CSTR2RVAL(str) rb_str_new2(str)
|
23
|
+
#define RVAL2CSTR(str) StringValueCStr(str)
|
24
|
+
|
25
|
+
#define CBOOL2RVAL(bool) (bool ? Qtrue : Qfalse)
|
26
|
+
#define RVAL2CBOOL(bool) RTEST(bool)
|
27
|
+
|
28
|
+
#ifndef RSTRING_LEN
|
29
|
+
# define RSTRING_LEN(string) (RSTRING(string)->len)
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#ifndef RARRAY_PTR
|
33
|
+
# define RARRAY_PTR(array) (RARRAY(array)->ptr)
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#ifndef RARRAY_LEN
|
37
|
+
# define RARRAY_LEN(array) (RARRAY(array)->len)
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#ifdef HAVE_RB_ERRINFO
|
41
|
+
# define RB_ERRINFO (rb_errinfo())
|
42
|
+
#else
|
43
|
+
# define RB_ERRINFO (ruby_errinfo)
|
44
|
+
#endif
|
45
|
+
|
46
|
+
extern void Init_cairo_private (void);
|
47
|
+
extern void Init_cairo_constants (void);
|
48
|
+
|
49
|
+
extern void Init_cairo_context (void);
|
50
|
+
extern void Init_cairo_path (void);
|
51
|
+
extern void Init_cairo_matrix (void);
|
52
|
+
extern void Init_cairo_surface (void);
|
53
|
+
extern void Init_cairo_quartz_surface (void);
|
54
|
+
extern void Init_cairo_exception (void);
|
55
|
+
extern void Init_cairo_font (void);
|
56
|
+
extern void Init_cairo_font_extents (void);
|
57
|
+
extern void Init_cairo_font_options (void);
|
58
|
+
extern void Init_cairo_scaled_font (void);
|
59
|
+
extern void Init_cairo_text_extents (void);
|
60
|
+
extern void Init_cairo_pattern (void);
|
61
|
+
extern void Init_cairo_glyph (void);
|
62
|
+
extern void Init_cairo_text_cluster (void);
|
63
|
+
|
64
|
+
#define RB_CAIRO__GLYPHS_TO_ARRAY(rb_array, glyphs, length) \
|
65
|
+
do \
|
66
|
+
{ \
|
67
|
+
Check_Type (rb_array, T_ARRAY); \
|
68
|
+
length = RARRAY_LEN (rb_array); \
|
69
|
+
glyphs = ALLOCA_N (cairo_glyph_t, length); \
|
70
|
+
\
|
71
|
+
if (!glyphs) \
|
72
|
+
rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY); \
|
73
|
+
\
|
74
|
+
rb_cairo__glyphs_to_array (rb_array, glyphs, length); \
|
75
|
+
} while (0)
|
76
|
+
|
77
|
+
VALUE rb_cairo__float_array (double *values, unsigned count);
|
78
|
+
void rb_cairo__glyphs_to_array (VALUE rb_array, cairo_glyph_t *glyphs, int length);
|
79
|
+
|
80
|
+
VALUE rb_cairo__const_get (VALUE name, const char *prefix);
|
81
|
+
cairo_bool_t rb_cairo__is_kind_of (VALUE object, VALUE klass);
|
82
|
+
|
83
|
+
typedef struct rb_cairo__object_holder {
|
84
|
+
VALUE object;
|
85
|
+
} rb_cairo__object_holder_t;
|
86
|
+
|
87
|
+
rb_cairo__object_holder_t *rb_cairo__object_holder_new (VALUE klass, VALUE object);
|
88
|
+
void rb_cairo__object_holder_free (VALUE klass, void *ptr);
|
89
|
+
|
90
|
+
|
91
|
+
void rb_cairo__initialize_gc_guard_holder_class (VALUE klass);
|
92
|
+
void rb_cairo__gc_guard_add (VALUE klass, VALUE object);
|
93
|
+
void rb_cairo__gc_guard_remove (VALUE klass, VALUE object);
|
94
|
+
VALUE rb_cairo__gc_guarded_objects (VALUE klass);
|
95
|
+
|
96
|
+
const char *rb_cairo__inspect (VALUE object);
|
97
|
+
|
98
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
99
|
+
VALUE rb_cairo__glyphs_to_ruby_object (cairo_glyph_t *glyphs, int num_glyphs);
|
100
|
+
void rb_cairo__glyphs_from_ruby_object (VALUE rb_glyphs,
|
101
|
+
cairo_glyph_t **glyphs, int *num_glyphs);
|
102
|
+
VALUE rb_cairo__text_clusters_to_ruby_object (cairo_text_cluster_t *clusters,
|
103
|
+
int num_clusters);
|
104
|
+
void rb_cairo__text_clusters_from_ruby_object (VALUE rb_clusters,
|
105
|
+
cairo_text_cluster_t **clusters,
|
106
|
+
int *num_clusters);
|
107
|
+
#endif
|
108
|
+
|
109
|
+
cairo_status_t rb_cairo__exception_to_status (VALUE exception);
|
110
|
+
|
111
|
+
typedef VALUE (*cr_callback_func_t) (VALUE user_data);
|
112
|
+
VALUE rb_cairo__invoke_callback (cr_callback_func_t func, VALUE user_data);
|
113
|
+
|
114
|
+
#endif
|
@@ -0,0 +1,235 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-09-19 12:56:27 $
|
7
|
+
*
|
8
|
+
* Copyright 2005-2008 Kouhei Sutou <kou@cozmixng.org>
|
9
|
+
*
|
10
|
+
* This file is made available under the same terms as Ruby
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
#include "rb_cairo.h"
|
16
|
+
#include "rb_cairo_private.h"
|
17
|
+
|
18
|
+
VALUE rb_cCairo_ScaledFont;
|
19
|
+
|
20
|
+
#define _SELF(self) (RVAL2CRSCALEDFONT(self))
|
21
|
+
|
22
|
+
static inline void
|
23
|
+
cr_scaled_font_check_status (cairo_scaled_font_t *font)
|
24
|
+
{
|
25
|
+
rb_cairo_check_status (cairo_scaled_font_status (font));
|
26
|
+
}
|
27
|
+
|
28
|
+
cairo_scaled_font_t *
|
29
|
+
rb_cairo_scaled_font_from_ruby_object (VALUE obj)
|
30
|
+
{
|
31
|
+
cairo_scaled_font_t *font;
|
32
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_ScaledFont))
|
33
|
+
{
|
34
|
+
rb_raise (rb_eTypeError, "not a cairo scaled font");
|
35
|
+
}
|
36
|
+
Data_Get_Struct (obj, cairo_scaled_font_t, font);
|
37
|
+
return font;
|
38
|
+
}
|
39
|
+
|
40
|
+
static void
|
41
|
+
cr_scaled_font_free (void *ptr)
|
42
|
+
{
|
43
|
+
if (ptr)
|
44
|
+
{
|
45
|
+
cairo_scaled_font_destroy ((cairo_scaled_font_t *) ptr);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
VALUE
|
50
|
+
rb_cairo_scaled_font_to_ruby_object (cairo_scaled_font_t *font)
|
51
|
+
{
|
52
|
+
if (font)
|
53
|
+
{
|
54
|
+
cairo_scaled_font_reference (font);
|
55
|
+
return Data_Wrap_Struct (rb_cCairo_ScaledFont, NULL,
|
56
|
+
cr_scaled_font_free, font);
|
57
|
+
}
|
58
|
+
else
|
59
|
+
{
|
60
|
+
return Qnil;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
cr_scaled_font_allocate (VALUE klass)
|
66
|
+
{
|
67
|
+
return Data_Wrap_Struct (klass, NULL, cr_scaled_font_free, NULL);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
cr_scaled_font_initialize (VALUE self, VALUE face, VALUE matrix,
|
72
|
+
VALUE ctm, VALUE options)
|
73
|
+
{
|
74
|
+
cairo_scaled_font_t *font;
|
75
|
+
|
76
|
+
font = cairo_scaled_font_create (RVAL2CRFONTFACE (face),
|
77
|
+
RVAL2CRMATRIX (matrix),
|
78
|
+
RVAL2CRMATRIX (ctm),
|
79
|
+
RVAL2CRFONTOPTIONS (options));
|
80
|
+
cr_scaled_font_check_status (font);
|
81
|
+
DATA_PTR (self) = font;
|
82
|
+
return Qnil;
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
cr_scaled_font_extents (VALUE self)
|
87
|
+
{
|
88
|
+
cairo_font_extents_t extents;
|
89
|
+
cairo_scaled_font_extents (_SELF (self), &extents);
|
90
|
+
cr_scaled_font_check_status (_SELF (self));
|
91
|
+
return CRFONTEXTENTS2RVAL (&extents);
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
cr_scaled_font_text_extents (VALUE self, VALUE utf8)
|
96
|
+
{
|
97
|
+
cairo_text_extents_t extents;
|
98
|
+
cairo_scaled_font_text_extents (_SELF (self), StringValueCStr (utf8),
|
99
|
+
&extents);
|
100
|
+
cr_scaled_font_check_status (_SELF (self));
|
101
|
+
return CRTEXTEXTENTS2RVAL (&extents);
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
cr_scaled_font_glyph_extents (VALUE self, VALUE rb_glyphs)
|
106
|
+
{
|
107
|
+
cairo_text_extents_t extents;
|
108
|
+
cairo_glyph_t *glyphs;
|
109
|
+
int count;
|
110
|
+
|
111
|
+
RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count);
|
112
|
+
cairo_scaled_font_glyph_extents (_SELF (self), glyphs, count, &extents);
|
113
|
+
cr_scaled_font_check_status (_SELF (self));
|
114
|
+
return CRTEXTEXTENTS2RVAL (&extents);
|
115
|
+
}
|
116
|
+
|
117
|
+
#if CAIRO_CHECK_VERSION(1, 7, 6)
|
118
|
+
static VALUE
|
119
|
+
cr_scaled_font_text_to_glyphs (VALUE self, VALUE rb_x, VALUE rb_y, VALUE rb_utf8)
|
120
|
+
{
|
121
|
+
double x, y;
|
122
|
+
const char *utf8;
|
123
|
+
int utf8_len;
|
124
|
+
cairo_glyph_t *glyphs = NULL;
|
125
|
+
int num_glyphs;
|
126
|
+
cairo_text_cluster_t *clusters = NULL;
|
127
|
+
int num_clusters;
|
128
|
+
cairo_text_cluster_flags_t cluster_flags;
|
129
|
+
cairo_status_t status;
|
130
|
+
VALUE rb_glyphs, rb_clusters;
|
131
|
+
|
132
|
+
x = NUM2DBL (rb_x);
|
133
|
+
y = NUM2DBL (rb_y);
|
134
|
+
utf8 = RSTRING_PTR (rb_utf8);
|
135
|
+
utf8_len = RSTRING_LEN (rb_utf8);
|
136
|
+
|
137
|
+
status = cairo_scaled_font_text_to_glyphs (_SELF (self),
|
138
|
+
x, y, utf8, utf8_len,
|
139
|
+
&glyphs, &num_glyphs,
|
140
|
+
&clusters, &num_clusters,
|
141
|
+
&cluster_flags);
|
142
|
+
rb_cairo_check_status (status);
|
143
|
+
|
144
|
+
rb_glyphs = rb_cairo__glyphs_to_ruby_object (glyphs, num_glyphs);
|
145
|
+
cairo_glyph_free (glyphs);
|
146
|
+
rb_clusters = rb_cairo__text_clusters_to_ruby_object (clusters, num_clusters);
|
147
|
+
cairo_text_cluster_free (clusters);
|
148
|
+
|
149
|
+
return rb_ary_new3 (3, rb_glyphs, rb_clusters, INT2NUM (cluster_flags));
|
150
|
+
}
|
151
|
+
#endif
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
cr_scaled_font_get_font_face (VALUE self)
|
155
|
+
{
|
156
|
+
cairo_font_face_t *face;
|
157
|
+
face = cairo_scaled_font_get_font_face (_SELF (self));
|
158
|
+
cr_scaled_font_check_status (_SELF (self));
|
159
|
+
return CRFONTFACE2RVAL (face);
|
160
|
+
}
|
161
|
+
|
162
|
+
static VALUE
|
163
|
+
cr_scaled_font_get_font_matrix (VALUE self)
|
164
|
+
{
|
165
|
+
cairo_matrix_t font_matrix;
|
166
|
+
cairo_scaled_font_get_font_matrix (_SELF (self), &font_matrix);
|
167
|
+
cr_scaled_font_check_status (_SELF (self));
|
168
|
+
return CRMATRIX2RVAL (&font_matrix);
|
169
|
+
}
|
170
|
+
|
171
|
+
static VALUE
|
172
|
+
cr_scaled_font_get_ctm (VALUE self)
|
173
|
+
{
|
174
|
+
cairo_matrix_t ctm;
|
175
|
+
cairo_scaled_font_get_font_matrix (_SELF (self), &ctm);
|
176
|
+
cr_scaled_font_check_status (_SELF (self));
|
177
|
+
return CRMATRIX2RVAL (&ctm);
|
178
|
+
}
|
179
|
+
|
180
|
+
static VALUE
|
181
|
+
cr_scaled_font_get_font_options (VALUE self)
|
182
|
+
{
|
183
|
+
cairo_font_options_t *options;
|
184
|
+
|
185
|
+
options = cairo_font_options_create();
|
186
|
+
cairo_scaled_font_get_font_options (_SELF (self), options);
|
187
|
+
cr_scaled_font_check_status (_SELF (self));
|
188
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
189
|
+
return CRFONTOPTIONS2RVAL (options);
|
190
|
+
}
|
191
|
+
|
192
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
193
|
+
static VALUE
|
194
|
+
cr_scaled_font_get_scale_matrix (VALUE self)
|
195
|
+
{
|
196
|
+
cairo_matrix_t matrix;
|
197
|
+
|
198
|
+
cairo_scaled_font_get_scale_matrix (_SELF (self), &matrix);
|
199
|
+
cr_scaled_font_check_status (_SELF (self));
|
200
|
+
return CRMATRIX2RVAL (&matrix);
|
201
|
+
}
|
202
|
+
#endif
|
203
|
+
|
204
|
+
void
|
205
|
+
Init_cairo_scaled_font (void)
|
206
|
+
{
|
207
|
+
rb_cCairo_ScaledFont =
|
208
|
+
rb_define_class_under (rb_mCairo, "ScaledFont", rb_cObject);
|
209
|
+
|
210
|
+
rb_define_alloc_func (rb_cCairo_ScaledFont, cr_scaled_font_allocate);
|
211
|
+
|
212
|
+
rb_define_method (rb_cCairo_ScaledFont, "initialize",
|
213
|
+
cr_scaled_font_initialize, 4);
|
214
|
+
|
215
|
+
rb_define_method (rb_cCairo_ScaledFont, "extents", cr_scaled_font_extents, 0);
|
216
|
+
rb_define_method (rb_cCairo_ScaledFont, "text_extents",
|
217
|
+
cr_scaled_font_text_extents, 1);
|
218
|
+
rb_define_method (rb_cCairo_ScaledFont, "glyph_extents",
|
219
|
+
cr_scaled_font_glyph_extents, 1);
|
220
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
221
|
+
rb_define_method (rb_cCairo_ScaledFont, "text_to_glyphs",
|
222
|
+
cr_scaled_font_text_to_glyphs, 3);
|
223
|
+
#endif
|
224
|
+
rb_define_method (rb_cCairo_ScaledFont, "font_face",
|
225
|
+
cr_scaled_font_get_font_face, 0);
|
226
|
+
rb_define_method (rb_cCairo_ScaledFont, "font_matrix",
|
227
|
+
cr_scaled_font_get_font_matrix, 0);
|
228
|
+
rb_define_method (rb_cCairo_ScaledFont, "ctm", cr_scaled_font_get_ctm, 0);
|
229
|
+
rb_define_method (rb_cCairo_ScaledFont, "font_options",
|
230
|
+
cr_scaled_font_get_font_options, 0);
|
231
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
232
|
+
rb_define_method (rb_cCairo_ScaledFont, "scale_matrix",
|
233
|
+
cr_scaled_font_get_scale_matrix, 0);
|
234
|
+
#endif
|
235
|
+
}
|