Skip to content

Instantly share code, notes, and snippets.

@erikarvstedt
Created December 7, 2021 21:34
Show Gist options
  • Save erikarvstedt/10eb1a55f1eab6ae0fa77df290b51334 to your computer and use it in GitHub Desktop.
Save erikarvstedt/10eb1a55f1eab6ae0fa77df290b51334 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# What this build script does:
# Run `fc-scan` from fontconfig 2.13.93 and 2.13.94 on a demo font.
# 2.13.94 doesn't find all font variations.
read -d '' src <<'EOF' || :
let
nixpkgs1 = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/036dc0c709650e0c833822307af801f576d67273.tar.gz";
sha256 = "0pnrygs6xf7id63zi17pq5379hfppwbb5cfazhypcqz6l3dfk00g";
};
nixpkgs2 = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/16105403bdd843540cbef9c63fc0f16c1c6eaa70.tar.gz";
sha256 = "0sl6hsxlh14kcs38jcra908nvi5hd8p8hlim3lbra55lz0kd9rcl";
};
demoFont = builtins.fetchurl {
# https://github.com/erikarvstedt/fontforge-bug-repro
url = "https://github.com/erikarvstedt/fontforge-bug-repro/blob/99490c7b5cedb965274e3306f8eb062b69577a27/SFNSDisplay.ttf?raw=true";
sha256 = "16p3z9y4h39il9c5yq7dkzw60c234ih7wjjm32pm2s2qxy5lqzm2";
};
pkgs = import nixpkgs1 { config = {}; overlays = []; };
pkgsBug = import nixpkgs2 { config = {}; overlays = []; };
fc_2_13_93 = pkgs.fontconfig;
fc_2_13_94 = pkgsBug.fontconfig;
in
pkgs.runCommand "show-bug" {
nativeBuildInputs = [ pkgs.gnugrep ];
} ''
export HOME=/tmp
${fc_2_13_93}/bin/fc-scan --version
${fc_2_13_93}/bin/fc-scan ${demoFont} | grep weight
${fc_2_13_94}/bin/fc-scan --version
${fc_2_13_94}/bin/fc-scan ${demoFont} | grep weight
exit 1
''
EOF
nix-build --no-out-link -E "$src"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment