This was much more complicated than expected. Most of that thanks to the inscrutability of fontconfig. Fonts from the Microsoft Store get installed in a separate folder per product, under the WindowsApps folder. Each such font product folder contains one or several TrueType font files, and metadata files, and preview images, etc. Add a C++ source file to fontconfig that uses DirectWrite to enumerate the available fonts. Take only those with a source type of DWRITE_FONT_SOURCE_TYPE_APPX_PACKAGE into account. Other fonts are found as before, looking in the system fonts folder (typically C:\Windows\Fonts) and in the per-user fonts folder (typically C:\Users\username\AppData\Local\Microsoft\Windows\Fonts). This C++ code requires headers from the winrt tree in the Windows SDK, so add that to SOLARINC. Sadly, thanks to the way fontconfig works (scanning directories for font files), I need to let it scan the folders of font products from the Microsoft Store to find the font files, even if the DirectWrite API would already give us the font file names directly. But I didn't want to modify fontconfig too much, so oh well. There was something weird in how fontconfig calculates the hash for directory names to be used in its cache files. It ended up creating more and more cache files for the same directories each time CODA-W was run. I could not understand what was going on, but in any case, just making sure that FcConfigMapFontPath() and FcConfigMapSalt() don't do anything on Windows seems to help. Also change the way freetype is built so that only the special FT_Done_MM_Var is exported, not all public functions. This was necessary because for some unknown reason, when linking the vcl DLL I started getting errors for the freetype symbols that happen to be linked into also the cairo DLL. If we eventually can switch to building all of core statically for CODA-W this problem will go away. Also stop defining FT_DEBUG_LOGGING, such logging will not show up anywhere for end-users, and fixing problems in freetype on Windows will have to be done by reproducing and debugging in the VS debugger anyway. There is still much to do to make fontconfig (and probably freetype and cairo) work really correctly on Windows. The most obvious thing is that the file name handling is broken. This is perhaps understandable as the port of that code to Windows is from over 20 years ago, I think. It works for file and folder names in ASCII, but most likely not for others. At least the user profile directory, under which per-user font files are stored, will definitely have non-ASCII in many cases. We should modify the code to use <tools/UnixWrappers.h>, so that all file system access is done using proper wide character (UTF-16) APIs. Pathnames that these libraries handle will then be in UTF-8. The opendir() etc emulation in fontconfig should also be replaced by adding such to UnixWrappers.h instead. Signed-off-by: Tor Lillqvist <tml@collabora.com> Change-Id: I4bc6e32dcc32ff74b79679edacee1aecebd774c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196336 Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com> Tested-by: Tor Lillqvist <tml@iki.fi> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197507 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@iki.fi>
191 lines
4.1 KiB
Makefile
191 lines
4.1 KiB
Makefile
# -*- 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_Library_Library,cairo))
|
|
|
|
$(eval $(call gb_Library_set_include,cairo,\
|
|
-I$(gb_UnpackedTarball_workdir)/cairo \
|
|
-I$(gb_UnpackedTarball_workdir)/cairo/src \
|
|
-I$(gb_UnpackedTarball_workdir)/pixman/pixman \
|
|
-I$(gb_UnpackedTarball_workdir)/freetype/include \
|
|
-I$(gb_UnpackedTarball_workdir)/fontconfig \
|
|
$$(INCLUDE) \
|
|
))
|
|
|
|
$(eval $(call gb_Library_add_defs,cairo,\
|
|
-wd4057 \
|
|
-wd4100 \
|
|
-wd4132 \
|
|
-wd4146 \
|
|
-wd4200 \
|
|
-wd4245 \
|
|
-wd4267 \
|
|
-wd4295 \
|
|
-wd4456 \
|
|
-wd4701 \
|
|
-wd4702 \
|
|
-wd4703 \
|
|
-wd5294 \
|
|
-wd5286 \
|
|
-wd5287 \
|
|
-DCAIRO_COMPILATION \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_static_libraries,cairo, \
|
|
expat \
|
|
fontconfig \
|
|
freetype \
|
|
pixman \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_externals,cairo,\
|
|
zlib \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_system_win32_libs,cairo,\
|
|
dwrite \
|
|
ole32 \
|
|
shell32 \
|
|
))
|
|
|
|
$(eval $(call gb_Library_add_generated_cobjects,cairo,\
|
|
$(addprefix UnpackedTarball/cairo/src/, \
|
|
cairo-analysis-surface \
|
|
cairo-arc \
|
|
cairo-array \
|
|
cairo-atomic \
|
|
cairo-base64-stream \
|
|
cairo-base85-stream \
|
|
cairo-bentley-ottmann-rectangular \
|
|
cairo-bentley-ottmann-rectilinear \
|
|
cairo-bentley-ottmann \
|
|
cairo-botor-scan-converter \
|
|
cairo-boxes-intersect \
|
|
cairo-boxes \
|
|
cairo-cache \
|
|
cairo-clip-boxes \
|
|
cairo-clip-polygon \
|
|
cairo-clip-region \
|
|
cairo-clip-surface \
|
|
cairo-clip-tor-scan-converter \
|
|
cairo-clip \
|
|
cairo-color \
|
|
cairo-composite-rectangles \
|
|
cairo-compositor \
|
|
cairo-contour \
|
|
cairo-damage \
|
|
cairo-debug \
|
|
cairo-default-context \
|
|
cairo-device \
|
|
cairo-error \
|
|
cairo-fallback-compositor \
|
|
cairo-fixed \
|
|
cairo-font-face-twin-data \
|
|
cairo-font-face-twin \
|
|
cairo-font-face \
|
|
cairo-font-options \
|
|
cairo-freed-pool \
|
|
cairo-freelist \
|
|
cairo-gstate \
|
|
cairo-hash \
|
|
cairo-hull \
|
|
cairo-image-compositor \
|
|
cairo-image-info \
|
|
cairo-image-source \
|
|
cairo-image-surface \
|
|
cairo-line \
|
|
cairo-lzw \
|
|
cairo-mask-compositor \
|
|
cairo-matrix \
|
|
cairo-mempool \
|
|
cairo-mesh-pattern-rasterizer \
|
|
cairo-misc \
|
|
cairo-mono-scan-converter \
|
|
cairo-mutex \
|
|
cairo-no-compositor \
|
|
cairo-observer \
|
|
cairo-output-stream \
|
|
cairo-paginated-surface \
|
|
cairo-path-bounds \
|
|
cairo-path-fill \
|
|
cairo-path-fixed \
|
|
cairo-path-in-fill \
|
|
cairo-path-stroke-boxes \
|
|
cairo-path-stroke-polygon \
|
|
cairo-path-stroke-traps \
|
|
cairo-path-stroke-tristrip \
|
|
cairo-path-stroke \
|
|
cairo-path \
|
|
cairo-pattern \
|
|
cairo-pen \
|
|
cairo-polygon-intersect \
|
|
cairo-polygon-reduce \
|
|
cairo-polygon \
|
|
cairo-raster-source-pattern \
|
|
cairo-recording-surface \
|
|
cairo-rectangle \
|
|
cairo-rectangular-scan-converter \
|
|
cairo-region \
|
|
cairo-rtree \
|
|
cairo-scaled-font \
|
|
cairo-shape-mask-compositor \
|
|
cairo-slope \
|
|
cairo-spans-compositor \
|
|
cairo-spans \
|
|
cairo-spline \
|
|
cairo-stroke-dash \
|
|
cairo-stroke-style \
|
|
cairo-surface-clipper \
|
|
cairo-surface-fallback \
|
|
cairo-surface-observer \
|
|
cairo-surface-offset \
|
|
cairo-surface-snapshot \
|
|
cairo-surface-subsurface \
|
|
cairo-surface-wrapper \
|
|
cairo-surface \
|
|
cairo-time \
|
|
cairo-tor-scan-converter \
|
|
cairo-tor22-scan-converter \
|
|
cairo-toy-font-face \
|
|
cairo-traps-compositor \
|
|
cairo-traps \
|
|
cairo-tristrip \
|
|
cairo-unicode \
|
|
cairo-user-font \
|
|
cairo-version \
|
|
cairo-wideint \
|
|
cairo \
|
|
cairo-cff-subset \
|
|
cairo-scaled-font-subsets \
|
|
cairo-truetype-subset \
|
|
cairo-type1-fallback \
|
|
cairo-type1-glyph-names \
|
|
cairo-type1-subset \
|
|
cairo-type3-glyph-surface \
|
|
cairo-script-surface \
|
|
cairo-pdf-surface \
|
|
cairo-pdf-interchange \
|
|
cairo-pdf-operators \
|
|
cairo-pdf-shading \
|
|
cairo-tag-attributes \
|
|
cairo-tag-stack \
|
|
cairo-deflate-stream \
|
|
cairo-ft-font \
|
|
) \
|
|
))
|
|
|
|
$(eval $(call gb_Library_add_generated_cobjects,cairo,\
|
|
$(addprefix UnpackedTarball/cairo/util/, \
|
|
cairo-missing/strndup \
|
|
) \
|
|
))
|
|
|
|
|
|
# vim: set noet sw=4 ts=4:
|