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

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