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

New commits:
commit 38e24f1d059a6123ea15a68b4b24ca984642d66e
Author: Andras Timar <[email protected]>
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 <[email protected]>
    Tested-by: Andras Timar <[email protected]>

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;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to