mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
Merge branch 'font-updates' into staging
Closes #16730. Closes #17770. Closes #17846. Test plan: * Check that `fonts.fontconfig.ultimate.preset` changes things; * Check that `fonts.fontconfig.dpi` changes things; * Check that `fonts.fontconfig.defaultFonts.monospace` changes things; Tested with AbiWord, mousepad and Firefox.
This commit is contained in:
commit
3b22b8add0
@ -58,6 +58,14 @@ following incompatible changes:</para>
|
||||
official documentation</link>.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><literal>fonts.fontconfig.ultimate.rendering</literal> was removed
|
||||
because our presets were obsolete for some time. New presets are hardcoded
|
||||
into freetype; one selects a preset via <literal>fonts.fontconfig.ultimate.preset</literal>.
|
||||
You can customize those presets via ordinary environment variables, using
|
||||
<literal>environment.variables</literal>.</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
|
@ -3,6 +3,95 @@
|
||||
with lib;
|
||||
|
||||
let fcBool = x: if x then "<bool>true</bool>" else "<bool>false</bool>";
|
||||
|
||||
cfg = config.fonts.fontconfig.ultimate;
|
||||
|
||||
latestVersion = pkgs.fontconfig.configVersion;
|
||||
|
||||
# fontconfig ultimate main configuration file
|
||||
# priority 52
|
||||
fontconfigUltimateConf = pkgs.writeText "fc-52-fontconfig-ultimate.conf" ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
${optionalString (!cfg.allowBitmaps) ''
|
||||
<!-- Reject bitmap fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="scalable"><bool>false</bool></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
${optionalString cfg.allowType1 ''
|
||||
<!-- Reject Type 1 fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="fontformat">
|
||||
<string>Type 1</string>
|
||||
</patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
<!-- Use embedded bitmaps in fonts like Calibri? -->
|
||||
<match target="font">
|
||||
<edit name="embeddedbitmap" mode="assign">
|
||||
${fcBool cfg.useEmbeddedBitmaps}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Force autohint always -->
|
||||
<match target="font">
|
||||
<edit name="force_autohint" mode="assign">
|
||||
${fcBool cfg.forceAutohint}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Render some monospace TTF fonts as bitmaps -->
|
||||
<match target="pattern">
|
||||
<edit name="bitmap_monospace" mode="assign">
|
||||
${fcBool cfg.renderMonoTTFAsBitmap}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# The configuration to be included in /etc/font/
|
||||
confPkg = pkgs.runCommand "font-ultimate-conf" {} ''
|
||||
support_folder=$out/etc/fonts/conf.d
|
||||
latest_folder=$out/etc/fonts/${latestVersion}/conf.d
|
||||
|
||||
mkdir -p $support_folder
|
||||
mkdir -p $latest_folder
|
||||
|
||||
# 52-fontconfig-ultimate.conf
|
||||
ln -s ${fontconfigUltimateConf} \
|
||||
$support_folder/52-fontconfig-ultimate.conf
|
||||
ln -s ${fontconfigUltimateConf} \
|
||||
$latest_folder/52-fontconfig-ultimate.conf
|
||||
|
||||
# fontconfig ultimate substitutions
|
||||
${optionalString (cfg.substitutions != "none") ''
|
||||
ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \
|
||||
$support_folder
|
||||
ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \
|
||||
$latest_folder
|
||||
''}
|
||||
|
||||
# fontconfig ultimate various configuration files
|
||||
ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \
|
||||
$support_folder
|
||||
ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \
|
||||
$latest_folder
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
@ -64,9 +153,7 @@ in
|
||||
};
|
||||
|
||||
substitutions = mkOption {
|
||||
type = types.str // {
|
||||
check = flip elem ["none" "free" "combi" "ms"];
|
||||
};
|
||||
type = types.nullOr (types.enum ["free" "combi" "ms"]);
|
||||
default = "free";
|
||||
description = ''
|
||||
Font substitutions to replace common Type 1 fonts with nicer
|
||||
@ -77,35 +164,12 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
rendering = mkOption {
|
||||
type = types.attrs;
|
||||
default = pkgs.fontconfig-ultimate.rendering.ultimate;
|
||||
preset = mkOption {
|
||||
type = types.enum ["ultimate1" "ultimate2" "ultimate3" "ultimate4" "ultimate5" "osx" "windowsxp"];
|
||||
default = "ultimate3";
|
||||
description = ''
|
||||
FreeType rendering settings presets. The default is
|
||||
<literal>pkgs.fontconfig-ultimate.rendering.ultimate</literal>.
|
||||
The other available styles are:
|
||||
<literal>ultimate-lighter</literal>,
|
||||
<literal>ultimate-darker</literal>,
|
||||
<literal>ultimate-lightest</literal>,
|
||||
<literal>ultimate-darkest</literal>,
|
||||
<literal>default</literal> (the original Infinality default),
|
||||
<literal>osx</literal>,
|
||||
<literal>ipad</literal>,
|
||||
<literal>ubuntu</literal>,
|
||||
<literal>linux</literal>,
|
||||
<literal>winxplight</literal>,
|
||||
<literal>win7light</literal>,
|
||||
<literal>winxp</literal>,
|
||||
<literal>win7</literal>,
|
||||
<literal>vanilla</literal>,
|
||||
<literal>classic</literal>,
|
||||
<literal>nudge</literal>,
|
||||
<literal>push</literal>,
|
||||
<literal>shove</literal>,
|
||||
<literal>sharpened</literal>,
|
||||
<literal>infinality</literal>. Any of the presets may be
|
||||
customized by editing the attributes. To disable, set this option
|
||||
to the empty attribute set <literal>{}</literal>.
|
||||
FreeType rendering settings preset. Any of the presets may be
|
||||
customized by setting environment variables.
|
||||
'';
|
||||
};
|
||||
};
|
||||
@ -114,80 +178,11 @@ in
|
||||
|
||||
};
|
||||
|
||||
config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
|
||||
|
||||
config =
|
||||
let ultimate = config.fonts.fontconfig.ultimate;
|
||||
fontconfigUltimateConf = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
fonts.fontconfig.confPackages = [ confPkg ];
|
||||
environment.variables."INFINALITY_FT" = cfg.preset;
|
||||
|
||||
${optionalString (!ultimate.allowBitmaps) ''
|
||||
<!-- Reject bitmap fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="scalable"><bool>false</bool></patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
${optionalString ultimate.allowType1 ''
|
||||
<!-- Reject Type 1 fonts -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern>
|
||||
<patelt name="fontformat">
|
||||
<string>Type 1</string>
|
||||
</patelt>
|
||||
</pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
''}
|
||||
|
||||
<!-- Use embedded bitmaps in fonts like Calibri? -->
|
||||
<match target="font">
|
||||
<edit name="embeddedbitmap" mode="assign">
|
||||
${fcBool ultimate.useEmbeddedBitmaps}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Force autohint always -->
|
||||
<match target="font">
|
||||
<edit name="force_autohint" mode="assign">
|
||||
${fcBool ultimate.forceAutohint}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!-- Render some monospace TTF fonts as bitmaps -->
|
||||
<match target="pattern">
|
||||
<edit name="bitmap_monospace" mode="assign">
|
||||
${fcBool ultimate.renderMonoTTFAsBitmap}
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
${optionalString (ultimate.substitutions != "none") ''
|
||||
<!-- Type 1 font substitutions -->
|
||||
<include ignore_missing="yes">${pkgs.fontconfig-ultimate.confd}/etc/fonts/presets/${ultimate.substitutions}</include>
|
||||
''}
|
||||
|
||||
<include ignore_missing="yes">${pkgs.fontconfig-ultimate.confd}/etc/fonts/conf.d</include>
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
in mkIf (config.fonts.fontconfig.enable && ultimate.enable) {
|
||||
|
||||
environment.etc."fonts/conf.d/52-fontconfig-ultimate.conf" = {
|
||||
text = fontconfigUltimateConf;
|
||||
};
|
||||
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/52-fontconfig-ultimate.conf" = {
|
||||
text = fontconfigUltimateConf;
|
||||
};
|
||||
|
||||
environment.variables = ultimate.rendering;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,207 @@
|
||||
/*
|
||||
|
||||
NixOS support 2 fontconfig versions, "support" and "latest".
|
||||
|
||||
- "latest" refers to default fontconfig package (pkgs.fontconfig).
|
||||
configuration files are linked to /etc/fonts/VERSION/conf.d/
|
||||
- "support" refers to supportPkg (pkgs."fontconfig_${supportVersion}").
|
||||
configuration files are linked to /etc/fonts/conf.d/
|
||||
|
||||
This module generates a package containing configuration files and link it in /etc/fonts.
|
||||
|
||||
Fontconfig reads files in folder name / file name order, so the number prepended to the configuration file name decide the order of parsing.
|
||||
Low number means high priority.
|
||||
|
||||
*/
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.fonts.fontconfig;
|
||||
|
||||
fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
|
||||
|
||||
# back-supported fontconfig version and package
|
||||
# version is used for font cache generation
|
||||
supportVersion = "210";
|
||||
supportPkg = pkgs."fontconfig_${supportVersion}";
|
||||
|
||||
# latest fontconfig version and package
|
||||
# version is used for configuration folder name, /etc/fonts/VERSION/
|
||||
# note: format differs from supportVersion and can not be used with makeCacheConf
|
||||
latestVersion = pkgs.fontconfig.configVersion;
|
||||
latestPkg = pkgs.fontconfig;
|
||||
|
||||
# supported version fonts.conf
|
||||
supportFontsConf = pkgs.makeFontsConf { fontconfig = supportPkg; fontDirectories = config.fonts.fonts; };
|
||||
|
||||
# configuration file to read fontconfig cache
|
||||
# version dependent
|
||||
# priority 0
|
||||
cacheConfSupport = makeCacheConf { version = supportVersion; };
|
||||
cacheConfLatest = makeCacheConf {};
|
||||
|
||||
# generate the font cache setting file for a fontconfig version
|
||||
# use latest when no version is passed
|
||||
makeCacheConf = { version ? null }:
|
||||
let
|
||||
fcPackage = if builtins.isNull version
|
||||
then "fontconfig"
|
||||
else "fontconfig_${version}";
|
||||
makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };
|
||||
cache = makeCache pkgs."${fcPackage}";
|
||||
cache32 = makeCache pkgs.pkgsi686Linux."${fcPackage}";
|
||||
in
|
||||
pkgs.writeText "fc-00-nixos-cache.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<!-- Font directories -->
|
||||
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
|
||||
<!-- Pre-generated font caches -->
|
||||
<cachedir>${cache}</cachedir>
|
||||
${optionalString (pkgs.stdenv.isx86_64 && cfg.cache32Bit) ''
|
||||
<cachedir>${cache32}</cachedir>
|
||||
''}
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# rendering settings configuration file
|
||||
# priority 10
|
||||
renderConf = pkgs.writeText "fc-10-nixos-rendering.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="font">
|
||||
<edit mode="assign" name="hinting">
|
||||
${fcBool cfg.hinting.enable}
|
||||
</edit>
|
||||
<edit mode="assign" name="autohint">
|
||||
${fcBool cfg.hinting.autohint}
|
||||
</edit>
|
||||
<edit mode="assign" name="hintstyle">
|
||||
<const>hint${cfg.hinting.style}</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="antialias">
|
||||
${fcBool cfg.antialias}
|
||||
</edit>
|
||||
<edit mode="assign" name="rgba">
|
||||
<const>${cfg.subpixel.rgba}</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="lcdfilter">
|
||||
<const>lcd${cfg.subpixel.lcdfilter}</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
${optionalString (cfg.dpi != 0) ''
|
||||
<match target="pattern">
|
||||
<edit name="dpi" mode="assign">
|
||||
<double>${toString cfg.dpi}</double>
|
||||
</edit>
|
||||
</match>
|
||||
''}
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# local configuration file
|
||||
# priority 51
|
||||
localConf = pkgs.writeText "fc-local.conf" cfg.localConf;
|
||||
|
||||
# default fonts configuration file
|
||||
# priority 52
|
||||
defaultFontsConf =
|
||||
let genDefault = fonts: name:
|
||||
optionalString (fonts != []) ''
|
||||
<alias>
|
||||
<family>${name}</family>
|
||||
<prefer>
|
||||
${concatStringsSep ""
|
||||
(map (font: ''
|
||||
<family>${font}</family>
|
||||
'') fonts)}
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
in
|
||||
pkgs.writeText "fc-52-nixos-default-fonts.conf" ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default fonts -->
|
||||
${genDefault cfg.defaultFonts.sansSerif "sans-serif"}
|
||||
|
||||
${genDefault cfg.defaultFonts.serif "serif"}
|
||||
|
||||
${genDefault cfg.defaultFonts.monospace "monospace"}
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# fontconfig configuration package
|
||||
confPkg = pkgs.runCommand "fontconfig-conf" {} ''
|
||||
support_folder=$out/etc/fonts
|
||||
latest_folder=$out/etc/fonts/${latestVersion}
|
||||
|
||||
mkdir -p $support_folder/conf.d
|
||||
mkdir -p $latest_folder/conf.d
|
||||
|
||||
# fonts.conf
|
||||
ln -s ${supportFontsConf} $support_folder/fonts.conf
|
||||
ln -s ${latestPkg.out}/etc/fonts/fonts.conf \
|
||||
$latest_folder/fonts.conf
|
||||
|
||||
# fontconfig default config files
|
||||
ln -s ${supportPkg.out}/etc/fonts/conf.d/*.conf \
|
||||
$support_folder/conf.d/
|
||||
ln -s ${latestPkg.out}/etc/fonts/conf.d/*.conf \
|
||||
$latest_folder/conf.d/
|
||||
|
||||
# update latest 51-local.conf path to look at the latest local.conf
|
||||
rm $latest_folder/conf.d/51-local.conf
|
||||
|
||||
substitute ${latestPkg.out}/etc/fonts/conf.d/51-local.conf \
|
||||
$latest_folder/conf.d/51-local.conf \
|
||||
--replace local.conf /etc/fonts/${latestVersion}/local.conf
|
||||
|
||||
# 00-nixos-cache.conf
|
||||
ln -s ${cacheConfSupport} \
|
||||
$support_folder/conf.d/00-nixos-cache.conf
|
||||
ln -s ${cacheConfLatest} $latest_folder/conf.d/00-nixos-cache.conf
|
||||
|
||||
# 10-nixos-rendering.conf
|
||||
ln -s ${renderConf} $support_folder/conf.d/10-nixos-rendering.conf
|
||||
ln -s ${renderConf} $latest_folder/conf.d/10-nixos-rendering.conf
|
||||
|
||||
# 50-user.conf
|
||||
${optionalString (! cfg.includeUserConf) ''
|
||||
rm $support_folder/conf.d/50-user.conf
|
||||
rm $latest_folder/conf.d/50-user.conf
|
||||
''}
|
||||
|
||||
# local.conf (indirect priority 51)
|
||||
${optionalString (cfg.localConf != "") ''
|
||||
ln -s ${localConf} $support_folder/local.conf
|
||||
ln -s ${localConf} $latest_folder/local.conf
|
||||
''}
|
||||
|
||||
# 52-nixos-default-fonts.conf
|
||||
ln -s ${defaultFontsConf} $support_folder/conf.d/52-nixos-default-fonts.conf
|
||||
ln -s ${defaultFontsConf} $latest_folder/conf.d/52-nixos-default-fonts.conf
|
||||
'';
|
||||
|
||||
# Package with configuration files
|
||||
# this merge all the packages in the fonts.fontconfig.confPackages list
|
||||
fontconfigEtc = pkgs.buildEnv {
|
||||
name = "fontconfig-etc";
|
||||
paths = cfg.confPackages;
|
||||
ignoreCollisions = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
@ -21,6 +221,15 @@ with lib;
|
||||
'';
|
||||
};
|
||||
|
||||
confPackages = mkOption {
|
||||
internal = true;
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Fontconfig configuration packages.
|
||||
'';
|
||||
};
|
||||
|
||||
antialias = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
@ -36,6 +245,15 @@ with lib;
|
||||
'';
|
||||
};
|
||||
|
||||
localConf = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
System-wide customization file contents, has higher priority than
|
||||
<literal>defaultFonts</literal> settings.
|
||||
'';
|
||||
};
|
||||
|
||||
defaultFonts = {
|
||||
monospace = mkOption {
|
||||
type = types.listOf types.str;
|
||||
@ -142,136 +360,11 @@ with lib;
|
||||
};
|
||||
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
fonts.fontconfig.confPackages = [ confPkg ];
|
||||
|
||||
config =
|
||||
let fontconfig = config.fonts.fontconfig;
|
||||
fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
|
||||
renderConf = ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default rendering settings -->
|
||||
<match target="font">
|
||||
<edit mode="assign" name="hinting">
|
||||
${fcBool fontconfig.hinting.enable}
|
||||
</edit>
|
||||
<edit mode="assign" name="autohint">
|
||||
${fcBool fontconfig.hinting.autohint}
|
||||
</edit>
|
||||
<edit mode="assign" name="hintstyle">
|
||||
<const>hint${fontconfig.hinting.style}</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="antialias">
|
||||
${fcBool fontconfig.antialias}
|
||||
</edit>
|
||||
<edit mode="assign" name="rgba">
|
||||
<const>${fontconfig.subpixel.rgba}</const>
|
||||
</edit>
|
||||
<edit mode="assign" name="lcdfilter">
|
||||
<const>lcd${fontconfig.subpixel.lcdfilter}</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
${optionalString (fontconfig.dpi != 0) ''
|
||||
<match target="pattern">
|
||||
<edit name="dpi" mode="assign">
|
||||
<double>${toString fontconfig.dpi}</double>
|
||||
</edit>
|
||||
</match>
|
||||
''}
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
genericAliasConf = ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
|
||||
<!-- Default fonts -->
|
||||
${optionalString (fontconfig.defaultFonts.sansSerif != []) ''
|
||||
<alias>
|
||||
<family>sans-serif</family>
|
||||
<prefer>
|
||||
${concatStringsSep "\n"
|
||||
(map (font: "<family>${font}</family>")
|
||||
fontconfig.defaultFonts.sansSerif)}
|
||||
</prefer>
|
||||
</alias>
|
||||
''}
|
||||
${optionalString (fontconfig.defaultFonts.serif != []) ''
|
||||
<alias>
|
||||
<family>serif</family>
|
||||
<prefer>
|
||||
${concatStringsSep "\n"
|
||||
(map (font: "<family>${font}</family>")
|
||||
fontconfig.defaultFonts.serif)}
|
||||
</prefer>
|
||||
</alias>
|
||||
''}
|
||||
${optionalString (fontconfig.defaultFonts.monospace != []) ''
|
||||
<alias>
|
||||
<family>monospace</family>
|
||||
<prefer>
|
||||
${concatStringsSep "\n"
|
||||
(map (font: "<family>${font}</family>")
|
||||
fontconfig.defaultFonts.monospace)}
|
||||
</prefer>
|
||||
</alias>
|
||||
''}
|
||||
|
||||
</fontconfig>
|
||||
'';
|
||||
in mkIf fontconfig.enable {
|
||||
|
||||
# Fontconfig 2.10 backward compatibility
|
||||
|
||||
# Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
|
||||
environment.etc."fonts/fonts.conf".source =
|
||||
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
|
||||
|
||||
environment.etc."fonts/conf.d/10-nixos-rendering.conf".text = renderConf;
|
||||
environment.etc."fonts/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf;
|
||||
|
||||
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
|
||||
# Otherwise specify only font directories.
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/fonts.conf".source =
|
||||
"${pkgs.fontconfig.out}/etc/fonts/fonts.conf";
|
||||
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
|
||||
let
|
||||
cache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };
|
||||
in ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<!-- Font directories -->
|
||||
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
|
||||
<!-- Pre-generated font caches -->
|
||||
<cachedir>${cache pkgs.fontconfig}</cachedir>
|
||||
${optionalString (pkgs.stdenv.isx86_64 && config.fonts.fontconfig.cache32Bit) ''
|
||||
<cachedir>${cache pkgs.pkgsi686Linux.fontconfig}</cachedir>
|
||||
''}
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/10-nixos-rendering.conf".text = renderConf;
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf;
|
||||
|
||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = {
|
||||
enable = fontconfig.includeUserConf;
|
||||
text = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<include ignore_missing="yes" prefix="xdg">fontconfig/conf.d</include>
|
||||
<include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include>
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.fontconfig ];
|
||||
|
||||
};
|
||||
environment.systemPackages = [ pkgs.fontconfig ];
|
||||
environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/";
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -137,6 +137,9 @@ with lib;
|
||||
# Unity3D
|
||||
(mkRenamedOptionModule [ "programs" "unity3d" "enable" ] [ "security" "chromiumSuidSandbox" "enable" ])
|
||||
|
||||
# fontconfig-ultimate
|
||||
(mkRenamedOptionModule [ "fonts" "fontconfig" "ultimate" "rendering" ] [ "fonts" "fontconfig" "ultimate" "preset" ])
|
||||
|
||||
# Options that are obsolete and have no replacement.
|
||||
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ])
|
||||
(mkRemovedOptionModule [ "programs" "bash" "enable" ])
|
||||
|
@ -87,16 +87,44 @@ rec {
|
||||
];
|
||||
|
||||
savannah = [
|
||||
ftp://mirror.csclub.uwaterloo.ca/nongnu/
|
||||
ftp://mirror.publicns.net/pub/nongnu/
|
||||
ftp://savannah.c3sl.ufpr.br/
|
||||
http://download.savannah.gnu.org/releases/
|
||||
http://ftp.cc.uoc.gr/mirrors/nongnu.org/
|
||||
http://ftp.twaren.net/Unix/NonGNU/
|
||||
http://mirror.csclub.uwaterloo.ca/nongnu/
|
||||
http://nongnu.askapache.com/
|
||||
# Mirrors from https://download-mirror.savannah.gnu.org/releases/00_MIRRORS.html
|
||||
http://mirror.easyname.at/nongnu/
|
||||
http://mirror2.klaus-uwe.me/nongnu/
|
||||
http://savannah.c3sl.ufpr.br/
|
||||
http://www.centervenus.com/mirrors/nongnu/
|
||||
http://mirror.csclub.uwaterloo.ca/nongnu/
|
||||
http://mirror.cedia.org.ec/nongnu/
|
||||
http://ftp.igh.cnrs.fr/pub/nongnu/
|
||||
http://mirror6.layerjet.com/nongnu
|
||||
http://mirror.netcologne.de/savannah/
|
||||
http://ftp.cc.uoc.gr/mirrors/nongnu.org/
|
||||
http://nongnu.uib.no/
|
||||
http://mirrors.fe.up.pt/pub/nongnu/
|
||||
http://mirror.lihnidos.org/GNU/savannah/
|
||||
http://savannah.mirror.si/
|
||||
http://ftp.acc.umu.se/mirror/gnu.org/savannah/
|
||||
http://ftp.twaren.net/Unix/NonGNU/
|
||||
http://ftp.yzu.edu.tw/pub/nongnu/
|
||||
http://mirror.rackdc.com/savannah/
|
||||
http://savannah-nongnu-org.ip-connect.vn.ua/
|
||||
http://www.mirrorservice.org/sites/download.savannah.gnu.org/releases/
|
||||
http://savannah.spinellicreations.com/
|
||||
http://gnu.mirrors.pair.com/savannah/savannah/
|
||||
ftp://mirror.easyname.at/nongnu/
|
||||
ftp://mirror2.klaus-uwe.me/nongnu/
|
||||
ftp://savannah.c3sl.ufpr.br/savannah-nongnu/
|
||||
ftp://mirror.csclub.uwaterloo.ca/nongnu/
|
||||
ftp://mirror.cedia.org.ec/nongnu
|
||||
ftp://ftp.igh.cnrs.fr/pub/nongnu/
|
||||
ftp://mirror6.layerjet.com/nongnu/
|
||||
ftp://mirror.netcologne.de/savannah/
|
||||
ftp://nongnu.uib.no/pub/nongnu/
|
||||
ftp://mirrors.fe.up.pt/pub/nongnu/
|
||||
ftp://savannah.mirror.si/savannah/
|
||||
ftp://ftp.twaren.net/Unix/NonGNU/
|
||||
ftp://ftp.yzu.edu.tw/pub/nongnu/
|
||||
ftp://savannah-nongnu-org.ip-connect.vn.ua/mirror/savannah.nongnu.org/
|
||||
ftp://ftp.mirrorservice.org/sites/download.savannah.gnu.org/releases/
|
||||
ftp://spinellicreations.com/gnu_dot_org_savannah_mirror/
|
||||
];
|
||||
|
||||
samba = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, fetchpatch, pkgconfig, libiconv, libintlOrEmpty
|
||||
{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, libiconv, libintlOrEmpty
|
||||
, expat, zlib, libpng, pixman, fontconfig, freetype, xorg
|
||||
, gobjectSupport ? true, glib
|
||||
, xcbSupport ? true # no longer experimental since 1.12
|
||||
@ -19,6 +19,17 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0lmjlzmghmr27y615px9hkm552x7ap6pmq9mfbzr6smp8y2b6g31";
|
||||
};
|
||||
|
||||
infinality = fetchFromGitHub {
|
||||
owner = "bohoomil";
|
||||
repo = "fontconfig-ultimate";
|
||||
rev = "730f5e77580677e86522c1f2119aa78803741759";
|
||||
sha256 = "1hbrdpm6xcczs2c2iid7by8h7dsd0jcf7an88s150njyqnjzxjg7";
|
||||
};
|
||||
|
||||
prePatch = ''
|
||||
patches="$patches $(echo $infinality/*_cairo-iu/*.patch)"
|
||||
'';
|
||||
|
||||
outputs = [ "dev" "out" "docdev" ];
|
||||
outputBin = "dev"; # very small
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
{ stdenv, fetchFromGitHub }:
|
||||
|
||||
let version = "2015-12-06"; in
|
||||
stdenv.mkDerivation {
|
||||
name = "fontconfig-ultimate-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
sha256 = "02a811szxkq4q088nxfpdzp6rv0brvgkdhwigk09qffygxd776g6";
|
||||
rev = version;
|
||||
repo = "fontconfig-ultimate";
|
||||
owner = "bohoomil";
|
||||
};
|
||||
|
||||
phases = "$prePhases unpackPhase installPhase $postPhases";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/etc/fonts/conf.d
|
||||
cp conf.d.infinality/*.conf $out/etc/fonts/conf.d
|
||||
|
||||
# Base rendering settings will be determined by NixOS module
|
||||
rm $out/etc/fonts/conf.d/10-base-rendering.conf
|
||||
|
||||
# Options controlled by NixOS module
|
||||
rm $out/etc/fonts/conf.d/35-repl-custom.conf
|
||||
rm $out/etc/fonts/conf.d/38-repl-*.conf
|
||||
rm $out/etc/fonts/conf.d/82-*.conf
|
||||
rm $out/etc/fonts/conf.d/83-*.conf
|
||||
|
||||
# Inclusion of local and user configs handled by global configuration
|
||||
rm $out/etc/fonts/conf.d/29-local.conf
|
||||
rm $out/etc/fonts/conf.d/28-user.conf
|
||||
|
||||
cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d
|
||||
|
||||
mkdir -p $out/etc/fonts/presets/{combi,free,ms}
|
||||
cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi
|
||||
cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free
|
||||
cp fontconfig_patches/ms/*.conf $out/etc/fonts/presets/ms
|
||||
'';
|
||||
}
|
@ -1,6 +1,43 @@
|
||||
{ callPackage }:
|
||||
{ stdenv, fetchFromGitHub }:
|
||||
|
||||
{
|
||||
confd = callPackage ./confd.nix {};
|
||||
rendering = callPackage ./rendering.nix {};
|
||||
let version = "2016-04-23"; in
|
||||
stdenv.mkDerivation {
|
||||
name = "fontconfig-ultimate-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
sha256 = "1rd2n60l8bamx84q3l91pd9a0wz9h7p6ajvx1dw22qn8rah4h498";
|
||||
rev = version;
|
||||
repo = "fontconfig-ultimate";
|
||||
owner = "bohoomil";
|
||||
};
|
||||
|
||||
phases = "$prePhases unpackPhase installPhase $postPhases";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/etc/fonts/conf.d
|
||||
cp conf.d.infinality/*.conf $out/etc/fonts/conf.d
|
||||
|
||||
# Base rendering settings will be determined by NixOS module
|
||||
rm $out/etc/fonts/conf.d/10-base-rendering.conf
|
||||
|
||||
# Options controlled by NixOS module
|
||||
rm $out/etc/fonts/conf.d/35-repl-custom.conf
|
||||
rm $out/etc/fonts/conf.d/38-repl-*.conf
|
||||
rm $out/etc/fonts/conf.d/82-*.conf
|
||||
rm $out/etc/fonts/conf.d/83-*.conf
|
||||
|
||||
# Inclusion of local and user configs handled by global configuration
|
||||
rm $out/etc/fonts/conf.d/29-local.conf
|
||||
rm $out/etc/fonts/conf.d/28-user.conf
|
||||
|
||||
cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d
|
||||
|
||||
# fix font priority issue https://github.com/bohoomil/fontconfig-ultimate/issues/173
|
||||
mv $out/etc/fonts/conf.d/{43,60}-wqy-zenhei-sharp.conf
|
||||
|
||||
mkdir -p $out/etc/fonts/presets/{combi,free,ms}
|
||||
cp fontconfig_patches/combi/*.conf $out/etc/fonts/presets/combi
|
||||
cp fontconfig_patches/free/*.conf $out/etc/fonts/presets/free
|
||||
cp fontconfig_patches/ms/*.conf $out/etc/fonts/presets/ms
|
||||
'';
|
||||
}
|
||||
|
@ -1,212 +0,0 @@
|
||||
{}:
|
||||
|
||||
rec {
|
||||
default = {
|
||||
INFINALITY_FT_FILTER_PARAMS="11 22 38 22 11";
|
||||
INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="0";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="0";
|
||||
INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="10";
|
||||
INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="25";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="10";
|
||||
INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="25";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="25";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="0 100";
|
||||
INFINALITY_FT_BRIGHTNESS="0";
|
||||
INFINALITY_FT_CONTRAST="0";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="true";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="true";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="40";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="true";
|
||||
INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE="0";
|
||||
INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="0";
|
||||
INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="0";
|
||||
INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE="0";
|
||||
};
|
||||
|
||||
osx = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="03 32 38 32 03";
|
||||
INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="25";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 80";
|
||||
INFINALITY_FT_BRIGHTNESS="10";
|
||||
INFINALITY_FT_CONTRAST="20";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="false";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="8";
|
||||
INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="16";
|
||||
};
|
||||
|
||||
ipad = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="00 00 100 00 00";
|
||||
INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="100";
|
||||
INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 80";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="false";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
ubuntu = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 80";
|
||||
INFINALITY_FT_BRIGHTNESS="-10";
|
||||
INFINALITY_FT_CONTRAST="15";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="false";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
linux = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
winxplight = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="100";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="15";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="15";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 120";
|
||||
INFINALITY_FT_BRIGHTNESS="20";
|
||||
INFINALITY_FT_CONTRAST="30";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30";
|
||||
};
|
||||
|
||||
win7light = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="20 25 38 25 05";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="100";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="100";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 160";
|
||||
INFINALITY_FT_CONTRAST="20";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30";
|
||||
};
|
||||
|
||||
winxp = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 25 44 25 06";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="100";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="15";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="15";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 120";
|
||||
INFINALITY_FT_BRIGHTNESS="10";
|
||||
INFINALITY_FT_CONTRAST="20";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30";
|
||||
};
|
||||
|
||||
win7 = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="20 25 42 25 06";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="100";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_GAMMA_CORRECTION="1000 120";
|
||||
INFINALITY_FT_BRIGHTNESS="10";
|
||||
INFINALITY_FT_CONTRAST="20";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
};
|
||||
|
||||
vanilla = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 25 38 25 06";
|
||||
INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="false";
|
||||
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="false";
|
||||
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
classic = default // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 25 38 25 06";
|
||||
INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0";
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
nudge = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30";
|
||||
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="false";
|
||||
};
|
||||
|
||||
push = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="75";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="50";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="30";
|
||||
};
|
||||
|
||||
infinality = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="5";
|
||||
};
|
||||
|
||||
shove = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="0";
|
||||
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="100";
|
||||
INFINALITY_FT_STEM_FITTING_STRENGTH="100";
|
||||
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="0";
|
||||
};
|
||||
|
||||
sharpened = default // {
|
||||
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="65";
|
||||
};
|
||||
|
||||
ultimate = {
|
||||
INFINALITY_FT_FILTER_PARAMS="08 24 36 24 08";
|
||||
INFINALITY_FT_FRINGE_FILTER_STRENGTH="50";
|
||||
INFINALITY_FT_USE_VARIOUS_TWEAKS="true";
|
||||
INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="20";
|
||||
};
|
||||
|
||||
ultimate-lighter = ultimate // {
|
||||
INFINALITY_FT_FILTER_PARAMS="06 22 36 22 06";
|
||||
};
|
||||
|
||||
ultimate-lightest = ultimate // {
|
||||
INFINALITY_FT_FILTER_PARAMS="04 22 38 22 04";
|
||||
};
|
||||
|
||||
ultimate-darker = ultimate // {
|
||||
INFINALITY_FT_FILTER_PARAMS="10 25 37 25 10";
|
||||
};
|
||||
|
||||
ultimate-darkest = ultimate // {
|
||||
INFINALITY_FT_FILTER_PARAMS="12 28 42 28 12";
|
||||
};
|
||||
}
|
@ -66,9 +66,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
postInstall = ''
|
||||
cd "$out/etc/fonts"
|
||||
rm conf.d/{50-user,51-local}.conf
|
||||
"${libxslt.bin}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \
|
||||
--stringparam fontconfig "$out" \
|
||||
--stringparam fontconfigConfigVersion "${configVersion}" \
|
||||
--path $out/share/xml/fontconfig \
|
||||
${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
|
||||
|
@ -28,8 +28,6 @@
|
||||
<!-- /var/cache/fontconfig is useful for non-nixos systems -->
|
||||
<cachedir>/var/cache/fontconfig</cachedir>
|
||||
|
||||
<!-- fontconfig distribution conf.d -->
|
||||
<include><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
|
||||
<!-- versioned system-wide config -->
|
||||
<include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
|
||||
|
||||
|
@ -1,40 +1,55 @@
|
||||
{ stdenv, fetchurl, fetchpatch, pkgconfig, which, zlib, bzip2, libpng, gnumake
|
||||
{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, which, zlib, bzip2, libpng, gnumake
|
||||
, glib /* passthru only */
|
||||
|
||||
# FreeType supports sub-pixel rendering. This is patented by
|
||||
# Microsoft, so it is disabled by default. This option allows it to
|
||||
# be enabled. See http://www.freetype.org/patents.html.
|
||||
, useEncumberedCode ? true
|
||||
, useInfinality ? true
|
||||
}:
|
||||
|
||||
let
|
||||
version = "2.6.2";
|
||||
assert useInfinality -> useEncumberedCode;
|
||||
|
||||
# Don't use fetchpatch. It mangles them. That's an hour I'll never get back.
|
||||
fetchbohoomil = name: sha256: fetchurl {
|
||||
url = https://raw.githubusercontent.com/bohoomil/fontconfig-ultimate/254b688f96d4a37f78fb594303a43160fc15c7cd/freetype/ + name;
|
||||
inherit sha256;
|
||||
let
|
||||
version = "2.6.5";
|
||||
|
||||
infinality = fetchFromGitHub {
|
||||
owner = "archfan";
|
||||
repo = "infinality_bundle";
|
||||
rev = "5c0949a477bf43d2ac4e57b4fc39bcc3331002ee";
|
||||
sha256 = "17389aqm6rlxl4b5mv1fx4b22x2v2n60hfhixfxqxpd8ialsdi6l";
|
||||
};
|
||||
|
||||
in
|
||||
with { inherit (stdenv.lib) optional optionals optionalString; };
|
||||
stdenv.mkDerivation rec {
|
||||
name = "freetype-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/freetype/${name}.tar.bz2";
|
||||
sha256 = "14mqrfgl18q2by1yzv6vcxi97zjy4kppcgsqf312mhfwgkpvvxms";
|
||||
url = "mirror://savannah/freetype/${name}.tar.bz2";
|
||||
sha256 = "1w5c87s4rpx9af5b3mk5cjd1yny3c4dq5p9iv3ixb3vr00a6w2p2";
|
||||
};
|
||||
|
||||
patches = []
|
||||
# mingw: these patches use `strcasestr` which isn't available on windows
|
||||
++ optionals (useEncumberedCode && stdenv.cross.libc or null != "msvcrt" ) [
|
||||
(fetchbohoomil "01-freetype-2.6.2-enable-valid.patch"
|
||||
"1szq0zha7n41f4pq179wgfkam034mp2xn0xc36sdl5sjp9s9hv08")
|
||||
(fetchbohoomil "02-upstream-2015.12.05.patch"
|
||||
"0781r9n35kpn8db8nma0l47cpkzh0hbp84ziii5sald90dnrqdj4")
|
||||
(fetchbohoomil "03-infinality-2.6.2-2015.12.05.patch"
|
||||
"0wcjf9hiymplgqm3szla633i417pb57vpzzs2dyl1dnmcxgqa2y8")
|
||||
];
|
||||
patches = [
|
||||
# Patch for validation of OpenType and GX/AAT tables.
|
||||
(fetchurl {
|
||||
name = "freetype-2.2.1-enable-valid.patch";
|
||||
url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990";
|
||||
sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l";
|
||||
})
|
||||
] ++ optionals (!useInfinality && useEncumberedCode) [
|
||||
# Patch to enable subpixel rendering.
|
||||
# See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html.
|
||||
(fetchurl {
|
||||
name = "freetype-2.3.0-enable-spr.patch";
|
||||
url = http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.3.0-enable-spr.patch?id=9a81147af83b1166a5f301e379f85927cc610990;
|
||||
sha256 = "13ni9n5q3nla38wjmxd4f8cy29gp62kjx2l6y6nqhdyiqp8fz8nd";
|
||||
})
|
||||
];
|
||||
|
||||
prePatch = optionalString useInfinality ''
|
||||
patches="$patches $(ls ${infinality}/*_freetype2-iu/*-infinality-*.patch)"
|
||||
'';
|
||||
|
||||
outputs = [ "dev" "out" ];
|
||||
|
||||
@ -44,10 +59,8 @@ stdenv.mkDerivation rec {
|
||||
# FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
|
||||
++ optional (!stdenv.isLinux) gnumake;
|
||||
|
||||
configureFlags = "--disable-static --bindir=$(dev)/bin";
|
||||
configureFlags = [ "--disable-static" "--bindir=$(dev)/bin" ];
|
||||
|
||||
# from Gentoo, see https://bugzilla.redhat.com/show_bug.cgi?id=506840
|
||||
NIX_CFLAGS_COMPILE = "-fno-strict-aliasing";
|
||||
# The asm for armel is written with the 'asm' keyword.
|
||||
CFLAGS = optionalString stdenv.isArm "-std=gnu99";
|
||||
|
||||
@ -66,7 +79,14 @@ stdenv.mkDerivation rec {
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A font rendering engine";
|
||||
homepage = http://www.freetype.org/;
|
||||
longDescription = ''
|
||||
FreeType is a portable and efficient library for rendering fonts. It
|
||||
supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
|
||||
fonts. It has a bytecode interpreter and has an automatic hinter called
|
||||
autofit which can be used instead of hinting instructions included in
|
||||
fonts.
|
||||
'';
|
||||
homepage = https://www.freetype.org/;
|
||||
license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
|
||||
#ToDo: encumbered = useEncumberedCode;
|
||||
platforms = platforms.all;
|
||||
|
Loading…
Reference in New Issue
Block a user