mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-01 01:57:37 +03:00
nixos/fontconfig: refactor antialias option for fontconfig 2.14.1
`sub-pixel` has been enabled by default since 2.14.1:2b6afa02ab
`antialias` since 2.14.1:0825a178e8
`lcdfilter` since 2.13.95:e1c7c6d744
`hintstyle` since 2.12.1:98434b3392
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
0d6a6827ea
commit
b5d2d701d1
@ -77,18 +77,6 @@ let
|
||||
<edit mode="append" name="autohint">
|
||||
${fcBool cfg.hinting.autohint}
|
||||
</edit>
|
||||
<edit mode="append" name="hintstyle">
|
||||
<const>${cfg.hinting.style}</const>
|
||||
</edit>
|
||||
<edit mode="append" name="antialias">
|
||||
${fcBool cfg.antialias}
|
||||
</edit>
|
||||
<edit mode="append" name="rgba">
|
||||
<const>${cfg.subpixel.rgba}</const>
|
||||
</edit>
|
||||
<edit mode="append" name="lcdfilter">
|
||||
<const>lcd${cfg.subpixel.lcdfilter}</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
||||
@ -177,6 +165,13 @@ let
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
# Replace default linked config with a different variant
|
||||
replaceDefaultConfig = defaultConfig: newConfig: ''
|
||||
rm $dst/${defaultConfig}
|
||||
ln -s ${pkg.out}/share/fontconfig/conf.avail/${newConfig} \
|
||||
dst/
|
||||
'';
|
||||
|
||||
# fontconfig configuration package
|
||||
confPkg = pkgs.runCommand "fontconfig-conf" {
|
||||
preferLocalBuild = true;
|
||||
@ -196,6 +191,26 @@ let
|
||||
ln -s ${pkg.out}/etc/fonts/conf.d/*.conf \
|
||||
$dst/
|
||||
|
||||
${optionalString (!cfg.antialias)
|
||||
(replaceDefaultConfig "10-yes-antialias.conf"
|
||||
"10-no-antialias.conf")
|
||||
}
|
||||
|
||||
${optionalString (cfg.hinting.style != "slight")
|
||||
(replaceDefaultConfig "10-hinting-slight.conf"
|
||||
"10-hinting-${cfg.hinting.style}.conf")
|
||||
}
|
||||
|
||||
${optionalString (cfg.subpixel.rgba != "none")
|
||||
(replaceDefaultConfig "10-sub-pixel-none.conf"
|
||||
"10-sub-pixel-${cfg.subpixel.rgba}.conf")
|
||||
}
|
||||
|
||||
${optionalString (cfg.subpixel.lcdfilter != "default")
|
||||
(replaceDefaultConfig "11-lcdfilter-default.conf"
|
||||
"11-lcdfilter-${cfg.subpixel.lcdfilter}.conf")
|
||||
}
|
||||
|
||||
# 00-nixos-cache.conf
|
||||
ln -s ${cacheConf} $dst/00-nixos-cache.conf
|
||||
|
||||
@ -367,17 +382,25 @@ in
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = types.enum [ "hintnone" "hintslight" "hintmedium" "hintfull" ];
|
||||
default = "hintslight";
|
||||
type = types.enum ["none" "slight" "medium" "full"];
|
||||
default = "slight";
|
||||
description = lib.mdDoc ''
|
||||
Hintstyle is the amount of font reshaping done to line up
|
||||
to the grid.
|
||||
|
||||
hintslight will make the font more fuzzy to line up to the grid
|
||||
but will be better in retaining font shape, while hintfull will
|
||||
be a crisp font that aligns well to the pixel grid but will lose
|
||||
a greater amount of font shape.
|
||||
slight will make the font more fuzzy to line up to the grid but
|
||||
will be better in retaining font shape, while full will be a
|
||||
crisp font that aligns well to the pixel grid but will lose a
|
||||
greater amount of font shape.
|
||||
'';
|
||||
apply =
|
||||
val:
|
||||
let
|
||||
from = "fonts.fontconfig.hinting.style";
|
||||
val' = lib.removePrefix "hint" val;
|
||||
warning = "The option `${from}` contains a deprecated value `${val}`. Use `${val'}` instead.";
|
||||
in
|
||||
lib.warnIf (lib.hasPrefix "hint" val) warning val';
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user