+ my $ttf = eval {
+ if ($ttfuri =~ /\.ttc\z/) {
+ require Font::TTF::Ttc;
+ my $collection = Font::TTF::Ttc->open($ttfuri) or die $!;
+ return $collection->{directs}->[0]; # first sub-font object
+ }
+ return Font::TTF::Font->open($ttfuri);
+ } or do {
+ warn "Cannot open font file $ttfuri: ", $@ // $!;
+ exit 65; # EX_DATAERR
+ };