From d0e5261363a12ee2d704f3e275ab62731b0da961 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 16 Mar 2015 18:19:04 +0100 Subject: [PATCH] font: support reading .ttc truetype collection files Format of most original mac fonts. --- tools/mkttfinfo | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/mkttfinfo b/tools/mkttfinfo index 72564bf..9679f1c 100755 --- a/tools/mkttfinfo +++ b/tools/mkttfinfo @@ -30,8 +30,15 @@ for ($outfile || ()) { } { - my $ttf = Font::TTF::Font->open($ttfuri) or do { - warn "Cannot open truetype in $ttfuri: $!"; + 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 }; -- 2.30.0