Repository.mk                                          |    2 
 RepositoryExternal.mk                                  |    8 ++
 external/fontconfig/ExternalPackage_fontconfig_data.mk |   58 +++++++++++++++++
 external/fontconfig/ExternalProject_fontconfig.mk      |    9 ++
 external/fontconfig/Module_fontconfig.mk               |    1 
 static/CustomTarget_emscripten_fs_image.mk             |    2 
 6 files changed, 76 insertions(+), 4 deletions(-)

New commits:
commit b7313bc131a285056906f85b51b0c3b53b7b3560
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Tue Nov 30 18:58:10 2021 +0100
Commit:     Jan-Marek Glogowski <[email protected]>
CommitDate: Wed Jan 19 19:28:12 2022 +0100

    WASM add fontconfig data to FS image
    
    We probably want to pre-create the fontconfig cache in the image.
    Startup time still is not really worse for me, but YMMV.
    
    Change-Id: I419682339dd6d943753de9043ff82f2fb877b168
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128624
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>

diff --git a/Repository.mk b/Repository.mk
index 048b7a6204b9..6b88ec6cfc2a 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -998,7 +998,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 
 $(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\
        extras_fonts \
-       $(if $(USING_X11)$(DISABLE_GUI)$(filter ANDROID,$(OS)), \
+       $(if $(USING_X11)$(DISABLE_GUI)$(filter ANDROID EMSCRIPTEN,$(OS)), \
                postprocess_fontconfig) \
        $(call gb_Helper_optional,MORE_FONTS,\
                fonts_alef \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index e391bc5ff7c1..e29847e4eff1 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1269,9 +1269,15 @@ $(call gb_LinkTarget_add_libs,$(1),$(FONTCONFIG_LIBS))
 
 endef
 
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+    libfontconfig_data \
+))
+endif
+
 gb_ExternalProject__use_fontconfig :=
 
-else
+else # SYSTEM_FONTCONFIG
 
 define gb_LinkTarget__use_fontconfig
 $(call gb_LinkTarget_use_external_project,$(1),fontconfig)
diff --git a/external/fontconfig/ExternalPackage_fontconfig_data.mk 
b/external/fontconfig/ExternalPackage_fontconfig_data.mk
new file mode 100644
index 000000000000..cc33c26705d7
--- /dev/null
+++ b/external/fontconfig/ExternalPackage_fontconfig_data.mk
@@ -0,0 +1,58 @@
+# -*- 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_ExternalPackage_ExternalPackage,fontconfig_data,fontconfig))
+
+$(eval $(call 
gb_ExternalPackage_use_external_project,fontconfig_data,fontconfig))
+
+$(eval $(call 
gb_ExternalPackage_add_files,fontconfig_data,$(LIBO_SHARE_FOLDER)/fontconfig,\
+    fonts.conf \
+))
+
+$(eval $(call 
gb_ExternalPackage_add_unpacked_files,fontconfig_data,$(LIBO_SHARE_FOLDER)/fontconfig/conf.d,\
+    conf.d/05-reset-dirs-sample.conf \
+    conf.d/09-autohint-if-no-hinting.conf \
+    conf.d/10-autohint.conf \
+    conf.d/10-hinting-full.conf \
+    conf.d/10-hinting-medium.conf \
+    conf.d/10-hinting-none.conf \
+    conf.d/10-hinting-slight.conf \
+    conf.d/10-no-sub-pixel.conf \
+    conf.d/10-scale-bitmap-fonts.conf \
+    conf.d/10-sub-pixel-bgr.conf \
+    conf.d/10-sub-pixel-rgb.conf \
+    conf.d/10-sub-pixel-vbgr.conf \
+    conf.d/10-sub-pixel-vrgb.conf \
+    conf.d/10-unhinted.conf \
+    conf.d/11-lcdfilter-default.conf \
+    conf.d/11-lcdfilter-legacy.conf \
+    conf.d/11-lcdfilter-light.conf \
+    conf.d/20-unhint-small-vera.conf \
+    conf.d/25-unhint-nonlatin.conf \
+    conf.d/30-metric-aliases.conf \
+    conf.d/35-lang-normalize.conf \
+    conf.d/40-nonlatin.conf \
+    conf.d/45-generic.conf \
+    conf.d/45-latin.conf \
+    conf.d/49-sansserif.conf \
+    conf.d/50-user.conf \
+    conf.d/51-local.conf \
+    conf.d/60-generic.conf \
+    conf.d/60-latin.conf \
+    conf.d/65-fonts-persian.conf \
+    conf.d/65-khmer.conf \
+    conf.d/65-nonlatin.conf \
+    conf.d/69-unifont.conf \
+    conf.d/70-no-bitmaps.conf \
+    conf.d/70-yes-bitmaps.conf \
+    conf.d/80-delicious.conf \
+    conf.d/90-synthetic.conf \
+))
+
+# vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/external/fontconfig/ExternalProject_fontconfig.mk 
b/external/fontconfig/ExternalProject_fontconfig.mk
index 8cb9498fe763..792f2f6df851 100644
--- a/external/fontconfig/ExternalProject_fontconfig.mk
+++ b/external/fontconfig/ExternalProject_fontconfig.mk
@@ -30,8 +30,13 @@ $(call gb_ExternalProject_get_state_target,fontconfig,build) 
:
                        --with-expat-includes=$(call 
gb_UnpackedTarball_get_dir,expat)/lib \
                        --with-expat-lib=$(gb_StaticLibrary_WORKDIR) \
                        --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
-                       $(if $(filter EMSCRIPTEN,$(OS)),ac_cv_func_fstatfs=no 
ac_cv_func_fstatvfs=no) \
-               && $(MAKE) -C src \
+                       $(if $(filter EMSCRIPTEN,$(OS)), \
+                           --with-baseconfigdir=/instdir/share/fontconfig \
+                           --with-cache-dir=/instdir/share/fontconfig/cache \
+                           --with-add-fonts=/instdir/share/fonts \
+                           ac_cv_func_fstatfs=no ac_cv_func_fstatvfs=no \
+                       ) \
+               && $(MAKE) -C src && $(MAKE) fonts.conf \
        )
        $(call gb_Trace_EndRange,fontconfig,EXTERNAL)
 
diff --git a/external/fontconfig/Module_fontconfig.mk 
b/external/fontconfig/Module_fontconfig.mk
index e755f8610db1..2f8f9c8f54d6 100644
--- a/external/fontconfig/Module_fontconfig.mk
+++ b/external/fontconfig/Module_fontconfig.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_Module_Module,fontconfig))
 
 $(eval $(call gb_Module_add_targets,fontconfig,\
        ExternalProject_fontconfig \
+       $(if $(filter EMSCRIPTEN,$(OS)),ExternalPackage_fontconfig_data) \
        UnpackedTarball_fontconfig \
 ))
 
diff --git a/static/CustomTarget_emscripten_fs_image.mk 
b/static/CustomTarget_emscripten_fs_image.mk
index 932afacf37e3..b473cd881f27 100644
--- a/static/CustomTarget_emscripten_fs_image.mk
+++ b/static/CustomTarget_emscripten_fs_image.mk
@@ -1104,6 +1104,7 @@ gb_emscripten_fs_image_files := \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/config/wizard/form/styles/red.css \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/config/wizard/form/styles/violet.css \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/config/wizard/form/styles/water.css \
+    $(INSTROOT)/$(LIBO_SHARE_FOLDER)/fonts/truetype/fc_local.conf \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/gallery/fontwork.sdg \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/gallery/fontwork.sdv \
     $(INSTROOT)/$(LIBO_SHARE_FOLDER)/gallery/fontwork.thm \
@@ -1140,6 +1141,7 @@ gb_emscripten_fs_image_autoinstall += $(call 
gb_AutoInstall_get_target,ooo_fonts
 endif
 
 gb_emscripten_fs_image_filelists += $(call 
gb_Package_get_target,liblangtag_data)
+gb_emscripten_fs_image_filelists += $(call 
gb_Package_get_target,fontconfig_data)
 
 #
 # Ruleset

Reply via email to