summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-13 03:32:31 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-01-14 13:29:59 +0100
commit25f4cc12fb59284392914c93a0ae6ad199ecc069 (patch)
tree68271ae91888a2d044fc96029c74daedb5fbcdc6
parent4e0a6e43f48ef2d39433bdd8af3b6fd1906e2940 (diff)
tdf#128226: make OpenSymbol font an internal resource
OpenSymbol is crucial for Math; so it is not just some font that could be used if present, but part of program resources. As such, it must be available with other program resources, and not depend on user preferences, like uninstallation of the font from system. This patch puts it into program/resource/common/fonts, and adds that path to the paths used for private fonts. This is in addition to share/fonts/truetype, which is optional, and is usually absent on most Linux and Windows installations (on Linux, it is usually in a separate package installing it to system fonts; on Windows, it is also installed to system by MSI). Change-Id: Ibf5e12e70dacb62b965035645fc53e9d83cd8793 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86649 Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Rene Engelhard <rene@debian.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--Repository.mk1
-rw-r--r--extras/Module_extras.mk1
-rw-r--r--extras/Package_resource_fonts.mk16
-rw-r--r--vcl/quartz/salgdi.cxx4
-rw-r--r--vcl/unx/generic/fontmanager/helper.cxx16
-rw-r--r--vcl/win/gdi/salfont.cxx45
6 files changed, 58 insertions, 25 deletions
diff --git a/Repository.mk b/Repository.mk
index 03628e958f72..88941099db72 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -965,6 +965,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
helpcontent2_html_icon-themes \
helpcontent2_html_static \
) \
+ resource_fonts \
))
$(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\
diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk
index 01bf26695377..534fb2814de2 100644
--- a/extras/Module_extras.mk
+++ b/extras/Module_extras.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Module_add_targets,extras,\
Package_database \
Package_databasebiblio \
Package_fonts \
+ Package_resource_fonts \
Package_gallbullets \
Package_gallhtmlexpo \
Package_gallmytheme \
diff --git a/extras/Package_resource_fonts.mk b/extras/Package_resource_fonts.mk
new file mode 100644
index 000000000000..e90e46dfddd4
--- /dev/null
+++ b/extras/Package_resource_fonts.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,resource_fonts,$(call gb_CustomTarget_get_workdir,extras/fonts)))
+
+$(eval $(call gb_Package_use_customtarget,resource_fonts,extras/fonts))
+
+$(eval $(call gb_Package_add_file,resource_fonts,$(LIBO_SHARE_RESOURCE_FOLDER)/common/fonts/opens___.ttf,opens___.ttf))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 000141123d7e..83aebe2abc82 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -323,6 +323,10 @@ static void AddLocalTempFontDirs()
OUString aBrandStr( "$BRAND_BASE_DIR" );
rtl_bootstrap_expandMacros( &aBrandStr.pData );
+
+ // internal font resources, required for normal operation, like OpenSymbol
+ AddTempFontDir( aBrandStr + "/" LIBO_SHARE_RESOURCE_FOLDER "/common/fonts/" );
+
AddTempFontDir( aBrandStr + "/" LIBO_SHARE_FOLDER "/fonts/truetype/" );
}
diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx
index c586dcce7d7f..c28753e33b35 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -182,21 +182,25 @@ OUString const & psp::getFontPath()
OUString aConfigPath( getOfficePath( whichOfficePath::ConfigPath ) );
OUString aInstallationRootPath( getOfficePath( whichOfficePath::InstallationRootPath ) );
OUString aUserPath( getOfficePath( whichOfficePath::UserPath ) );
+ if (!aInstallationRootPath.isEmpty())
+ {
+ // internal font resources, required for normal operation, like OpenSymbol
+ aPathBuffer.append(aInstallationRootPath
+ + "/" LIBO_SHARE_RESOURCE_FOLDER "/common/fonts;");
+ }
if( !aConfigPath.isEmpty() )
{
// #i53530# Path from CustomDataUrl will completely
- // replace net and user paths if the path exists
- aPathBuffer.append(aConfigPath);
- aPathBuffer.append("/" LIBO_SHARE_FOLDER "/fonts");
+ // replace net share and user paths if the path exists
+ OUString sPath = aConfigPath + "/" LIBO_SHARE_FOLDER "/fonts";
// check existence of config path
struct stat aStat;
- if( 0 != stat( OUStringToOString( aPathBuffer.makeStringAndClear(), osl_getThreadTextEncoding() ).getStr(), &aStat )
+ if( 0 != stat( OUStringToOString( sPath, osl_getThreadTextEncoding() ).getStr(), &aStat )
|| ! S_ISDIR( aStat.st_mode ) )
aConfigPath.clear();
else
{
- aPathBuffer.append(aConfigPath);
- aPathBuffer.append("/" LIBO_SHARE_FOLDER "/fonts");
+ aPathBuffer.append(sPath);
}
}
if( aConfigPath.isEmpty() )
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 323b6af952e9..ccc1138e6d54 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1210,10 +1210,27 @@ bool WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection,
void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
{
// make sure all LO shared fonts are registered temporarily
- static bool bOnce = true;
- if( bOnce )
+ static bool bOnce = []()
{
- bOnce = false;
+ auto registerFontsIn = [](const OUString& dir) {
+ // collect fonts in font path that could not be registered
+ osl::Directory aFontDir(dir);
+ osl::FileBase::RC rcOSL = aFontDir.open();
+ if (rcOSL == osl::FileBase::E_None)
+ {
+ osl::DirectoryItem aDirItem;
+ SalData* pSalData = GetSalData();
+ assert(pSalData);
+
+ while (aFontDir.getNextItem(aDirItem, 10) == osl::FileBase::E_None)
+ {
+ osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL);
+ rcOSL = aDirItem.getFileStatus(aFileStatus);
+ if (rcOSL == osl::FileBase::E_None)
+ lcl_AddFontResource(*pSalData, aFileStatus.getFileURL(), true);
+ }
+ }
+ };
// determine font path
// since we are only interested in fonts that could not be
@@ -1222,24 +1239,14 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
OUString aPath("$BRAND_BASE_DIR");
rtl_bootstrap_expandMacros(&aPath.pData);
+ // internal font resources, required for normal operation, like OpenSymbol
+ registerFontsIn(aPath + "/" LIBO_SHARE_RESOURCE_FOLDER "/common/fonts");
+
// collect fonts in font path that could not be registered
- osl::Directory aFontDir(aPath + "/" LIBO_SHARE_FOLDER "/fonts/truetype");
- osl::FileBase::RC rcOSL = aFontDir.open();
- if( rcOSL == osl::FileBase::E_None )
- {
- osl::DirectoryItem aDirItem;
- SalData* pSalData = GetSalData();
- assert(pSalData);
+ registerFontsIn(aPath + "/" LIBO_SHARE_FOLDER "/fonts/truetype");
- while( aFontDir.getNextItem( aDirItem, 10 ) == osl::FileBase::E_None )
- {
- osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL );
- rcOSL = aDirItem.getFileStatus( aFileStatus );
- if ( rcOSL == osl::FileBase::E_None )
- lcl_AddFontResource(*pSalData, aFileStatus.getFileURL(), true);
- }
- }
- }
+ return true;
+ }();
ImplEnumInfo aInfo;
aInfo.mhDC = getHDC();