64 |
die 'need Cairo with FreeType support and Font::FreeType'; |
die 'need Cairo with FreeType support and Font::FreeType'; |
65 |
} |
} |
66 |
|
|
67 |
# my $ttf_path = '/usr/share/fonts/truetype/ttf-inconsolata/Inconsolata.otf'; |
my @fonts = ( |
68 |
my $ttf_path = '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf'; |
'/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf', |
69 |
unless (-r $ttf_path) { |
'/usr/share/fonts/truetype/ttf-inconsolata/Inconsolata.otf', |
70 |
die 'Can\'t find font ttf_path'; |
'/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf', |
71 |
|
); |
72 |
|
|
73 |
|
my $ttf_path; |
74 |
|
foreach my $font ( @fonts ) { |
75 |
|
$ttf_path ||= $font if -e $font; |
76 |
} |
} |
77 |
|
die "Can't find font $ttf_path" unless -r $ttf_path; |
78 |
|
|
79 |
my $ft_face = Font::FreeType->new->face($ttf_path); |
my $ft_face = Font::FreeType->new->face($ttf_path); |
80 |
my $cr_face = Cairo::FtFontFace->create($ft_face); |
my $cr_face = Cairo::FtFontFace->create($ft_face); |