summaryrefslogtreecommitdiff
path: root/solenv/bin/modules/installer/windows
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-03-24 00:21:43 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2018-03-26 11:59:29 +0200
commitc91f70f9b0129685737260c04a2e347726f1dedf (patch)
tree1544ede1b3091ab711aaa221cba219b8d5d94a71 /solenv/bin/modules/installer/windows
parent7e1fbb3cdbe905d0b21fd0e5738c1513af252b73 (diff)
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@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'solenv/bin/modules/installer/windows')
-rw-r--r--solenv/bin/modules/installer/windows/file.pm25
1 files changed, 9 insertions, 16 deletions
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