Blame SOURCES/0001-Compensate-for-loss-of-Type-1-Standard-Symbols-L-sub.patch

dc0b3e
From 3125b22729f983436b282fbebe7c1283ff513342 Mon Sep 17 00:00:00 2001
dc0b3e
From: Stephan Bergmann <sbergman@redhat.com>
dc0b3e
Date: Fri, 22 Sep 2017 17:14:56 +0200
dc0b3e
Subject: [PATCH] Compensate for loss of Type 1 "Standard Symbols L" substitute
dc0b3e
 for "Symbol"
dc0b3e
MIME-Version: 1.0
dc0b3e
Content-Type: text/plain; charset=UTF-8
dc0b3e
Content-Transfer-Encoding: 8bit
dc0b3e
dc0b3e
At least for me on Linux since LO 5.3, 'soffice
dc0b3e
sw/qa/extras/rtfexport/data/fdo72031.rtf' shows "Å" (rendered in "DejaVu Sans")
dc0b3e
instead of "⊕" (rendered in "Standard Symbols L").  That's presumably because
dc0b3e
47ea13ef8dc8ab9aeded6121845e3ebd1d28b292 "Kill the old Unix layout engines"
dc0b3e
removed support for Type 1 fonts (see "Ignore Type 1 fonts" in
dc0b3e
FontCfgWrapper::addFontSet, vcl/unx/generic/fontmanager/fontconfig.cxx), and my
dc0b3e
(Fedora 25) /usr/share/fonts/default/Type1/s050000l.pfb "Standard Symbols L" is
dc0b3e
a Type 1 font.  So we fell back to fontconfig's generic (weak) suggestion of
dc0b3e
"DejaVu Sans" as a substitute for "Symbol".
dc0b3e
dc0b3e
So extend our fc_local.conf to suggest our "OpenSymbol" as a substitute for
dc0b3e
"Symbol".
dc0b3e
dc0b3e
As that fc_local.conf was originally brought along by --with-fonts, which is
dc0b3e
enabled by default but can be disabled, compilation of fc_local.conf from the
dc0b3e
various snippets is moved to postprocess.
dc0b3e
dc0b3e
macOS and Windows were never affected, as they both come with a "Symbol" font
dc0b3e
installed in the system.  (And we don't install fc_local.conf on Windows at
dc0b3e
all.)
dc0b3e
dc0b3e
Reviewed-on: https://gerrit.libreoffice.org/42670
dc0b3e
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
dc0b3e
Tested-by: Stephan Bergmann <sbergman@redhat.com>
dc0b3e
(cherry picked from commit e79f1261549d9c497a38ea1af8843a86883b02cd)
dc0b3e
dc0b3e
Change-Id: I8d6d87f24974577fd66f5f3989f606237ebb3d75
dc0b3e
---
dc0b3e
 Repository.mk                                      |  1 +
dc0b3e
 external/more_fonts/Module_more_fonts.mk           |  1 -
dc0b3e
 external/more_fonts/Package_conf.mk                | 14 ----------
dc0b3e
 .../{fonts/fc_local.conf => fc_local.snippet}      |  6 -----
dc0b3e
 extras/source/truetype/symbol/fc_local.snippet     |  6 +++++
dc0b3e
 postprocess/CustomTarget_fontconfig.mk             | 30 ++++++++++++++++++++++
dc0b3e
 postprocess/Module_postprocess.mk                  | 13 ++++++++++
dc0b3e
 postprocess/Package_fontconfig.mk                  | 18 +++++++++++++
dc0b3e
 vcl/unx/generic/fontmanager/fontconfig.cxx         |  2 ++
dc0b3e
 9 files changed, 70 insertions(+), 21 deletions(-)
dc0b3e
 delete mode 100644 external/more_fonts/Package_conf.mk
dc0b3e
 rename external/more_fonts/{fonts/fc_local.conf => fc_local.snippet} (84%)
dc0b3e
 create mode 100644 extras/source/truetype/symbol/fc_local.snippet
dc0b3e
 create mode 100644 postprocess/CustomTarget_fontconfig.mk
dc0b3e
 create mode 100644 postprocess/Package_fontconfig.mk
dc0b3e
dc0b3e
diff --git a/Repository.mk b/Repository.mk
dc0b3e
index eef2560..81ad205 100644
dc0b3e
--- a/Repository.mk
dc0b3e
+++ b/Repository.mk
dc0b3e
@@ -778,6 +778,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ure,\
dc0b3e
 ))
dc0b3e
 
dc0b3e
 $(eval $(call gb_Helper_register_packages_for_install,ooo,\
dc0b3e
+	$(if $(filter-out WNT,$(OS)),postprocess_fontconfig) \
dc0b3e
 	$(if $(SYSTEM_LIBEXTTEXTCAT),,libexttextcat_fingerprint) \
dc0b3e
 	officecfg_misc \
dc0b3e
 	extras_glade \
dc0b3e
diff --git a/external/more_fonts/Module_more_fonts.mk b/external/more_fonts/Module_more_fonts.mk
dc0b3e
index f584a8f..6e52247 100644
dc0b3e
--- a/external/more_fonts/Module_more_fonts.mk
dc0b3e
+++ b/external/more_fonts/Module_more_fonts.mk
dc0b3e
@@ -10,7 +10,6 @@
dc0b3e
 $(eval $(call gb_Module_Module,more_fonts))
dc0b3e
 
dc0b3e
 $(eval $(call gb_Module_add_targets,more_fonts,\
dc0b3e
-	Package_conf \
dc0b3e
 	ExternalPackage_caladea \
dc0b3e
 	ExternalPackage_carlito \
dc0b3e
 	ExternalPackage_dejavu \
dc0b3e
diff --git a/external/more_fonts/Package_conf.mk b/external/more_fonts/Package_conf.mk
dc0b3e
deleted file mode 100644
dc0b3e
index 2d259c2..0000000
dc0b3e
--- a/external/more_fonts/Package_conf.mk
dc0b3e
+++ /dev/null
dc0b3e
@@ -1,14 +0,0 @@
dc0b3e
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
dc0b3e
-#
dc0b3e
-# This file is part of the LibreOffice project.
dc0b3e
-#
dc0b3e
-# This Source Code Form is subject to the terms of the Mozilla Public
dc0b3e
-# License, v. 2.0. If a copy of the MPL was not distributed with this
dc0b3e
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
dc0b3e
-#
dc0b3e
-
dc0b3e
-$(eval $(call gb_Package_Package,more_fonts_conf,$(SRCDIR)/external/more_fonts/fonts))
dc0b3e
-
dc0b3e
-$(eval $(call gb_Package_add_file,more_fonts_conf,$(LIBO_SHARE_FOLDER)/fonts/truetype/fc_local.conf,fc_local.conf))
dc0b3e
-
dc0b3e
-# vim: set noet sw=4 ts=4:
dc0b3e
diff --git a/external/more_fonts/fonts/fc_local.conf b/external/more_fonts/fc_local.snippet
dc0b3e
similarity index 84%
dc0b3e
rename from external/more_fonts/fonts/fc_local.conf
dc0b3e
rename to external/more_fonts/fc_local.snippet
dc0b3e
index 6af763c..cb49929 100644
dc0b3e
--- a/external/more_fonts/fonts/fc_local.conf
dc0b3e
+++ b/external/more_fonts/fc_local.snippet
dc0b3e
@@ -1,7 +1,3 @@
dc0b3e
-
dc0b3e
-
dc0b3e
-<fontconfig>
dc0b3e
-
dc0b3e
 	
dc0b3e
 
dc0b3e
 	<alias binding="same">
dc0b3e
@@ -31,5 +27,3 @@
dc0b3e
 	  <family>Caladea</family>
dc0b3e
 	  </accept>
dc0b3e
 	</alias>
dc0b3e
-
dc0b3e
-</fontconfig>
dc0b3e
diff --git a/extras/source/truetype/symbol/fc_local.snippet b/extras/source/truetype/symbol/fc_local.snippet
dc0b3e
new file mode 100644
dc0b3e
index 0000000..5b29e1d
dc0b3e
--- /dev/null
dc0b3e
+++ b/extras/source/truetype/symbol/fc_local.snippet
dc0b3e
@@ -0,0 +1,6 @@
dc0b3e
+<match target="pattern">
dc0b3e
+  <test name="family"><string>Symbol</string></test>
dc0b3e
+  <edit name="family" mode="append" binding="same">
dc0b3e
+    <string>OpenSymbol</string>
dc0b3e
+  </edit>
dc0b3e
+</match>
dc0b3e
diff --git a/postprocess/CustomTarget_fontconfig.mk b/postprocess/CustomTarget_fontconfig.mk
dc0b3e
new file mode 100644
dc0b3e
index 0000000..72ff3f3
dc0b3e
--- /dev/null
dc0b3e
+++ b/postprocess/CustomTarget_fontconfig.mk
dc0b3e
@@ -0,0 +1,30 @@
dc0b3e
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
dc0b3e
+#
dc0b3e
+# This file is part of the LibreOffice project.
dc0b3e
+#
dc0b3e
+# This Source Code Form is subject to the terms of the Mozilla Public
dc0b3e
+# License, v. 2.0. If a copy of the MPL was not distributed with this
dc0b3e
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
dc0b3e
+#
dc0b3e
+
dc0b3e
+$(eval $(call gb_CustomTarget_CustomTarget,postprocess/fontconfig))
dc0b3e
+
dc0b3e
+$(call gb_CustomTarget_get_workdir,postprocess/fontconfig)/fc_local.conf: \
dc0b3e
+    $(SRCDIR)/extras/source/truetype/symbol/fc_local.snippet \
dc0b3e
+    $(SRCDIR)/postprocess/CustomTarget_fontconfig.mk \
dc0b3e
+    | $(call gb_CustomTarget_get_workdir,postprocess/fontconfig)/.dir
dc0b3e
+
dc0b3e
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
dc0b3e
+$(call gb_CustomTarget_get_workdir,postprocess/fontconfig)/fc_local.conf: \
dc0b3e
+    $(SRCDIR)/external/more_fonts/fc_local.snippet
dc0b3e
+endif
dc0b3e
+
dc0b3e
+$(call gb_CustomTarget_get_workdir,postprocess/fontconfig)/fc_local.conf:
dc0b3e
+	printf '\n\n<fontconfig>\n' >$@
dc0b3e
+	cat $(SRCDIR)/extras/source/truetype/symbol/fc_local.snippet >>$@
dc0b3e
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
dc0b3e
+	cat $(SRCDIR)/external/more_fonts/fc_local.snippet >>$@
dc0b3e
+endif
dc0b3e
+	printf '</fontconfig>\n' >>$@
dc0b3e
+
dc0b3e
+# vim: set noet sw=4 ts=4:
dc0b3e
diff --git a/postprocess/Module_postprocess.mk b/postprocess/Module_postprocess.mk
dc0b3e
index 5775cfa..6ab59fc 100644
dc0b3e
--- a/postprocess/Module_postprocess.mk
dc0b3e
+++ b/postprocess/Module_postprocess.mk
dc0b3e
@@ -28,6 +28,19 @@ $(eval $(call gb_Module_add_targets,postprocess,\
dc0b3e
 ))
dc0b3e
 endif
dc0b3e
 
dc0b3e
+# For configurations that use fontconfig (cf. inclusion of
dc0b3e
+# vcl/unx/generic/fontmanager/fontconfig.cxx in Library_vcl), add
dc0b3e
+# instdir/share/fonts/truetype/fc_local.conf when it shall
dc0b3e
+# contain content from at least one of external/more_fonts/fc_local.snippet
dc0b3e
+# (conditional on MORE_FONTS in BUILD_TYPE) and
dc0b3e
+# extras/source/truetype/symbol/fc_local.snippet (unconditional):
dc0b3e
+ifneq ($(USING_X11)$(ENABLE_HEADLESS)$(filter ANDROID,$(OS)),)
dc0b3e
+$(eval $(call gb_Module_add_targets,postprocess, \
dc0b3e
+    CustomTarget_fontconfig \
dc0b3e
+    Package_fontconfig \
dc0b3e
+))
dc0b3e
+endif
dc0b3e
+
dc0b3e
 $(eval $(call gb_Module_add_check_targets,postprocess,\
dc0b3e
 	CppunitTest_services \
dc0b3e
 ))
dc0b3e
diff --git a/postprocess/Package_fontconfig.mk b/postprocess/Package_fontconfig.mk
dc0b3e
new file mode 100644
dc0b3e
index 0000000..37f096e
dc0b3e
--- /dev/null
dc0b3e
+++ b/postprocess/Package_fontconfig.mk
dc0b3e
@@ -0,0 +1,18 @@
dc0b3e
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
dc0b3e
+#
dc0b3e
+# This file is part of the LibreOffice project.
dc0b3e
+#
dc0b3e
+# This Source Code Form is subject to the terms of the Mozilla Public
dc0b3e
+# License, v. 2.0. If a copy of the MPL was not distributed with this
dc0b3e
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
dc0b3e
+#
dc0b3e
+
dc0b3e
+$(eval $(call gb_Package_Package,postprocess_fontconfig,$(call gb_CustomTarget_get_workdir,postprocess/fontconfig)))
dc0b3e
+
dc0b3e
+$(eval $(call gb_Package_add_files,postprocess_fontconfig,$(LIBO_SHARE_FOLDER)/fonts/truetype, \
dc0b3e
+    fc_local.conf \
dc0b3e
+))
dc0b3e
+
dc0b3e
+$(eval $(call gb_Package_use_custom_target,postprocess_fontconfig,postprocess/fontconfig))
dc0b3e
+
dc0b3e
+# vim: set noet sw=4 ts=4:
dc0b3e
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
dc0b3e
index c85b12f..baf31dd 100644
dc0b3e
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
dc0b3e
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
dc0b3e
@@ -706,6 +706,8 @@ bool PrintFontManager::addFontconfigDir( const OString& rDirName )
dc0b3e
                         reinterpret_cast<FcChar8 const *>(aConfFileName.getStr()), FcTrue);
dc0b3e
         if( !bCfgOk )
dc0b3e
             fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk );
dc0b3e
+    } else {
dc0b3e
+        SAL_INFO("vcl", "cannot open " << aConfFileName);
dc0b3e
     }
dc0b3e
 
dc0b3e
     return true;
dc0b3e
-- 
dc0b3e
2.9.5
dc0b3e