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

Mike Kaganski mike.kaganski at collabora.com
Mon Mar 26 09:59:52 UTC 2018


 configure.ac                                 |   30 +++++++++++++++++++--------
 solenv/bin/modules/installer/windows/file.pm |   25 ++++++++--------------
 2 files changed, 31 insertions(+), 24 deletions(-)

New commits:
commit c91f70f9b0129685737260c04a2e347726f1dedf
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Sat Mar 24 00:21:43 2018 +0100

    Related: tdf#116581 Use Font:TTF::Font to get font versions
    
    This allows to correctly get font (including OTF) versions, instead of
    matching strings in binary files.
    
    Fonts affected:
    ====
    Alef_Bold.ttf                        1.0.0.0 → 1.1.0.0
    Alef_Regular.ttf                     1.0.0.0 → 1.1.0.0
    amiri_bold.ttf                       1.0.0.0 → 0.109.0.0
    amiri_boldslanted.ttf                1.0.0.0 → 0.109.0.0
    amiri_quran.ttf                      1.0.0.0 → 0.109.0.0
    amiri_regular.ttf                    1.0.0.0 → 0.109.0.0
    amiri_slanted.ttf                    1.0.0.0 → 0.109.0.0
    Carlito_Bold.ttf                     1.1.0.0 → 1.103.0.0
    Carlito_BoldItalic.ttf               1.1.0.0 → 1.103.0.0
    Carlito_Italic.ttf                   1.1.0.0 → 1.103.0.0
    Carlito_Regular.ttf                  1.1.0.0 → 1.103.0.0
    NachlieliCLM_Bold.otf                        → 0.131.0.0
    NachlieliCLM_BoldOblique.otf                 → 0.131.0.0
    NachlieliCLM_Light.otf                       → 0.131.0.0
    NachlieliCLM_LightOblique.otf                → 0.131.0.0
    LiberationMono_Bold.ttf              2.0.0.0 → 2.0.1.0
    LiberationMono_BoldItalic.ttf        2.0.0.0 → 2.0.1.0
    LiberationMono_Italic.ttf            2.0.0.0 → 2.0.1.0
    LiberationMono_Regular.ttf           2.0.0.0 → 2.0.1.0
    LiberationSans_Bold.ttf              2.0.0.0 → 2.0.1.0
    LiberationSans_BoldItalic.ttf        2.0.0.0 → 2.0.1.0
    LiberationSans_Italic.ttf            2.0.0.0 → 2.0.1.0
    LiberationSans_Regular.ttf           2.0.0.0 → 2.0.1.0
    LiberationSerif_Bold.ttf             2.0.0.0 → 2.0.1.0
    LiberationSerif_BoldItalic.ttf       2.0.0.0 → 2.0.1.0
    LiberationSerif_Italic.ttf           2.0.0.0 → 2.0.1.0
    LiberationSerif_Regular.ttf          2.0.0.0 → 2.0.1.0
    LiberationSansNarrow_Bold.ttf        1.7.0.0 → 1.7.4.0
    LiberationSansNarrow_BoldItalic.ttf  1.7.0.0 → 1.7.4.0
    LiberationSansNarrow_Italic.ttf      1.7.0.0 → 1.7.4.0
    LiberationSansNarrow_Regular.ttf     1.7.0.0 → 1.7.4.0
    FrankRuhlHofshi_Bold.otf                     → 5.1.0.0
    FrankRuhlHofshi_Regular.otf                  → 5.1.0.0
    MiriamLibre_Bold.otf                         → 1.0.0.0
    MiriamLibre_Regular.otf                      → 1.0.0.0
    NotoKufiArabic_Bold.ttf              1.0.0.0 → 1.4.0.0
    NotoKufiArabic_Regular.ttf           1.0.0.0 → 1.4.0.0
    NotoNaskhArabicUI_Bold.ttf           1.0.0.0 → 1.7.0.0
    NotoNaskhArabicUI_Regular.ttf        1.0.0.0 → 1.7.0.0
    NotoNaskhArabic_Bold.ttf             1.0.0.0 → 1.6.0.0
    NotoNaskhArabic_Regular.ttf          1.0.0.0 → 1.7.0.0
    NotoSansArabicUI_Bold.ttf            1.0.0.0 → 2.0.0.0
    NotoSansArabicUI_Regular.ttf         1.0.0.0 → 2.0.0.0
    NotoSansArabic_Bold.ttf              1.0.0.0 → 2.0.0.0
    NotoSansArabic_Regular.ttf           1.0.0.0 → 2.0.0.0
    NotoSansArmenian_Bold.ttf            1.0.0.0 → 2.40.0.0
    NotoSansArmenian_Regular.ttf         1.0.0.0 → 2.40.0.0
    NotoSansGeorgian_Bold.ttf            1.0.0.0 → 2.0.0.0
    NotoSansGeorgian_Regular.ttf         1.0.0.0 → 2.0.0.0
    NotoSansHebrew_Bold.ttf              1.0.0.0 → 2.0.0.0
    NotoSansHebrew_Regular.ttf           1.0.0.0 → 2.0.0.0
    NotoSansLao_Bold.ttf                 1.0.0.0 → 2.0.0.0
    NotoSansLao_Regular.ttf              1.0.0.0 → 2.0.0.0
    NotoSansLisu_Regular.ttf             1.0.0.0 → 2.0.0.0
    NotoSans_Bold.ttf                    1.0.0.0 → 2.0.0.0
    NotoSans_BoldItalic.ttf              1.0.0.0 → 2.0.0.0
    NotoSans_Condensed.ttf               1.0.0.0 → 2.0.0.0
    NotoSans_CondensedBold.ttf           1.0.0.0 → 2.0.0.0
    NotoSans_CondensedBoldItalic.ttf     1.0.0.0 → 2.0.0.0
    NotoSans_CondensedItalic.ttf         1.0.0.0 → 2.0.0.0
    NotoSans_Italic.ttf                  1.0.0.0 → 2.0.0.0
    NotoSans_Light.ttf                   1.0.0.0 → 2.0.0.0
    NotoSans_LightItalic.ttf             1.0.0.0 → 2.0.0.0
    NotoSans_Regular.ttf                 1.0.0.0 → 2.0.0.0
    NotoSerifArmenian_Bold.ttf           1.0.0.0 → 2.40.0.0
    NotoSerifArmenian_Regular.ttf        1.0.0.0 → 2.40.0.0
    NotoSerifGeorgian_Bold.ttf           1.0.0.0 → 2.0.0.0
    NotoSerifGeorgian_Regular.ttf        1.0.0.0 → 2.0.0.0
    NotoSerifHebrew_Bold.ttf             1.0.0.0 → 2.0.0.0
    NotoSerifHebrew_Regular.ttf          1.0.0.0 → 2.0.0.0
    NotoSerifLao_Bold.ttf                1.0.0.0 → 2.0.0.0
    NotoSerifLao_Regular.ttf             1.0.0.0 → 2.0.0.0
    NotoSerif_Bold.ttf                   1.0.0.0 → 2.0.0.0
    NotoSerif_BoldItalic.ttf             1.0.0.0 → 2.0.0.0
    NotoSerif_Condensed.ttf              1.0.0.0 → 2.0.0.0
    NotoSerif_CondensedBold.ttf          1.0.0.0 → 2.0.0.0
    NotoSerif_CondensedBoldItalic.ttf    1.0.0.0 → 2.0.0.0
    NotoSerif_CondensedItalic.ttf        1.0.0.0 → 2.0.0.0
    NotoSerif_Italic.ttf                 1.0.0.0 → 2.0.0.0
    NotoSerif_Light.ttf                  1.0.0.0 → 2.0.0.0
    NotoSerif_LightItalic.ttf            1.0.0.0 → 2.0.0.0
    NotoSerif_Regular.ttf                1.0.0.0 → 2.0.0.0
    ReemKufi_Regular.ttf                 1.0.0.0 → 0.6.0.0
    
    This requires Font::TTF::Font perl module to be installed.
    
    Change-Id: Ibb6c384baa2e74524845b6c5a1d4d2f26b7e530b
    Reviewed-on: https://gerrit.libreoffice.org/51793
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/configure.ac b/configure.ac
index af94d2bdbc13..fcab984b346d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4993,18 +4993,32 @@ dnl Testing for required Perl modules
 dnl ===================================================================
 
 AC_MSG_CHECKING([for required Perl modules])
-if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
+perl_use_string="use Cwd ; use Digest::MD5"
+if test "$_os" = "WINNT"; then
+    if test -n "$PKGFORMAT"; then
+        for i in "$PKGFORMAT"; do
+            case "$i" in
+            msi)
+                # for getting fonts versions to use in MSI
+                perl_use_string="$perl_use_string ; use Font::TTF::Font"
+                ;;
+            esac
+        done
+    fi
+fi
+if `$PERL -e '$perl_use_string'>/dev/null 2>&1`; then
     AC_MSG_RESULT([all modules found])
 else
     AC_MSG_RESULT([failed to find some modules])
     # Find out which modules are missing.
-    if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
-        missing_perl_modules="$missing_perl_modules Cwd"
-    fi
-    if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
-        missing_perl_modules="$missing_perl_modules Digest::MD5"
-    fi
-       AC_MSG_ERROR([
+    for i in "$perl_use_string"; do
+        if test "$i" != "use" -a "$i" != ";"; then
+            if ! `$PERL -e 'use $i;'>/dev/null 2>&1`; then
+                missing_perl_modules="$missing_perl_modules $i"
+            fi
+        fi
+    done
+    AC_MSG_ERROR([
     The missing Perl modules are: $missing_perl_modules
     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
 fi
diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index 6a0479ba49f2..72f32949bd47 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -30,6 +30,7 @@ use installer::windows::idtglobal;
 use installer::windows::msiglobal;
 use installer::windows::language;
 use installer::windows::component;
+use Font::TTF::Font;
 
 ##########################################################################
 # Assigning one cabinet file to each file. This is requrired,
@@ -552,25 +553,17 @@ sub get_fileversion
         }
     }
     # file version for font files (tdf#76239)
-    if ( $onefile->{'Name'} =~ /\.ttf$|\.TTF$/ )
+    if ( $onefile->{'Name'} =~ /\.(otf|ttf|ttc)$/i )
     {
-        open (TTF, "<$onefile->{'sourcepath'}");
-        binmode TTF;
-        {local $/ = undef; $ttfdata = <TTF>;}
-        close TTF;
+        my $fnt = Font::TTF::Font->open("<$onefile->{'sourcepath'}");
+        # 5 is pre-defined name ID for version string - see
+        # https://docs.microsoft.com/en-us/typography/opentype/spec/name
+        my $ttfdata = $fnt->{'name'}->read->find_name(5);
+        $fnt->release;
 
-        my $ttfversion = "(Version )([0-9]+[.]*([0-9][.])*[0-9]+)";
-        # UTF16-encoded version string
-        my $ttfversionU = "(V\0e\0r\0s\0i\0o\0n\0 \0)(([0-9]\0)+([.]\0([0-9]\0)+)*)";
-
-        if ($ttfdata =~ /$ttfversion/ms)
-        {
-            my ($version, $subversion, $microversion, $vervariant) = split(/\./,$2);
-            $fileversion = int($version) . "." . int($subversion) . "." . int($microversion) . "." . int($vervariant);
-        }
-        elsif ($ttfdata =~ /$ttfversionU/ms)
+        if ($ttfdata =~ /Version ([0-9]+(\.[0-9]+)*)/i)
         {
-            my ($version, $subversion, $microversion, $vervariant) = split(/\./,$2 =~ s/\0//g);
+            my ($version, $subversion, $microversion, $vervariant) = split(/\./,$1);
             $fileversion = int($version) . "." . int($subversion) . "." . int($microversion) . "." . int($vervariant);
         }
         else


More information about the Libreoffice-commits mailing list