[Nix-dev] How to downgrade or patch freetype-2.7 ?
Volth
volth at volth.com
Thu Apr 20 07:35:29 CEST 2017
Better to show: http://imgur.com/a/a5XpN
The first image (http://imgur.com/zOyxMh7) is with the default
NixOS-17.09 (freetype-2.7.1) settings.
Approximately the same is on 17.03 with its defaults.
Fonts are blurry, width of cells is wrongly calculated.
This could be fixed with fonconfig, and I did fix it with fontconfig on 17.03:
-------
<match target="font">
<test name="family"> <string>PragmataPro</string>
</test>
<edit name="antialias" mode="assign"> <bool>false</bool>
</edit>
<edit name="hintstyle" mode="assign"> <const>hintfull</const>
</edit>
<edit name="autohint" mode="assign"> <bool>false</bool>
</edit>
</match>
-------
The same fontconfig settings applied to:
PragmataPro
PragmataPro Mono <- that font family
Liberation Sans
Liberation Serif
Liberation Mono <- version 1.07, not NixOS's default 2.0x
Liberastika <- fork of liberation-1.07 with some fixes
Ubuntu
Ubuntu Condensed
Ubuntu Mono <- these are not so bad with the defaults, it is just a
matter of taste to have them antialiased, especially "Ubuntu
Condensed"
Arial
Times New Roman
Gulim
Meiryo
Microsoft YaHei <- microsoft fonts, copied from windows machine,
antialiasing can make a blotch out of a Chinese hieroglyph.
(As you see, almost all these fonts are either commercial or license
violation, so no wonder gnu's freetype does not support them well)
The second (http://imgur.com/MDiydzS) is what we get with these
fontconfig rules on NixOS-17.09 (freetype-2.7.1) with default v40.
Antialias is off, but hinting is not in action.
The third (http://imgur.com/sKs8ZrB) is v35, explicitly set on
NixOS-17.09 (freetype-2.7.1) or default on NixOS-17.03
(freetype-2.6.5).
Perfect.
PS. v38 works similar to v40. It easy to turn in off by
"config.fonts.fontconfig.ultimate.enable = false;".
What I was looking for is a similar easy way to turn off v40 appeared
in NixOS-unstable.
So I ended up creating a module:
```
{ config, pkgs, lib, ... }:
let
my-freetype = pkgs.callPackage ./my-freetype { };
my-freetype-32 = pkgs.pkgsi686Linux.callPackage ./my-freetype { };
my-pragmatapro = pkgs.callPackage ./pragmatapro { };
my-win2008fonts = pkgs.callPackage ./win2008fonts { };
my-win2008fonts-cjk = pkgs.callPackage ./win2008fonts-cjk { };
in {
config = {
fonts = {
enableDefaultFonts = false;
fonts = [
pkgs.xorg.fontbh100dpi
pkgs.xorg.fontmiscmisc
pkgs.xorg.fontcursormisc
pkgs.ubuntu_font_family
pkgs.liberation_ttf
pkgs.liberastika
my-pragmatapro
my-win2008fonts
my-win2008fonts-cjk
];
fontconfig = {
hinting.autohint = false;
defaultFonts.serif = [ "Liberation Serif" "Times New Roman" ];
defaultFonts.sansSerif = [ "Liberastika" "Liberation Sans"
"Arial" "Ubuntu" ];
defaultFonts.monospace = [ "PragmataPro Mono" ];
confPackages = [ (import ./font-conf { inherit (pkgs)
runCommand fontconfig; }) ]; # it adds fontconfig xml
useEmbeddedBitmaps = true; # 17.09+
penultimate.enable = false; # 17.09+
ultimate.enable = false;
};
};
environment.sessionVariables.LD_LIBRARY_PATH = [
"${my-freetype}/lib" "${my-freetype-32}/lib" ];
nixpkgs.overlays = [
(self: super: {
# google-chrome, torbrowser (..., gorilla, dropbox,
cytrix-receiver, spideroak, ...) add freetype to LD_LIBRARY_PATH in makeWrapper
torbrowser = super.torbrowser.override {
freetype = my-freetype;
};
google-chrome = super.google-chrome.override {
freetype = my-freetype;
};
liberation_ttf = self.liberation_ttf_v1_binary;
})
];
};
}
```
On 4/19/17, Thomas Tuegel <ttuegel at mailbox.org> wrote:
> Volth <volth at volth.com> writes:
>
>> Fontconfig does not help here. The problem is with all fonts with
>> manual hinting, also with all old windows fonts. Those fonts are from
>> pre-anti-aliasing ages.
>> Full hinting enabled + anti-aliasing disabled is the only suitable
>> mode for them.
>
> We can use Fontconfig to set per-font hinting and anti-aliasing
> settings! :-)
>
> We can't toggle the interpreter version directly through Fontconfig, but
> at `full' hinting, the v40 interpreter should give the same results as
> v38, especially with anti-aliasing disabled. I can't speak reliably
> about the v35 interpreter because NixOS has always used v38 in the past.
>
> I assume that "old windows fonts" means corefonts? Are you having
> trouble with any other fonts besides PragmataPro? If you give me a list,
> I can put together some samples to see if we can't find something better
> for everyone.
>
> Regards,
> Tom
>
More information about the nix-dev
mailing list