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,354 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-16 12:52:16 $
|
7
|
+
*
|
8
|
+
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
9
|
+
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
10
|
+
*
|
11
|
+
* This file is made available under the same terms as Ruby
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#include "rb_cairo.h"
|
16
|
+
#include "rb_cairo_private.h"
|
17
|
+
|
18
|
+
static VALUE rb_eCairo_InvalidRestoreError;
|
19
|
+
static VALUE rb_eCairo_InvalidPopGroupError;
|
20
|
+
static VALUE rb_eCairo_NoCurrentPointError;
|
21
|
+
static VALUE rb_eCairo_InvalidMatrixError;
|
22
|
+
static VALUE rb_eCairo_InvalidStatusError;
|
23
|
+
static VALUE rb_eCairo_NullPointerError;
|
24
|
+
static VALUE rb_eCairo_InvalidStringError;
|
25
|
+
static VALUE rb_eCairo_InvalidPathDataError;
|
26
|
+
static VALUE rb_eCairo_ReadError;
|
27
|
+
static VALUE rb_eCairo_WriteError;
|
28
|
+
static VALUE rb_eCairo_SurfaceFinishedError;
|
29
|
+
static VALUE rb_eCairo_SurfaceTypeMismatchError;
|
30
|
+
static VALUE rb_eCairo_PatternTypeMismatchError;
|
31
|
+
static VALUE rb_eCairo_InvalidContentError;
|
32
|
+
static VALUE rb_eCairo_InvalidFormatError;
|
33
|
+
static VALUE rb_eCairo_InvalidVisualError;
|
34
|
+
static VALUE rb_eCairo_FileNotFoundError;
|
35
|
+
static VALUE rb_eCairo_InvalidDashError;
|
36
|
+
static VALUE rb_eCairo_InvalidDscCommentError;
|
37
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
38
|
+
static VALUE rb_eCairo_InvalidIndexError;
|
39
|
+
static VALUE rb_eCairo_ClipNotRepresentableError;
|
40
|
+
#endif
|
41
|
+
#if CAIRO_CHECK_VERSION(1, 5, 6)
|
42
|
+
static VALUE rb_eCairo_TempFileError;
|
43
|
+
static VALUE rb_eCairo_InvalidStrideError;
|
44
|
+
#endif
|
45
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
46
|
+
static VALUE rb_eCairo_FontTypeMismatch;
|
47
|
+
static VALUE rb_eCairo_UserFontImmutable;
|
48
|
+
static VALUE rb_eCairo_UserFontError;
|
49
|
+
static VALUE rb_eCairo_NegativeCount;
|
50
|
+
static VALUE rb_eCairo_InvalidClusters;
|
51
|
+
static VALUE rb_eCairo_InvalidSlant;
|
52
|
+
static VALUE rb_eCairo_InvalidWeight;
|
53
|
+
#endif
|
54
|
+
|
55
|
+
void
|
56
|
+
rb_cairo_check_status (cairo_status_t status)
|
57
|
+
{
|
58
|
+
const char *string = cairo_status_to_string (status);
|
59
|
+
|
60
|
+
switch (status)
|
61
|
+
{
|
62
|
+
case CAIRO_STATUS_SUCCESS:
|
63
|
+
break;
|
64
|
+
case CAIRO_STATUS_NO_MEMORY:
|
65
|
+
rb_raise (rb_eNoMemError, string);
|
66
|
+
break;
|
67
|
+
case CAIRO_STATUS_INVALID_RESTORE:
|
68
|
+
rb_raise (rb_eCairo_InvalidRestoreError, string);
|
69
|
+
break;
|
70
|
+
case CAIRO_STATUS_INVALID_POP_GROUP:
|
71
|
+
rb_raise (rb_eCairo_InvalidPopGroupError, string);
|
72
|
+
break;
|
73
|
+
case CAIRO_STATUS_NO_CURRENT_POINT:
|
74
|
+
rb_raise (rb_eCairo_NoCurrentPointError, string);
|
75
|
+
break;
|
76
|
+
case CAIRO_STATUS_INVALID_MATRIX:
|
77
|
+
rb_raise (rb_eCairo_InvalidMatrixError, string);
|
78
|
+
break;
|
79
|
+
case CAIRO_STATUS_INVALID_STATUS:
|
80
|
+
rb_raise (rb_eCairo_InvalidStatusError, string);
|
81
|
+
break;
|
82
|
+
case CAIRO_STATUS_NULL_POINTER:
|
83
|
+
rb_raise (rb_eCairo_NullPointerError, string);
|
84
|
+
break;
|
85
|
+
case CAIRO_STATUS_INVALID_STRING:
|
86
|
+
rb_raise (rb_eCairo_InvalidStringError, string);
|
87
|
+
break;
|
88
|
+
case CAIRO_STATUS_INVALID_PATH_DATA:
|
89
|
+
rb_raise (rb_eCairo_InvalidPathDataError, string);
|
90
|
+
break;
|
91
|
+
case CAIRO_STATUS_READ_ERROR:
|
92
|
+
rb_raise (rb_eCairo_ReadError, string);
|
93
|
+
break;
|
94
|
+
case CAIRO_STATUS_WRITE_ERROR:
|
95
|
+
rb_raise (rb_eCairo_WriteError, string);
|
96
|
+
break;
|
97
|
+
case CAIRO_STATUS_SURFACE_FINISHED:
|
98
|
+
rb_raise (rb_eCairo_SurfaceFinishedError, string);
|
99
|
+
break;
|
100
|
+
case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
|
101
|
+
rb_raise (rb_eCairo_SurfaceTypeMismatchError, string);
|
102
|
+
break;
|
103
|
+
case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
|
104
|
+
rb_raise (rb_eCairo_PatternTypeMismatchError, string);
|
105
|
+
break;
|
106
|
+
case CAIRO_STATUS_INVALID_CONTENT:
|
107
|
+
rb_raise (rb_eCairo_InvalidContentError, string);
|
108
|
+
break;
|
109
|
+
case CAIRO_STATUS_INVALID_FORMAT:
|
110
|
+
rb_raise (rb_eCairo_InvalidFormatError, string);
|
111
|
+
break;
|
112
|
+
case CAIRO_STATUS_INVALID_VISUAL:
|
113
|
+
rb_raise (rb_eCairo_InvalidVisualError, string);
|
114
|
+
break;
|
115
|
+
case CAIRO_STATUS_FILE_NOT_FOUND:
|
116
|
+
rb_raise (rb_eCairo_FileNotFoundError, string);
|
117
|
+
break;
|
118
|
+
case CAIRO_STATUS_INVALID_DASH:
|
119
|
+
rb_raise (rb_eCairo_InvalidDashError, string);
|
120
|
+
break;
|
121
|
+
case CAIRO_STATUS_INVALID_DSC_COMMENT:
|
122
|
+
rb_raise (rb_eCairo_InvalidDscCommentError, string);
|
123
|
+
break;
|
124
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
125
|
+
case CAIRO_STATUS_INVALID_INDEX:
|
126
|
+
rb_raise (rb_eCairo_InvalidIndexError, string);
|
127
|
+
break;
|
128
|
+
case CAIRO_STATUS_CLIP_NOT_REPRESENTABLE:
|
129
|
+
rb_raise (rb_eCairo_ClipNotRepresentableError, string);
|
130
|
+
break;
|
131
|
+
#endif
|
132
|
+
#if CAIRO_CHECK_VERSION(1, 5, 6)
|
133
|
+
case CAIRO_STATUS_TEMP_FILE_ERROR:
|
134
|
+
rb_raise (rb_eCairo_TempFileError, string);
|
135
|
+
break;
|
136
|
+
case CAIRO_STATUS_INVALID_STRIDE:
|
137
|
+
rb_raise (rb_eCairo_InvalidStringError, string);
|
138
|
+
break;
|
139
|
+
#endif
|
140
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
141
|
+
case CAIRO_STATUS_FONT_TYPE_MISMATCH:
|
142
|
+
rb_raise (rb_eCairo_FontTypeMismatch, string);
|
143
|
+
break;
|
144
|
+
case CAIRO_STATUS_USER_FONT_IMMUTABLE:
|
145
|
+
rb_raise (rb_eCairo_UserFontImmutable, string);
|
146
|
+
break;
|
147
|
+
case CAIRO_STATUS_USER_FONT_ERROR:
|
148
|
+
rb_raise (rb_eCairo_UserFontError, string);
|
149
|
+
break;
|
150
|
+
case CAIRO_STATUS_NEGATIVE_COUNT:
|
151
|
+
rb_raise (rb_eCairo_NegativeCount, string);
|
152
|
+
break;
|
153
|
+
case CAIRO_STATUS_INVALID_CLUSTERS:
|
154
|
+
rb_raise (rb_eCairo_InvalidClusters, string);
|
155
|
+
break;
|
156
|
+
case CAIRO_STATUS_INVALID_SLANT:
|
157
|
+
rb_raise (rb_eCairo_InvalidSlant, string);
|
158
|
+
break;
|
159
|
+
case CAIRO_STATUS_INVALID_WEIGHT:
|
160
|
+
rb_raise (rb_eCairo_InvalidWeight, string);
|
161
|
+
break;
|
162
|
+
#endif
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
cairo_status_t
|
167
|
+
rb_cairo__exception_to_status (VALUE exception)
|
168
|
+
{
|
169
|
+
if (NIL_P (exception))
|
170
|
+
return CAIRO_STATUS_SUCCESS;
|
171
|
+
else if (rb_cairo__is_kind_of (exception, rb_eNoMemError))
|
172
|
+
return CAIRO_STATUS_NO_MEMORY;
|
173
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidRestoreError))
|
174
|
+
return CAIRO_STATUS_INVALID_RESTORE;
|
175
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPopGroupError))
|
176
|
+
return CAIRO_STATUS_INVALID_POP_GROUP;
|
177
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NoCurrentPointError))
|
178
|
+
return CAIRO_STATUS_NO_CURRENT_POINT;
|
179
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidMatrixError))
|
180
|
+
return CAIRO_STATUS_INVALID_MATRIX;
|
181
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStatusError))
|
182
|
+
return CAIRO_STATUS_INVALID_STATUS;
|
183
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NullPointerError))
|
184
|
+
return CAIRO_STATUS_NULL_POINTER;
|
185
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError))
|
186
|
+
return CAIRO_STATUS_INVALID_STRING;
|
187
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPathDataError))
|
188
|
+
return CAIRO_STATUS_INVALID_PATH_DATA;
|
189
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_ReadError))
|
190
|
+
return CAIRO_STATUS_READ_ERROR;
|
191
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_WriteError))
|
192
|
+
return CAIRO_STATUS_WRITE_ERROR;
|
193
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceFinishedError))
|
194
|
+
return CAIRO_STATUS_SURFACE_FINISHED;
|
195
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceTypeMismatchError))
|
196
|
+
return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
|
197
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_PatternTypeMismatchError))
|
198
|
+
return CAIRO_STATUS_PATTERN_TYPE_MISMATCH;
|
199
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidContentError))
|
200
|
+
return CAIRO_STATUS_INVALID_CONTENT;
|
201
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidFormatError))
|
202
|
+
return CAIRO_STATUS_INVALID_FORMAT;
|
203
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidVisualError))
|
204
|
+
return CAIRO_STATUS_INVALID_VISUAL;
|
205
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_FileNotFoundError))
|
206
|
+
return CAIRO_STATUS_FILE_NOT_FOUND;
|
207
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDashError))
|
208
|
+
return CAIRO_STATUS_INVALID_DASH;
|
209
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDscCommentError))
|
210
|
+
return CAIRO_STATUS_INVALID_DSC_COMMENT;
|
211
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
212
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidIndexError))
|
213
|
+
return CAIRO_STATUS_INVALID_INDEX;
|
214
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_ClipNotRepresentableError))
|
215
|
+
return CAIRO_STATUS_CLIP_NOT_REPRESENTABLE;
|
216
|
+
#endif
|
217
|
+
#if CAIRO_CHECK_VERSION(1, 5, 6)
|
218
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_TempFileError))
|
219
|
+
return CAIRO_STATUS_TEMP_FILE_ERROR;
|
220
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError))
|
221
|
+
return CAIRO_STATUS_INVALID_STRIDE;
|
222
|
+
#endif
|
223
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
224
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_FontTypeMismatch))
|
225
|
+
return CAIRO_STATUS_FONT_TYPE_MISMATCH;
|
226
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontImmutable))
|
227
|
+
return CAIRO_STATUS_USER_FONT_IMMUTABLE;
|
228
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontError))
|
229
|
+
return CAIRO_STATUS_USER_FONT_ERROR;
|
230
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NegativeCount))
|
231
|
+
return CAIRO_STATUS_NEGATIVE_COUNT;
|
232
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidClusters))
|
233
|
+
return CAIRO_STATUS_INVALID_CLUSTERS;
|
234
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidSlant))
|
235
|
+
return CAIRO_STATUS_INVALID_SLANT;
|
236
|
+
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidWeight))
|
237
|
+
return CAIRO_STATUS_INVALID_WEIGHT;
|
238
|
+
#endif
|
239
|
+
|
240
|
+
return -1;
|
241
|
+
}
|
242
|
+
|
243
|
+
void
|
244
|
+
Init_cairo_exception ()
|
245
|
+
{
|
246
|
+
VALUE rb_eCairo_Error;
|
247
|
+
rb_eCairo_Error =
|
248
|
+
rb_define_class_under (rb_mCairo, "Error", rb_eStandardError);
|
249
|
+
rb_eCairo_InvalidRestoreError =
|
250
|
+
rb_define_class_under (rb_mCairo, "InvalidRestoreError",
|
251
|
+
rb_eCairo_Error);
|
252
|
+
rb_eCairo_InvalidPopGroupError =
|
253
|
+
rb_define_class_under (rb_mCairo, "InvalidPopGroupError",
|
254
|
+
rb_eCairo_Error);
|
255
|
+
rb_eCairo_NoCurrentPointError =
|
256
|
+
rb_define_class_under (rb_mCairo, "NoCurrentPointError",
|
257
|
+
rb_eCairo_Error);
|
258
|
+
rb_eCairo_InvalidMatrixError =
|
259
|
+
rb_define_class_under (rb_mCairo, "InvalidMatrixError",
|
260
|
+
rb_eArgError);
|
261
|
+
rb_eCairo_InvalidStatusError =
|
262
|
+
rb_define_class_under (rb_mCairo, "InvalidStatusError",
|
263
|
+
rb_eArgError);
|
264
|
+
rb_eCairo_NullPointerError =
|
265
|
+
rb_define_class_under (rb_mCairo, "NullPointerError",
|
266
|
+
rb_eTypeError);
|
267
|
+
rb_eCairo_InvalidStringError =
|
268
|
+
rb_define_class_under (rb_mCairo, "InvalidStringError",
|
269
|
+
rb_eArgError);
|
270
|
+
rb_eCairo_InvalidPathDataError =
|
271
|
+
rb_define_class_under (rb_mCairo, "InvalidPathDataError",
|
272
|
+
rb_eArgError);
|
273
|
+
rb_eCairo_ReadError =
|
274
|
+
rb_define_class_under (rb_mCairo, "ReadError",
|
275
|
+
rb_eIOError);
|
276
|
+
rb_eCairo_WriteError =
|
277
|
+
rb_define_class_under (rb_mCairo, "WriteError",
|
278
|
+
rb_eIOError);
|
279
|
+
rb_eCairo_SurfaceFinishedError =
|
280
|
+
rb_define_class_under (rb_mCairo, "SurfaceFinishedError",
|
281
|
+
rb_eCairo_Error);
|
282
|
+
rb_eCairo_SurfaceTypeMismatchError =
|
283
|
+
rb_define_class_under (rb_mCairo, "SurfaceTypeMismatchError",
|
284
|
+
rb_eTypeError);
|
285
|
+
rb_eCairo_PatternTypeMismatchError =
|
286
|
+
rb_define_class_under (rb_mCairo, "PatternTypeMismatchError",
|
287
|
+
rb_eTypeError);
|
288
|
+
rb_eCairo_InvalidContentError =
|
289
|
+
rb_define_class_under (rb_mCairo, "InvalidContentError",
|
290
|
+
rb_eArgError);
|
291
|
+
rb_eCairo_InvalidFormatError =
|
292
|
+
rb_define_class_under (rb_mCairo, "InvalidFormatError",
|
293
|
+
rb_eArgError);
|
294
|
+
rb_eCairo_InvalidVisualError =
|
295
|
+
rb_define_class_under (rb_mCairo, "InvalidVisualError",
|
296
|
+
rb_eArgError);
|
297
|
+
rb_eCairo_FileNotFoundError =
|
298
|
+
rb_define_class_under (rb_mCairo, "FileNotFound",
|
299
|
+
rb_eCairo_Error);
|
300
|
+
rb_eCairo_InvalidDashError =
|
301
|
+
rb_define_class_under (rb_mCairo, "InvalidDashError",
|
302
|
+
rb_eArgError);
|
303
|
+
rb_eCairo_InvalidDscCommentError =
|
304
|
+
rb_define_class_under (rb_mCairo, "InvalidDscCommentError",
|
305
|
+
rb_eArgError);
|
306
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
307
|
+
rb_eCairo_InvalidIndexError =
|
308
|
+
rb_define_class_under (rb_mCairo, "InvalidIndexError",
|
309
|
+
rb_eArgError);
|
310
|
+
rb_eCairo_ClipNotRepresentableError =
|
311
|
+
rb_define_class_under (rb_mCairo, "ClipNotRepresentableError",
|
312
|
+
rb_eCairo_Error);
|
313
|
+
#endif
|
314
|
+
|
315
|
+
#if CAIRO_CHECK_VERSION(1, 5, 6)
|
316
|
+
rb_eCairo_TempFileError =
|
317
|
+
rb_define_class_under (rb_mCairo, "TempFileError",
|
318
|
+
rb_eCairo_Error);
|
319
|
+
|
320
|
+
rb_eCairo_InvalidStrideError =
|
321
|
+
rb_define_class_under (rb_mCairo, "InvalidStrideError",
|
322
|
+
rb_eArgError);
|
323
|
+
#endif
|
324
|
+
|
325
|
+
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
326
|
+
rb_eCairo_FontTypeMismatch =
|
327
|
+
rb_define_class_under (rb_mCairo, "FontTypeMismatch",
|
328
|
+
rb_eCairo_Error);
|
329
|
+
|
330
|
+
rb_eCairo_UserFontImmutable =
|
331
|
+
rb_define_class_under (rb_mCairo, "UserFontImmutable",
|
332
|
+
rb_eCairo_Error);
|
333
|
+
|
334
|
+
rb_eCairo_UserFontError =
|
335
|
+
rb_define_class_under (rb_mCairo, "UserFontError",
|
336
|
+
rb_eCairo_Error);
|
337
|
+
|
338
|
+
rb_eCairo_NegativeCount =
|
339
|
+
rb_define_class_under (rb_mCairo, "NegativeCount",
|
340
|
+
rb_eCairo_Error);
|
341
|
+
|
342
|
+
rb_eCairo_InvalidClusters =
|
343
|
+
rb_define_class_under (rb_mCairo, "InvalidClusters",
|
344
|
+
rb_eArgError);
|
345
|
+
|
346
|
+
rb_eCairo_InvalidSlant =
|
347
|
+
rb_define_class_under (rb_mCairo, "InvalidSlant",
|
348
|
+
rb_eCairo_Error);
|
349
|
+
|
350
|
+
rb_eCairo_InvalidWeight =
|
351
|
+
rb_define_class_under (rb_mCairo, "InvalidWeight",
|
352
|
+
rb_eArgError);
|
353
|
+
#endif
|
354
|
+
}
|
@@ -0,0 +1,200 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-17 05:12:37 $
|
7
|
+
*
|
8
|
+
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
9
|
+
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
10
|
+
*
|
11
|
+
* This file is made available under the same terms as Ruby
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#include "rb_cairo.h"
|
16
|
+
#include "rb_cairo_private.h"
|
17
|
+
|
18
|
+
VALUE rb_cCairo_FontExtents;
|
19
|
+
|
20
|
+
#define _SELF(self) (RVAL2CRFONTEXTENTS(self))
|
21
|
+
|
22
|
+
cairo_font_extents_t *
|
23
|
+
rb_cairo_font_extents_from_ruby_object (VALUE obj)
|
24
|
+
{
|
25
|
+
cairo_font_extents_t *extents;
|
26
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontExtents))
|
27
|
+
{
|
28
|
+
rb_raise (rb_eTypeError, "not a cairo font extents");
|
29
|
+
}
|
30
|
+
Data_Get_Struct (obj, cairo_font_extents_t, extents);
|
31
|
+
return extents;
|
32
|
+
}
|
33
|
+
|
34
|
+
VALUE
|
35
|
+
rb_cairo_font_extents_to_ruby_object (cairo_font_extents_t *extents)
|
36
|
+
{
|
37
|
+
if (extents)
|
38
|
+
{
|
39
|
+
cairo_font_extents_t *new_extents = ALLOC (cairo_font_extents_t);
|
40
|
+
*new_extents = *extents;
|
41
|
+
return Data_Wrap_Struct (rb_cCairo_FontExtents, NULL, -1, new_extents);
|
42
|
+
}
|
43
|
+
else
|
44
|
+
{
|
45
|
+
return Qnil;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
cr_font_extents_allocate (VALUE klass)
|
51
|
+
{
|
52
|
+
return Data_Wrap_Struct (klass, NULL, -1, NULL);
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
cr_font_extents_initialize (VALUE self)
|
57
|
+
{
|
58
|
+
cairo_font_extents_t *extents;
|
59
|
+
|
60
|
+
extents = ALLOC (cairo_font_extents_t);
|
61
|
+
extents->ascent = 1.0;
|
62
|
+
extents->descent = 0.0;
|
63
|
+
extents->height = 1.0;
|
64
|
+
extents->max_x_advance = 1.0;
|
65
|
+
extents->max_y_advance = 0.0;
|
66
|
+
|
67
|
+
DATA_PTR (self) = extents;
|
68
|
+
|
69
|
+
return Qnil;
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
cr_font_extents_ascent (VALUE self)
|
74
|
+
{
|
75
|
+
return rb_float_new (_SELF(self)->ascent);
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
cr_font_extents_set_ascent (VALUE self, VALUE ascent)
|
80
|
+
{
|
81
|
+
_SELF(self)->ascent = NUM2DBL (ascent);
|
82
|
+
return self;
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
cr_font_extents_descent (VALUE self)
|
87
|
+
{
|
88
|
+
return rb_float_new (_SELF(self)->descent);
|
89
|
+
}
|
90
|
+
|
91
|
+
static VALUE
|
92
|
+
cr_font_extents_set_descent (VALUE self, VALUE descent)
|
93
|
+
{
|
94
|
+
_SELF(self)->descent = NUM2DBL (descent);
|
95
|
+
return self;
|
96
|
+
}
|
97
|
+
|
98
|
+
static VALUE
|
99
|
+
cr_font_extents_height (VALUE self)
|
100
|
+
{
|
101
|
+
return rb_float_new (_SELF(self)->height);
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
cr_font_extents_set_height (VALUE self, VALUE height)
|
106
|
+
{
|
107
|
+
_SELF(self)->height = NUM2DBL (height);
|
108
|
+
return self;
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE
|
112
|
+
cr_font_extents_max_x_advance (VALUE self)
|
113
|
+
{
|
114
|
+
return rb_float_new (_SELF(self)->max_x_advance);
|
115
|
+
}
|
116
|
+
|
117
|
+
static VALUE
|
118
|
+
cr_font_extents_set_max_x_advance (VALUE self, VALUE max_x_advance)
|
119
|
+
{
|
120
|
+
_SELF(self)->max_x_advance = NUM2DBL (max_x_advance);
|
121
|
+
return self;
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
cr_font_extents_max_y_advance (VALUE self)
|
126
|
+
{
|
127
|
+
return rb_float_new (_SELF(self)->max_y_advance);
|
128
|
+
}
|
129
|
+
|
130
|
+
static VALUE
|
131
|
+
cr_font_extents_set_max_y_advance (VALUE self, VALUE max_y_advance)
|
132
|
+
{
|
133
|
+
_SELF(self)->max_y_advance = NUM2DBL (max_y_advance);
|
134
|
+
return self;
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE
|
138
|
+
cr_font_extents_to_s (VALUE self)
|
139
|
+
{
|
140
|
+
VALUE ret;
|
141
|
+
|
142
|
+
ret = rb_str_new2 ("#<");
|
143
|
+
rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
|
144
|
+
rb_str_cat2 (ret, ": ");
|
145
|
+
rb_str_cat2 (ret, "ascent=");
|
146
|
+
rb_str_concat (ret, rb_inspect (cr_font_extents_ascent (self)));
|
147
|
+
rb_str_cat2 (ret, ", ");
|
148
|
+
rb_str_cat2 (ret, "descent=");
|
149
|
+
rb_str_concat (ret, rb_inspect (cr_font_extents_descent (self)));
|
150
|
+
rb_str_cat2 (ret, ", ");
|
151
|
+
rb_str_cat2 (ret, "height=");
|
152
|
+
rb_str_concat (ret, rb_inspect (cr_font_extents_height (self)));
|
153
|
+
rb_str_cat2 (ret, ", ");
|
154
|
+
rb_str_cat2 (ret, "max_x_advance=");
|
155
|
+
rb_str_concat (ret, rb_inspect (cr_font_extents_max_x_advance (self)));
|
156
|
+
rb_str_cat2 (ret, ", ");
|
157
|
+
rb_str_cat2 (ret, "max_y_advance=");
|
158
|
+
rb_str_concat (ret, rb_inspect (cr_font_extents_max_y_advance (self)));
|
159
|
+
rb_str_cat2 (ret, ">");
|
160
|
+
|
161
|
+
return ret;
|
162
|
+
}
|
163
|
+
|
164
|
+
|
165
|
+
void
|
166
|
+
Init_cairo_font_extents (void)
|
167
|
+
{
|
168
|
+
rb_cCairo_FontExtents =
|
169
|
+
rb_define_class_under (rb_mCairo, "FontExtents", rb_cObject);
|
170
|
+
|
171
|
+
rb_define_alloc_func (rb_cCairo_FontExtents, cr_font_extents_allocate);
|
172
|
+
|
173
|
+
rb_define_method (rb_cCairo_FontExtents, "initialize",
|
174
|
+
cr_font_extents_initialize, 0);
|
175
|
+
|
176
|
+
rb_define_method (rb_cCairo_FontExtents, "ascent",
|
177
|
+
cr_font_extents_ascent, 0);
|
178
|
+
rb_define_method (rb_cCairo_FontExtents, "set_ascent",
|
179
|
+
cr_font_extents_set_ascent, 1);
|
180
|
+
rb_define_method (rb_cCairo_FontExtents, "descent",
|
181
|
+
cr_font_extents_descent, 0);
|
182
|
+
rb_define_method (rb_cCairo_FontExtents, "set_descent",
|
183
|
+
cr_font_extents_set_descent, 1);
|
184
|
+
rb_define_method (rb_cCairo_FontExtents, "height",
|
185
|
+
cr_font_extents_height, 0);
|
186
|
+
rb_define_method (rb_cCairo_FontExtents, "set_height",
|
187
|
+
cr_font_extents_set_height, 1);
|
188
|
+
rb_define_method (rb_cCairo_FontExtents, "max_x_advance",
|
189
|
+
cr_font_extents_max_x_advance, 0);
|
190
|
+
rb_define_method (rb_cCairo_FontExtents, "set_max_x_advance",
|
191
|
+
cr_font_extents_set_max_x_advance, 1);
|
192
|
+
rb_define_method (rb_cCairo_FontExtents, "max_y_advance",
|
193
|
+
cr_font_extents_max_y_advance, 0);
|
194
|
+
rb_define_method (rb_cCairo_FontExtents, "set_max_y_advance",
|
195
|
+
cr_font_extents_set_max_y_advance, 1);
|
196
|
+
|
197
|
+
rb_define_method (rb_cCairo_FontExtents, "to_s", cr_font_extents_to_s, 0);
|
198
|
+
|
199
|
+
RB_CAIRO_DEF_SETTERS (rb_cCairo_FontExtents);
|
200
|
+
}
|