diff options
author | Andras Timar <andras.timar@collabora.com> | 2015-11-10 15:01:40 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2015-11-17 07:29:40 +0000 |
commit | 8149383121704a598eb4f87755e118c65fa38e5d (patch) | |
tree | e5a4aba6a112123a6d4c7dea8c78d5e38201333b | |
parent | 11e837d9376c4fc13ab103180fa723d84f2f5834 (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/19944
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | solenv/bin/modules/installer/windows/file.pm | 20 |
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; } |