Cairo

 view release on metacpan or  search on metacpan

examples/pdf-tagged-text.pl  view on Meta::CPAN

	[ 1, "Section 3.1",   4 ],
	[ 2, "Section 3.1.1", 3 ],
	[ 1, "Section 3.2",   2 ],
	[ 2, "Section 3.2.1", 4 ],
	[ 2, "Section 3.2.2", 4 ],
	[ 1, "Section 3.3",   2 ],
	);

my @level_data =
	(
	[HEADING1_SIZE, 'H1', ['bold', 'open'],],
	[HEADING2_SIZE, 'H2', [],],
	[HEADING3_SIZE, 'H3', ['italic'],],
	);

my @ipsum_lorem = split(' ', "Lorem ipsum dolor sit amet, consectetur adipiscing"
	. " elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
	. " Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi"
	. " ut aliquip ex ea commodo consequat. Duis aute irure dolor in"
	. " reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla"
	. " pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa"

examples/pdf-tagged-text.pl  view on Meta::CPAN

			$cr->show_page();
			draw_page_num($cr, undef, $page_num++);
			$y_pos = MARGIN;
			}

		$parent = $outline_parents[$$section[0]-1];
		}

	$cr->tag_begin('Sect', '');

	$cr->select_font_face('Sans', 'normal', 'bold');
	$cr->set_font_size($level_data[$$section[0]]->[0]);

	$cr->move_to(MARGIN, $y_pos);

	$cr->tag_begin($level_data[$$section[0]]->[1], '');
	$cr->tag_begin(Cairo::TAG_DEST, "name='".$$section[1]."'");
	$cr->show_text($$section[1]);
	$cr->tag_end(Cairo::TAG_DEST);
	$cr->tag_end($level_data[$$section[0]]->[1]);

examples/pdf-tagged-text.pl  view on Meta::CPAN

		}

	$cr->tag_end('Sect');
	}


sub draw_cover
	{
	my ($cr) = @_;

	$cr->select_font_face("Sans", 'normal', 'bold');
	$cr->set_font_size(16);

	$cr->move_to(PAGE_WIDTH/3, PAGE_HEIGHT/2);

	$cr->tag_begin("Span", '');
	$cr->show_text("PDF Features Test");
	$cr->tag_end("Span");

	draw_page_num($cr, "cover", 0);
	}

examples/pdf-tagged-text.pl  view on Meta::CPAN

	$surface->set_metadata('author', "cairo test suite");
	$surface->set_metadata('subject', "cairo test");
	$surface->set_metadata('keywords', "tags, links, outline, page labels, metadata, thumbnails");
	$surface->set_metadata('creator', "pdf-features");
	$surface->set_metadata('create-date', "2016-01-01T12:34:56+10:30");
	$surface->set_metadata('mod-date', "2016-06-21T05:43:21Z");

	$cr->tag_begin("Document", '');

	draw_cover($cr);
	$surface->add_outline($surface->OUTLINE_ROOT, 'Cover', 'page=1', ['bold']);
	$cr->show_page();

	$page_num = 0;
	draw_page_num($cr, $roman_numerals[$page_num++], 0);
	$y_pos = MARGIN;

	$surface->add_outline($surface->OUTLINE_ROOT, "Contents", "dest='TOC'", ['bold']);

	$cr->tag_begin(Cairo::TAG_DEST, "name='TOC' internal");
	$cr->tag_begin("TOC", '');

	foreach (@contents)
		{
		draw_contents($cr, $_);
		}

	$cr->tag_end("TOC");

ppport.h  view on Meta::CPAN

#ifndef UV_MAX
#  define UV_MAX                         PERL_ULONG_MAX
#endif

#endif

#ifndef IVSIZE
#  ifdef LONGSIZE
#    define IVSIZE LONGSIZE
#  else
#    define IVSIZE 4 /* A bold guess, but the best we can make. */
#  endif
#endif
#ifndef UVTYPE
#  define UVTYPE                         unsigned IVTYPE
#endif

#ifndef UVSIZE
#  define UVSIZE                         IVSIZE
#endif
#ifndef sv_setuv

t/CairoFont.t  view on Meta::CPAN

	$cr->show_text_glyphs ($text, $glyphs, $clusters, $flags);
	is ($cr->status, 'success');
}

# --------------------------------------------------------------------------- #

SKIP: {
	skip 'toy font face', 6
		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 8, 0);

	my $face = Cairo::ToyFontFace->create ('Sans', 'italic', 'bold');
	isa_ok ($face, 'Cairo::ToyFontFace');
	isa_ok ($face, 'Cairo::FontFace');
	is ($face->status, 'success');

	is ($face->get_family, 'Sans');
	is ($face->get_slant, 'italic');
	is ($face->get_weight, 'bold');
}

t/CairoSurface.t  view on Meta::CPAN

	SKIP: {
		skip 'new stuff', 3
			unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 16, 0);

		$surf->set_page_label('Page label');
		is ($surf->status(), 'success');

		$surf->set_thumbnail_size(20, 20);
		is ($surf->status(), 'success');

		my $parent = $surf->add_outline($surf->OUTLINE_ROOT(), 'Cover', "dest='page=1'", ['bold']);
		$parent = $surf->add_outline($parent, 'Chapter 1', 'page=2', ['bold', 'open']);
		$parent = $surf->add_outline($parent, 'Section 1', 'page=2', ['open']);
		$parent = $surf->add_outline($parent, 'Section 1.1', 'page=2', ['italic']);
		$parent = $surf->add_outline($parent, 'Review', 'page=2', []);
		is ($surf->status(), 'success');
	}

	unlink 'tmp.pdf';
}

SKIP: {



( run in 1.324 second using v1.01-cache-2.11-cpan-5dc5da66d9d )