[cairo-commit] cairo-perl/examples freetype-font.pl,NONE,1.1
Torsten Schoenfeld
commit at pdx.freedesktop.org
Wed Oct 24 09:32:07 PDT 2007
- Previous message: [cairo-commit] cairo-perl Cairo.pm, 1.29, 1.30 Cairo.xs, 1.21, 1.22 CairoFt.xs, NONE, 1.1 ChangeLog, 1.76, 1.77 Makefile.PL, 1.28, 1.29 cairo-perl.h, 1.12, 1.13 cairo-perl.typemap, 1.5, 1.6
- Next message: [cairo-commit] cairo-perl/t CairoFt.t,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: tsch
Update of /cvs/cairo/cairo-perl/examples
In directory kemper:/tmp/cvs-serv3018/examples
Added Files:
freetype-font.pl
Log Message:
* Cairo.pm
* Cairo.xs
* CairoFt.xs
* Makefile.PL
* cairo-perl.h
* cairo-perl.typemap
* examples/freetype-font.pl
* t/CairoFt.t: Add support for part of cairo's FreeType
integration API. Currently, that's just
Cairo::FtFontFace::create, which lets you create a cairo font face
from a FreeType font face.
--- NEW FILE: freetype-font.pl ---
#!/usr/bin/perl
use strict;
use warnings;
use Cairo;
unless (Cairo::HAS_FT_FONT && eval 'use Font::FreeType; 1;') {
die 'need Cairo with FreeType support and Font::FreeType';
}
# my $file = '/usr/share/fonts/truetype/ttf-inconsolata/Inconsolata.otf';
my $file = '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf';
unless (-r $file) {
die 'Can\'t find font file';
}
my $ft_face = Font::FreeType->new->face ($file);
my $cr_face = Cairo::FtFontFace->create ($ft_face);
my $surface = Cairo::ImageSurface->create ('argb32', 200, 40);
my $cr = Cairo::Context->create ($surface);
$cr->set_font_face ($cr_face);
$cr->set_font_size (23);
$cr->move_to (20, 25);
$cr->show_text ('Hello, world!');
$cr->show_page;
$surface->write_to_png ('freetype-font.png');
- Previous message: [cairo-commit] cairo-perl Cairo.pm, 1.29, 1.30 Cairo.xs, 1.21, 1.22 CairoFt.xs, NONE, 1.1 ChangeLog, 1.76, 1.77 Makefile.PL, 1.28, 1.29 cairo-perl.h, 1.12, 1.13 cairo-perl.typemap, 1.5, 1.6
- Next message: [cairo-commit] cairo-perl/t CairoFt.t,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list