Commit 0bd046ea authored by Jérome Perrin's avatar Jérome Perrin

component/font,fontconfig: make fonts shareable

Instead of the previous approach which relied on a side effect of
installing *-fonts parts that would write in parts/fonts/ and make the
fonts automatically available to applications, use a new approach where
each part is "pure", without side effects.
To make the fonts available to applications, a fontconfig font.conf
listing all the parts with fonts needs to be generated and set as
$FONTCONFIG environment variable.

A template font.conf is included in component/fontconfig
parent 346a2905
[buildout]
extends =
../fonts/buildout.cfg
../freetype/buildout.cfg
../libxml2/buildout.cfg
../pkgconfig/buildout.cfg
......@@ -8,12 +7,14 @@ extends =
../zlib/buildout.cfg
../bzip2/buildout.cfg
../gperf/buildout.cfg
buildout.hash.cfg
parts =
fontconfig
[fontconfig]
recipe = slapos.recipe.cmmi
shared = true
url = http://fontconfig.org/release/fontconfig-2.12.6.tar.bz2
md5sum = 733f5e2371ca77b69707bd7b30cc2163
pkg_config_depends = ${freetype:pkg_config_depends}:${freetype:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig
......@@ -21,10 +22,15 @@ configure-options =
--disable-static
--disable-docs
--enable-libxml2
--with-default-fonts=${fonts:location}
--with-add-fonts=no
environment =
PATH=${pkgconfig:location}/bin:${gperf:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${:pkg_config_depends}
CPPFLAGS=-I${zlib:location}/include -I${bzip2:location}/include
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${bzip2:location}/lib -Wl,-rpath=${bzip2:location}/lib
[template-font-conf]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 640
[template-font-conf]
filename = font.conf.in
md5sum = 3600ce364c4fa240222fa12909b4109b
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
{#
# Generates a font.conf to be used as FONTCONFIG_FILE environment variable.
#
# This template needs the following keys in context:
#
# - cachedir: a directory to use a cachedir
# - fonts: directories containing fonts ( \n separated list of paths )
# for example {liberation-fonts:location}
# - includes: directories fontconfig configuration ( \n separated list of paths )
# typically, applications want to include {fontconfig:location}/etc/fonts/conf.d
# also some fonts packages bundles font.d
#}
<fontconfig>
<cachedir>{{ cachedir | escape}}</cachedir>
{% for font in fonts.splitlines() -%}
<dir>{{ font | escape}}</dir>
{% endfor %}
{% for include in includes.splitlines() -%}
<dir>{{ include | escape}}</dir>
{% endfor %}
</fontconfig>
\ No newline at end of file
......@@ -4,21 +4,24 @@ extends =
../p7zip/buildout.cfg
parts =
liberation-fonts
ipaex-fonts
ipa-fonts
ocrb-fonts
android-fonts
dejavu-fonts
ipa-fonts
ipaex-fonts
liberation-fonts
ocrb-fonts
[fonts]
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[fonts-base]
destination = ${fonts:location}/${:_buildout_section_name_}
location = ${:destination}
recipe = slapos.recipe.build:download-unpacked
strip-top-level-dir = true
# download and unpack, with shared parts support
recipe = slapos.recipe.cmmi
shared = true
configure-command = :
make-binary = :
post-install = cp -ra . ${:location}
location = @@LOCATION@@
environment =
PATH=${xz-utils:location}/bin:%(PATH)s
# Liberation(tm) Fonts - a font family which aims at metric
# compatibility with Arial, Times New Roman, and Courier New.
......@@ -61,7 +64,7 @@ md5sum = d0efec10b9f110a32e9b8f796e21782c
# Microsoft's TrueType core fonts
# non-free so not enabled by default
[msttcore-fonts]
location = ${fonts:location}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
recipe = slapos.recipe.build
install =
import os, subprocess
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment