summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2015-11-10 15:01:40 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-11-24 15:28:52 +0000
commitdf4afab6fcf653ee71762891b0bf287813726e45 (patch)
tree647e6bc4c73c9384f61ffeb52404205924165d03
parentbab5f484e972af91d06cab0da44a40a605bef91d (diff)
tdf#76239 extract file version from ttf files
Change-Id: I59a9401c0bdc2d641ea54498af0eb1e589ab12f3 (cherry picked from commit a322355727368ab087b718d32b70e4a9d9db645d) (cherry picked from commit 38e24f1d059a6123ea15a68b4b24ca984642d66e) Reviewed-on: https://gerrit.libreoffice.org/19945 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--solenv/bin/modules/installer/windows/file.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index 457b31ac0d71..bd72185fc9ac 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -551,6 +551,26 @@ sub get_fileversion
$fileversion = $version . "." . $subversion . "." . $microversion . "." . $vervariant;
}
}
+ # file version for font files (tdf#76239)
+ if ( $onefile->{'Name'} =~ /\.ttf$|\.TTF$/ )
+ {
+ open (TTF, "<$onefile->{'sourcepath'}");
+ binmode TTF;
+ {local $/ = undef; $ttfdata = <TTF>;}
+ close TTF;
+
+ my $ttfversion = "(Version )([0-9]+[.]*([0-9][.])*[0-9]+)";
+
+ if ($ttfdata =~ /$ttfversion/ms)
+ {
+ my ($version, $subversion, $microversion, $vervariant) = split(/\./,$2);
+ $fileversion = int($version) . "." . int($subversion) . "." . int($microversion) . "." . int($vervariant);
+ }
+ else
+ {
+ $fileversion = "1.0.0.0";
+ }
+ }
return $fileversion;
}