Commit Graph

119 Commits

Author SHA1 Message Date
Jan Tojnar
4f0f26771e
Merge pull request #95358 from jtojnar/global-fontconfig 2020-09-05 00:19:38 +02:00
Jan Tojnar
6f96063804
makeFontsConf: clean up
The use of the argument was removed in 2016 but its definition was left behind.

cd2948a72e
2020-09-03 09:42:58 +02:00
Jan Tojnar
6dd3b54ccc
treewide: use URN for fontconfig DTD
To match upstream change:

9c46ef4aac
2020-09-03 06:39:00 +02:00
Jan Tojnar
b49a769970
fontconfig: get rid of rest of versioned configs
The incompatibility does not seem to exist any more: programs linked against fc 2.12
on fc 2.14 system seem to at least display text, even while printing tons of errors
(as long as you generate fc cache manually), and same thing the other way around.
Hopefully it will not be an issue in the future.
2020-08-29 19:16:22 +02:00
Jan Tojnar
89401d986c
Revert "fontconfig: Only read versioned config dirs"
This reverts commit edf2541f02.

Turns out lot of software (including Chromium) use bundled fontconfig
so we either need to wrap every one of those, or re-introduce the global
unversioned config. The latter is easier but weakens hermetic configs.

But perhaps those are not really worth the effort. Given that programs
linked against fc 2.12.6 on fc 2.13.92 system seem to at least display text,
even while printing tons of errors (as long as you generate fc cache manually),
and same thing the other way around, hopefully it will not be an issue in the future.

We give up on the hermetic configs in exchange for getting rid of lot of complexity.
2020-08-29 19:15:36 +02:00
Florian Klink
b761543f16 fontconfig_210: remove
This isn't used anymore anywhere, and vulnerable to CVE-2016-5384.
2020-08-12 13:40:46 +02:00
Jan Tojnar
6f8345035b
fontconfig: remove its rules from configs
ITS rules are used for extracting translatable strings and they have
been moved to external files in 2.13.92 so they are not needed in
the config files themselves.

Removing them also cuts down on errors/warnings produced when using
older versions of fontconfig (< 2.12.92). Now it will only complain
about the description element but that is fortunately just a warning,
not errors like the ones caused by the its attributes.

Thanks to this, we can change the config version in NixOS module
back to 2.11 allowing us to re-use the 2.13/2.14 configs for apps
built against 2.12 fontconfig.
2020-07-11 17:05:15 +02:00
Jan Tojnar
993deed7ab
fontconfig: Load fonts also from FHS paths
With previous patch, we no longer load non-versioned fonts.conf file to avoid incompatibilities
but this also means fontconfig will not load system-wide installed fonts on non-NixOS systems.

As a compromise, let's hardcode the FHS font paths to the built-in config so that the system
fonts work there. Unlike with the system config we do not need to worry about compatibility as
incompatible font files will be simply ignored.

Of course there will still be disparity if the system install fonts to some other location than
these two but I am afraid this is the best we can do.

See https://github.com/NixOS/nixpkgs/pull/73795#issuecomment-635771967 for discussion.
2020-07-11 17:05:13 +02:00
Jan Tojnar
edf2541f02
fontconfig: Only read versioned config dirs
Falling back to unversioned `/etc/fonts/conf.d` when versioned one does not exist
is problematic since it only occurs on non-NixOS systems and those are likely
to have a different version of fontconfig. When those versions use incompatible
elements in the config, apps using fontconfig will crash.

Instead, we are now falling back to the in-package `fonts.conf` file that loads
both the versioned global `conf.d` directory and the in-package `conf.d` since using
upstream settings on non-NixOS is preferable to not being able to use apps there.

In fact, we would not even need to link `fonts.conf`, as the in-package `fonts.conf`
will be always used unless someone creates the global one manually (the option is still
retained if one wants to write a custom NixOS module and to avoid unnecessary stat call on NixOS).

Additionally, since the `fonts.conf` will always load `conf.d` from the package, we no longer
need to install them to sytem `/etc` in the module. This needed some mucking with `50-user.conf`
which disables configs in user directories (a good thing IMO, NixOS module will turn it back on)
but otherwise, it is cleaner. The files are still prioritized by their name, regardless of their location.

See https://github.com/NixOS/nixpkgs/pull/73795#issuecomment-634370125 for more information.
2020-07-11 17:05:13 +02:00
worldofpeace
87786bc47f
fontconfig: bump configVersion to 2.13 2020-07-11 17:05:13 +02:00
worldofpeace
27b14ee82a
fontconfig: 2.12.6 -> 2.13.92 2020-07-11 17:05:12 +02:00
Michael Reilly
84cf00f980
treewide: Per RFC45, remove all unquoted URLs 2020-04-10 17:54:53 +01:00
Robin Gloster
2157dcd141
treewide: installFlags is a list 2019-12-30 13:22:43 +01:00
Robin Gloster
fb129117d2
fontconfig: *Flags are lists 2019-12-30 11:13:39 +01:00
Eyal Kalderon
a95e0ac8e4 makeFontsCache: Fix cross-compiling, missing fc-cache
This commit fixes missing fc-cache binary from make-fonts-cache.nix build:
```
builder for '/nix/store/az48nr8gdqrw3fliddmi82ghj2ljxrj4-fc-cache.drv' failed with exit code 127; last 1 log lines:
  /nix/store/p3z1lgsi7xymvl7akg531ikwiisqs4x5-stdenv-linux/setup: line 1299: fc-cache: command not found
cannot build derivation '/nix/store/swaxvjsf8h0rsmm9kigp6j3f5q5h4nvg-fc-00-nixos-cache.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wiaiv0pq7w1xm2i2fqp2ngd1ljb4n6n9-fontconfig-conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4zhiwpiyccs0rs26bs3q0w8fwaxrrgw0-fontconfig-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xhvljdp9b00fbkapx6cbfs4sjdh49qwv-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/w63q0n0vh7vkdfrjmhb41qy1alx7qa8s-nixos-system-nixos-19.09.git.c814289.drv': 1 dependencies couldn't be built
```
2019-11-13 16:32:30 +01:00
Jan Tojnar
3665a31a4a
Merge pull request #67663 from jtojnar/fc-joypixels
fontconfig: add support for JoyPixels font
2019-08-30 00:30:13 +02:00
Jan Tojnar
37018e70d1
fontconfig: add support for JoyPixels font
Mirroring the following upstream merge request
https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/67
2019-08-29 02:15:26 +02:00
volth
08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
volth
46420bbaa3 treewide: name -> pname (easy cases) (#66585)
treewide replacement of

stdenv.mkDerivation rec {
  name = "*-${version}";
  version = "*";

to pname
2019-08-15 13:41:18 +01:00
Michael Eden
3bcede8f5c librsvg: make-fonts-conf: update with correct native deps 2019-03-29 11:11:56 -04:00
volth
98e2820f59
makeFontsCache: allowSubstitutes = false
trivial builder
2019-02-08 00:24:14 +00:00
Jörg Thalheim
4f87d7e733
Revert "fontconfig: fix cross make-fonts-cache & make-fonts-config"
This reverts commit 508cbf4d25.

This make the function ignore the fontconfig variable
2018-12-07 11:59:38 +00:00
eburimu
508cbf4d25 fontconfig: fix cross make-fonts-cache & make-fonts-config 2018-12-06 03:58:19 +03:00
eburimu
36e2e9dd33 fontconfig: use native xsltproc in case of cross compilation
Fixes #50801
2018-11-21 01:48:23 -06:00
Symphorien Gibol
a6a29e07bc nixos/fontconfig/make-fonts-cache: don't fail to clean the cache
Today I couldn't rebuild because of:
[...]
/nix/store/lxkrsrlqplz2n75hvpq6vr0gam0gfgrl-font-cursor-misc-1.0.3/lib/X11/fonts/misc: skipping, existing cache is valid: 1 fonts, 0 dirs
/var/cache/fontconfig: cleaning cache directory
/nix/store/xq3c44ha15pfa5a9mv1z9mni3cfghsna-fc-cache: cleaning cache directory
fc-cache: succeeded
rm: cannot remove '/nix/store/xq3c44ha15pfa5a9mv1z9mni3cfghsna-fc-cache/CACHEDIR.TAG': No such file or directory
builder for '/nix/store/zxfmil40n79vhn5hb4flqc76j99a3l7b-fc-cache.drv' failed with exit code 1
2018-11-04 21:23:52 +01:00
John Ericson
0828e2d8c3 treewide: Remove usage of remaining redundant platform compatability stuff
Want to get this out of here for 18.09, so it can be deprecated
thereafter.
2018-08-30 17:20:32 -04:00
volth
52f53c69ce pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
John Ericson
5e17335bd7 Merge remote-tracking branch 'upstream/staging' into strictDeps 2018-05-14 23:33:03 -04:00
John Ericson
330ca731e8 treewide: Get rid of all uses of crossConfig
The hack of using `crossConfig` to enforce stricter handling of
dependencies is replaced with a dedicated `strictDeps` for that purpose.
(Experience has shown that my punning was a terrible idea that made more
difficult and embarrising to teach teach.)

Now that is is clear, a few packages now use `strictDeps`, to fix
various bugs:

 - bintools-wrapper and cc-wrapper
2018-05-14 23:30:37 -04:00
John Ericson
7d0906eea8 fontconfig: Clean up cross 2018-05-10 01:57:49 -04:00
John Ericson
feb648ce59 Merge commit '70963b382f3f820ba6d3bc3b3aaf50a2957ec1ff' into lib-platform-simplify 2018-05-10 01:40:38 -04:00
John Ericson
a02be2bd85 treewide: Get rid of *Platform.arch
Use `parsed.cpu.name` or `platform.gcc.arch` instead.
2018-05-10 01:37:31 -04:00
Nikolay Amiantov
a536aee981 fontconfig: 2.12.1 -> 2.12.6 2018-03-06 13:09:19 +03:00
Hamish Mackenzie
6ad745209f
fontconfig: Fix for HFS+ 1s date resolution issue
HFS+ (still common on macOS machines) only has a
date resolution of 1 second.  This change makes sure that
`fcobjshash.h` gets a newer timestamp than `fcobjshash.gperf`.
2018-02-12 21:10:20 +13:00
Bjørn Forsman
8ea7a302bd make-fonts-cache: remove CACHEDIR.TAG file from Nix store
A CACHEDIR.TAG file indicates that the contents can be automatically
re-generated. This is not really true for Nix store paths. (Well _Nix_
can recreate them, but that's different.)

I noticed this issue as I was restoring full system backup that "for
some reason" always missed /nix/store/*-fc-cache (found by `nix-store
--verify --repair`). Turns out I was excluding caches from my backup...
2018-02-11 16:07:43 +01:00
John Ericson
531e4b80c9 misc pkgs: Basic sed to get fix pkgconfig and autoreconfHook buildInputs
Only acts on one-line dependency lists.
2017-09-21 15:49:53 -04:00
Tuomas Tynkkynen
886837f479 make-fonts-cache.nix: Don't build-depend on unnecessary outputs of fontconfig 2017-09-11 19:22:01 +03:00
hsloan
9b2d1cbc70 fontconfig default: Don't use stdenv.cross 2017-06-28 19:31:16 -04:00
hsloan
0fa3d99f4e fontconfig 2.10: Don't use stdenv.cross 2017-06-28 19:29:41 -04:00
Tuomas Tynkkynen
4df59beb01 fontconfig_210: Remove reference to obsolete patch
Commit 9b049849bf deleted the patch file
(and reference to it from fontconfig default.nix), but left the one in
2.10.nix which break evaluation.

As the package seems to build fine without the patch, just remove the
reference.

cc @ttuegel in case this was not the correct thing to do.
2017-03-30 23:19:45 +03:00
Thomas Tuegel
9b049849bf
freetype: disable PCF long family names
Backported several patches from upstream. The test suite patch for Fontconfig is
no longer necessary.
2017-03-28 17:29:42 -05:00
Thomas Tuegel
65592837b6
freetype: 2.6.5 -> 2.7.1
The Infinality bytecode interpreter is removed in favor of the new v40 TrueType
interpreter. In the past, the Infinality interpreter provided support for
ClearType-style hinting instructions while the default interpreter (then v35)
provided support only for original TrueType-style instructions. The v40
interpreter corrects this deficiency, so the Infinality interpreter is no longer
necessary.

To understand why the Infinality interpreter is no longer necessary, we should
understand how ClearType differs from TrueType and how the v40 interpreter
works. The following is a summary of information available on the FreeType
website [1] mixed with my own editorializing.

TrueType instructions use horizontal and vertical hints to improve glyph
rendering. Before TrueType, fonts were only vertically hinted; horizontal hints
improved rendering by snapping stems to pixel boundaries. Horizontal hinting is
a risk because it can significantly distort glyph shapes and kerning. Extensive
testing at different resolutions is needed to perfect the TrueType
hints. Microsoft invested significant effort to do this with its "Core fonts for
the Web" project, but few other typefaces have seen this level of attention.

With the advent of subpixel rendering, the effective horizontal resolution of
most displays increased significantly. ClearType eschews horizontal hinting in
favor of horizontal supersampling. Most fonts are designed for the Microsoft
bytecode interpreter, which implements a compatibility mode with
TrueType-style (horizontal and vertical) instructions. However, applying the
full horizontal hints to subpixel-rendered fonts leads to color fringes and
inconsistent stem widths. The Infinality interpreter implements several
techniques to mitigate these problems, going so far as to embed font- and
glyph-specific hacks in the interpreter. On the other hand, the v40 interpreter
ignores the horizontal hinting instructions so that glyphs render as they are
intended to on the Microsoft interpreter. Without the horizontal hints, the
problems of glyph and kerning distortion, color fringes, and inconsistent stem
widths--the problems the Infinality interpreter was created to solve--simply
don't occur in the first place.

There are also security concerns which motivate removing the Infinality patches.
Although there is an updated version of the Infinality interpreter for FreeType
2.7, the lack of a consistent upstream maintainer is a security concern. The
interpreter is a Turing-complete virtual machine which has had security
vulnerabilities in the past. While the default interpreter is used in billions
of devices and is maintained by an active developer, the Infinality interpreter
is neither scrutinized nor maintained. We will probably never know if there are
defects in the Infinality interpreter, and if they were discovered they would
likely never be fixed. I do not think that is an acceptable situtation for a
core library like FreeType.

Dropping the Infinality patches means that font rendering will be less
customizable. I think this is an acceptable trade-off. The Infinality
interpreter made many compromises to mitigate the problems with horizontal
hinting; the main purpose of customization is to tailor these compromises to the
user's preferences. The new interpreter does not have to make these compromises
because it renders fonts as their designers intended, so this level of
customization is not necessary.

The Infinality-associated patches are also removed from cairo. These patches
only set the default rendering options in case they aren't set though
Fontconfig. On NixOS, the rendering options are always set in Fontconfig, so
these patches never actually did anything for us!

The Fontconfig test suite is patched to account for a quirk in the way PCF fonts
are named.

The fontconfig option `hintstyle` is no longer configurable in NixOS. This
option selects the TrueType interpreter; the v40 interpreter is `hintslight` and
the older v35 interpreter is `hintmedium` or `hintfull` (which have actually
always been the same thing). The setting may still be changed through the
`localConf` option or by creating a user Fontconfig file.

Users with HiDPI displays should probably disable hinting and antialiasing: at
best they have no visible effect.

The fontconfig-ultimate settings are still available in NixOS, but they are no
longer the default. They still work, but their main purpose is to set rendering
quirks which are no longer necessary and may actually be
detrimental (e.g. setting `hintfull` for some fonts). Also, the vast array of
font substitutions provided is not an appropriate default; the default setting
should be to give the user the font they asked for.

[1]. https://www.freetype.org/freetype2/docs/subpixel-hinting.html
2017-03-12 17:31:33 -05:00
Vladimír Čunát
09d02f72f6
Re-revert "Merge: glibc: 2.24 -> 2.25"
This reverts commit 55cc7700e9.
I hope most problems have been solved.  /cc #22874.
2017-02-20 21:16:41 +01:00
Vladimír Čunát
55cc7700e9
Revert "Merge: glibc: 2.24 -> 2.25"
This reverts commit 1daf2e26d2, reversing
changes made to c0c50dfcb7.

It seems this is what has been causing all the reliability problems
on Hydra.  I'm currently unable to find why it happens, so I'm forced
to revert the update for now.  Discussion: #22874.
2017-02-16 18:16:06 +01:00
Vladimír Čunát
7832806e20
fontconfig: fixup fragile build after ab5fe171a
Sometimes it might fail due to timestamps suggesting some files needed
regenerating and failing to find gperf.  Now it should be OK, I hope.
2017-02-15 21:06:27 +01:00
Vladimír Čunát
ab5fe171af
fontconfig: patch to build with glibc-2.25 2017-02-12 11:14:45 +01:00
Alexander Ried
8417c3aae1
fontconfig: 2.11.1 -> 2.12.1
Fixes #19302.
2016-10-11 18:34:36 +02:00
Tuomas Tynkkynen
d3dc3d4130 Merge remote-tracking branch 'dezgeg/shuffle-outputs' into staging
https://github.com/NixOS/nixpkgs/pull/14766
2016-08-30 12:43:37 +03:00
Vladimír Čunát
4f73633f26 treewide: stop using fontbhttf 2016-08-29 22:28:50 +02:00
Tuomas Tynkkynen
a17216af4c treewide: Shuffle outputs
Make either 'bin' or 'out' the first output.
2016-08-29 14:49:51 +03:00