[Libreoffice-commits] core.git: solenv/bin

Andras Timar andras.timar at collabora.com
Thu Nov 12 13:06:06 PST 2015


 solenv/bin/modules/installer/windows/file.pm |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 38e24f1d059a6123ea15a68b4b24ca984642d66e
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu Nov 12 21:57:37 2015 +0100

    tdf#76239 extract real file version from ttf files
    
    Change-Id: I9f611a272e6694fe1f9bd5f75358e865eaf3fe5f
    Reviewed-on: https://gerrit.libreoffice.org/19941
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index c41be70..bd72185 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -551,10 +551,25 @@ sub get_fileversion
             $fileversion = $version . "." . $subversion . "." . $microversion . "." . $vervariant;
         }
     }
-    # fake file version for font files (tdf#76239)
+    # file version for font files (tdf#76239)
     if ( $onefile->{'Name'} =~ /\.ttf$|\.TTF$/ )
     {
-        $fileversion = "1.0.0.0";
+        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;


More information about the Libreoffice-commits mailing list