/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.28 from the
 * contents of CairoFont.xs. Do not edit this file, edit CairoFont.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "CairoFont.xs"
/*
 * Copyright (c) 2004-2005, 2012 by the cairo perl team (see the file README)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Id$
 */

#include <cairo-perl.h>
#include <cairo-perl-private.h>

static const char *
get_package (cairo_font_face_t *face)
{
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
	cairo_font_type_t type;
	const char *package;

	type = cairo_font_face_get_type (face);
	switch (type) {
	    case CAIRO_FONT_TYPE_TOY:
		package = "Cairo::ToyFontFace";
		break;

	    case CAIRO_FONT_TYPE_FT:
		package = "Cairo::FtFontFace";
		break;

	    /* These aren't wrapped yet: */
	    case CAIRO_FONT_TYPE_WIN32:
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
	    case CAIRO_FONT_TYPE_QUARTZ:
#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
	    case CAIRO_FONT_TYPE_USER:
#endif
		package = "Cairo::FontFace";
		break;

	    default:
		warn ("unknown font face type %d encountered", type);
		package = "Cairo::FontFace";
		break;
	}

	return package;
#else
	const char *package = cairo_perl_package_table_lookup (face);
	return package ? package : "Cairo::FontFace";
#endif
}

SV *
cairo_font_face_to_sv (cairo_font_face_t *face)
{
	SV *sv = newSV (0);
	sv_setref_pv(sv, get_package (face), face);
	return sv;
}

/* ------------------------------------------------------------------------- */

#line 73 "CairoFont.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 217 "CairoFont.c"

XS_EUPXS(XS_Cairo__FontFace_status); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontFace_status)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font");
    {
	cairo_status_t	RETVAL;
	cairo_font_face_t *	font = SvCairoFontFace (ST(0))
;

	RETVAL = cairo_font_face_status(font);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoStatus (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Cairo__FontFace_get_type); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontFace_get_type)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font_face");
    {
	cairo_font_type_t	RETVAL;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(0))
;

	RETVAL = cairo_font_face_get_type(font_face);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontType (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__FontFace_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontFace_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font");
    {
	cairo_font_face_t *	font = SvCairoFontFace (ST(0))
;
#line 75 "CairoFont.xs"
	cairo_font_face_destroy (font);
#line 280 "CairoFont.c"
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
#define XSubPPtmpAAAB 1


XS_EUPXS(XS_Cairo__ToyFontFace_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ToyFontFace_create)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "class, family, slant, weight");
    {
	cairo_font_face_t_noinc *	RETVAL;
	const char_utf8 *	family;
	cairo_font_slant_t	slant = SvCairoFontSlant (ST(2))
;
	cairo_font_weight_t	weight = SvCairoFontWeight (ST(3))
;

	sv_utf8_upgrade (ST(1));
	family = (const char_utf8 *) SvPV_nolen (ST(1))
;

	RETVAL = cairo_toy_font_face_create(family, slant, weight);
#line 92 "CairoFont.xs"
#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 2, 0)
	cairo_perl_package_table_insert (RETVAL, "Cairo::ToyFontFace");
#endif
#line 312 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontFace_noinc (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ToyFontFace_get_family); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ToyFontFace_get_family)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font_face");
    {
	const char_utf8 *	RETVAL;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(0))
;

	RETVAL = cairo_toy_font_face_get_family(font_face);
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setpv ((SV*)RETVALSV, RETVAL);
	    SvUTF8_on (RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ToyFontFace_get_slant); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ToyFontFace_get_slant)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font_face");
    {
	cairo_font_slant_t	RETVAL;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(0))
;

	RETVAL = cairo_toy_font_face_get_slant(font_face);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontSlant (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ToyFontFace_get_weight); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ToyFontFace_get_weight)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font_face");
    {
	cairo_font_weight_t	RETVAL;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(0))
;

	RETVAL = cairo_toy_font_face_get_weight(font_face);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontWeight (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__ScaledFont_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_create)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "class, font_face, font_matrix, ctm, options");
    {
	cairo_scaled_font_t_noinc *	RETVAL;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(1))
;
	const cairo_matrix_t *	font_matrix = SvCairoMatrix (ST(2))
;
	const cairo_matrix_t *	ctm = SvCairoMatrix (ST(3))
;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(4))
;

	RETVAL = cairo_scaled_font_create(font_face, font_matrix, ctm, options);
#line 113 "CairoFont.xs"
#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 2, 0)
	cairo_perl_package_table_insert (RETVAL, "Cairo::ScaledFont");
#endif
#line 417 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoScaledFont_noinc (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ScaledFont_status); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_status)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
	cairo_status_t	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;

	RETVAL = cairo_scaled_font_status(scaled_font);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoStatus (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAC 1


XS_EUPXS(XS_Cairo__ScaledFont_get_type); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_type)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
	cairo_font_type_t	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;

	RETVAL = cairo_scaled_font_get_type(scaled_font);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontType (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__ScaledFont_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
#line 128 "CairoFont.xs"
	cairo_font_extents_t extents;
#line 488 "CairoFont.c"
	cairo_font_extents_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 130 "CairoFont.xs"
	cairo_scaled_font_extents (scaled_font, &extents);
	RETVAL = &extents;
#line 495 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAD 1


XS_EUPXS(XS_Cairo__ScaledFont_text_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_text_extents)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "scaled_font, utf8");
    {
#line 140 "CairoFont.xs"
	cairo_text_extents_t extents;
#line 519 "CairoFont.c"
	cairo_text_extents_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
	const char_utf8 *	utf8;

	sv_utf8_upgrade (ST(1));
	utf8 = (const char_utf8 *) SvPV_nolen (ST(1))
;
#line 142 "CairoFont.xs"
	cairo_scaled_font_text_extents (scaled_font, utf8, &extents);
	RETVAL = &extents;
#line 531 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoTextExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__ScaledFont_glyph_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_glyph_extents)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "scaled_font, ...");
    {
#line 152 "CairoFont.xs"
	cairo_glyph_t * glyphs = NULL;
	int num_glyphs, i;
	cairo_text_extents_t extents;
#line 555 "CairoFont.c"
	cairo_text_extents_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 156 "CairoFont.xs"
	num_glyphs = items - 1;
	Newz (0, glyphs, num_glyphs, cairo_glyph_t);
	for (i = 1; i < items; i++)
		glyphs[i - 1] = *SvCairoGlyph (ST (i));
	cairo_scaled_font_glyph_extents (scaled_font, glyphs, num_glyphs, &extents);
	RETVAL = &extents;
	Safefree (glyphs);
#line 567 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoTextExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
#define XSubPPtmpAAAE 1


XS_EUPXS(XS_Cairo__ScaledFont_text_to_glyphs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_text_to_glyphs)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "scaled_font, x, y, utf8_sv");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 172 "CairoFont.xs"
	const char *utf8;
	STRLEN utf8_len;
	cairo_glyph_t *glyphs = NULL;
	int num_glyphs;
	cairo_text_cluster_t *clusters = NULL;
	int num_clusters;
	cairo_text_cluster_flags_t cluster_flags;
	cairo_status_t status;
#line 600 "CairoFont.c"
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;
	SV *	utf8_sv = ST(3)
;
#line 181 "CairoFont.xs"
	sv_utf8_upgrade (utf8_sv);
	utf8 = SvPV (utf8_sv, utf8_len);
	status = cairo_scaled_font_text_to_glyphs (
	           scaled_font,
	           x, y,
	           utf8, utf8_len,
	           &glyphs, &num_glyphs,
	           &clusters, &num_clusters, &cluster_flags);
	PUSHs (sv_2mortal (newSVCairoStatus (status)));
	if (CAIRO_STATUS_SUCCESS == status) {
		AV *glyphs_av, *clusters_av;
		int i;
		glyphs_av = newAV ();
		for (i = 0; i < num_glyphs; i++)
			av_push (glyphs_av, newSVCairoGlyph (&glyphs[i]));
		cairo_glyph_free (glyphs);
		clusters_av = newAV ();
		for (i = 0; i < num_clusters; i++)
			av_push (clusters_av, newSVCairoTextCluster (&clusters[i]));
		cairo_text_cluster_free (clusters);
		EXTEND (SP, 4);
		PUSHs (sv_2mortal (newRV_noinc ((SV *) glyphs_av)));
		PUSHs (sv_2mortal (newRV_noinc ((SV *) clusters_av)));
		PUSHs (sv_2mortal (newSVCairoTextClusterFlags (cluster_flags)));
	}
#line 635 "CairoFont.c"
	PUTBACK;
	return;
    }
}

#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAF 1


XS_EUPXS(XS_Cairo__ScaledFont_get_font_face); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_font_face)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
	cairo_font_face_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;

	RETVAL = cairo_scaled_font_get_font_face(scaled_font);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontFace (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ScaledFont_get_font_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_font_matrix)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
#line 217 "CairoFont.xs"
	cairo_matrix_t font_matrix;
#line 678 "CairoFont.c"
	cairo_matrix_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 219 "CairoFont.xs"
	cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
	RETVAL = cairo_perl_copy_matrix (&font_matrix);
#line 685 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoMatrix (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ScaledFont_get_ctm); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_ctm)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
#line 227 "CairoFont.xs"
	cairo_matrix_t ctm;
#line 706 "CairoFont.c"
	cairo_matrix_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 229 "CairoFont.xs"
	cairo_scaled_font_get_ctm (scaled_font, &ctm);
	RETVAL = cairo_perl_copy_matrix (&ctm);
#line 713 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoMatrix (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__ScaledFont_get_font_options); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_font_options)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
	cairo_font_options_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 237 "CairoFont.xs"
	RETVAL = cairo_font_options_create ();
	cairo_scaled_font_get_font_options (scaled_font, RETVAL);
#line 738 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontOptions (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
#define XSubPPtmpAAAG 1


XS_EUPXS(XS_Cairo__ScaledFont_get_scale_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_get_scale_matrix)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "scaled_font");
    {
#line 250 "CairoFont.xs"
	cairo_matrix_t matrix;
#line 763 "CairoFont.c"
	cairo_matrix_t *	RETVAL;
	cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(0))
;
#line 252 "CairoFont.xs"
	cairo_scaled_font_get_scale_matrix (scaled_font, &matrix);
	RETVAL = cairo_perl_copy_matrix (&matrix);
#line 770 "CairoFont.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoMatrix (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__ScaledFont_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__ScaledFont_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "font");
    {
	cairo_scaled_font_t *	font = SvCairoScaledFont (ST(0))
;
#line 261 "CairoFont.xs"
	cairo_scaled_font_destroy (font);
#line 794 "CairoFont.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_create)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "class");
    {
	cairo_font_options_t *	RETVAL;

	RETVAL = cairo_font_options_create(/* void */);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontOptions (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_status); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_status)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_status_t	RETVAL;
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_status(options);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoStatus (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_merge); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_merge)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, other");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	const cairo_font_options_t *	other = SvCairoFontOptions (ST(1))
;

	cairo_font_options_merge(options, other);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_equal); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_equal)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, other");
    {
	cairo_bool_t	RETVAL;
	dXSTARG;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	const cairo_font_options_t *	other = SvCairoFontOptions (ST(1))
;

	RETVAL = cairo_font_options_equal(options, other);
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_hash); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_hash)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	unsigned long	RETVAL;
	dXSTARG;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_hash(options);
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_set_antialias); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_set_antialias)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, antialias");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	cairo_antialias_t	antialias = SvCairoAntialias (ST(1))
;

	cairo_font_options_set_antialias(options, antialias);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_get_antialias); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_get_antialias)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_antialias_t	RETVAL;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_get_antialias(options);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoAntialias (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_set_subpixel_order); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_set_subpixel_order)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, subpixel_order");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	cairo_subpixel_order_t	subpixel_order = SvCairoSubpixelOrder (ST(1))
;

	cairo_font_options_set_subpixel_order(options, subpixel_order);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_get_subpixel_order); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_get_subpixel_order)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_subpixel_order_t	RETVAL;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_get_subpixel_order(options);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoSubpixelOrder (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_set_hint_style); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_set_hint_style)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, hint_style");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	cairo_hint_style_t	hint_style = SvCairoHintStyle (ST(1))
;

	cairo_font_options_set_hint_style(options, hint_style);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_get_hint_style); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_get_hint_style)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_hint_style_t	RETVAL;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_get_hint_style(options);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoHintStyle (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_set_hint_metrics); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_set_hint_metrics)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "options, hint_metrics");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
	cairo_hint_metrics_t	hint_metrics = SvCairoHintMetrics (ST(1))
;

	cairo_font_options_set_hint_metrics(options, hint_metrics);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__FontOptions_get_hint_metrics); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_get_hint_metrics)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_hint_metrics_t	RETVAL;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;

	RETVAL = cairo_font_options_get_hint_metrics(options);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoHintMetrics (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__FontOptions_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__FontOptions_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "options");
    {
	cairo_font_options_t *	options = SvCairoFontOptions (ST(0))
;
#line 301 "CairoFont.xs"
	cairo_font_options_destroy (options);
#line 1077 "CairoFont.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Cairo__Font); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Cairo__Font)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        newXS_deffile("Cairo::FontFace::status", XS_Cairo__FontFace_status);
#if XSubPPtmpAAAA
        newXS_deffile("Cairo::FontFace::get_type", XS_Cairo__FontFace_get_type);
#endif
        newXS_deffile("Cairo::FontFace::DESTROY", XS_Cairo__FontFace_DESTROY);
#if XSubPPtmpAAAB
        newXS_deffile("Cairo::ToyFontFace::create", XS_Cairo__ToyFontFace_create);
        newXS_deffile("Cairo::ToyFontFace::get_family", XS_Cairo__ToyFontFace_get_family);
        newXS_deffile("Cairo::ToyFontFace::get_slant", XS_Cairo__ToyFontFace_get_slant);
        newXS_deffile("Cairo::ToyFontFace::get_weight", XS_Cairo__ToyFontFace_get_weight);
#endif
        newXS_deffile("Cairo::ScaledFont::create", XS_Cairo__ScaledFont_create);
        newXS_deffile("Cairo::ScaledFont::status", XS_Cairo__ScaledFont_status);
#if XSubPPtmpAAAC
        newXS_deffile("Cairo::ScaledFont::get_type", XS_Cairo__ScaledFont_get_type);
#endif
        newXS_deffile("Cairo::ScaledFont::extents", XS_Cairo__ScaledFont_extents);
#if XSubPPtmpAAAD
        newXS_deffile("Cairo::ScaledFont::text_extents", XS_Cairo__ScaledFont_text_extents);
#endif
        newXS_deffile("Cairo::ScaledFont::glyph_extents", XS_Cairo__ScaledFont_glyph_extents);
#if XSubPPtmpAAAE
        newXS_deffile("Cairo::ScaledFont::text_to_glyphs", XS_Cairo__ScaledFont_text_to_glyphs);
#endif
#if XSubPPtmpAAAF
        newXS_deffile("Cairo::ScaledFont::get_font_face", XS_Cairo__ScaledFont_get_font_face);
        newXS_deffile("Cairo::ScaledFont::get_font_matrix", XS_Cairo__ScaledFont_get_font_matrix);
        newXS_deffile("Cairo::ScaledFont::get_ctm", XS_Cairo__ScaledFont_get_ctm);
        newXS_deffile("Cairo::ScaledFont::get_font_options", XS_Cairo__ScaledFont_get_font_options);
#endif
#if XSubPPtmpAAAG
        newXS_deffile("Cairo::ScaledFont::get_scale_matrix", XS_Cairo__ScaledFont_get_scale_matrix);
#endif
        newXS_deffile("Cairo::ScaledFont::DESTROY", XS_Cairo__ScaledFont_DESTROY);
        newXS_deffile("Cairo::FontOptions::create", XS_Cairo__FontOptions_create);
        newXS_deffile("Cairo::FontOptions::status", XS_Cairo__FontOptions_status);
        newXS_deffile("Cairo::FontOptions::merge", XS_Cairo__FontOptions_merge);
        newXS_deffile("Cairo::FontOptions::equal", XS_Cairo__FontOptions_equal);
        newXS_deffile("Cairo::FontOptions::hash", XS_Cairo__FontOptions_hash);
        newXS_deffile("Cairo::FontOptions::set_antialias", XS_Cairo__FontOptions_set_antialias);
        newXS_deffile("Cairo::FontOptions::get_antialias", XS_Cairo__FontOptions_get_antialias);
        newXS_deffile("Cairo::FontOptions::set_subpixel_order", XS_Cairo__FontOptions_set_subpixel_order);
        newXS_deffile("Cairo::FontOptions::get_subpixel_order", XS_Cairo__FontOptions_get_subpixel_order);
        newXS_deffile("Cairo::FontOptions::set_hint_style", XS_Cairo__FontOptions_set_hint_style);
        newXS_deffile("Cairo::FontOptions::get_hint_style", XS_Cairo__FontOptions_get_hint_style);
        newXS_deffile("Cairo::FontOptions::set_hint_metrics", XS_Cairo__FontOptions_set_hint_metrics);
        newXS_deffile("Cairo::FontOptions::get_hint_metrics", XS_Cairo__FontOptions_get_hint_metrics);
        newXS_deffile("Cairo::FontOptions::DESTROY", XS_Cairo__FontOptions_DESTROY);

    /* Initialisation Section */

#if XSubPPtmpAAAA
#endif
#line 82 "CairoFont.xs"
	cairo_perl_set_isa ("Cairo::ToyFontFace", "Cairo::FontFace");

#if XSubPPtmpAAAB
#endif
#if XSubPPtmpAAAC
#endif
#if XSubPPtmpAAAD
#endif
#if XSubPPtmpAAAE
#endif
#if XSubPPtmpAAAF
#endif
#if XSubPPtmpAAAG
#endif
#line 1178 "CairoFont.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

