mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-10 10:48:00 +00:00
afdko 5.0.1 regressed variable-font hinting: otfautohint aborts with an AssertionError in calcInstanceStems() when a high ghost stem is a glyph's first stem (e.g. small diagonal accents), which broke cantarell-fonts. Backport the upstream fix as a patch to afdko. https://github.com/adobe-type-tools/afdko/pull/1844 Closes #535887 Assisted-by: Claude Code (claude-opus-4-8)
149 lines
3.4 KiB
Nix
149 lines
3.4 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
addBinToPathHook,
|
|
antlr4_13,
|
|
booleanoperations,
|
|
buildPythonPackage,
|
|
cmake,
|
|
cython,
|
|
defcon,
|
|
fetchFromGitHub,
|
|
fontmath,
|
|
fonttools,
|
|
libxml2,
|
|
lxml,
|
|
mypy,
|
|
ninja,
|
|
pytestCheckHook,
|
|
runAllTests ? false,
|
|
scikit-build-core,
|
|
setuptools-scm,
|
|
tqdm,
|
|
ufonormalizer,
|
|
ufoprocessor,
|
|
uharfbuzz,
|
|
|
|
# passthru
|
|
afdko,
|
|
}:
|
|
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "afdko";
|
|
version = "5.0.1";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "adobe-type-tools";
|
|
repo = "afdko";
|
|
tag = finalAttrs.version;
|
|
hash = "sha256:sha256-ts7vFfbPPrdooOH0JYrn3YKs7kRju4LbZ8Ypd3ExELc=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# https://github.com/NixOS/nixpkgs/pull/510112#issuecomment-4263642029
|
|
substituteInPlace CMakeLists.txt \
|
|
--replace-fail 'cmake_minimum_required(VERSION 3.16)' "cmake_minimum_required(VERSION 3.16)
|
|
find_package(LibXml2 REQUIRED)"
|
|
'';
|
|
|
|
build-system = [
|
|
cmake
|
|
cython
|
|
ninja
|
|
scikit-build-core
|
|
setuptools-scm
|
|
];
|
|
|
|
cmakeFlags = [
|
|
"-DANTLR4_INCLUDE_DIRS=${lib.getDev antlr4_13.runtime.cpp}/include/antlr4-runtime"
|
|
];
|
|
|
|
buildInputs = [
|
|
antlr4_13.runtime.cpp
|
|
libxml2.dev
|
|
];
|
|
|
|
patches = [
|
|
./dont-fetch-third-party-libs.patch
|
|
|
|
# Use antlr4 runtime from nixpkgs and link it dynamically
|
|
./use-dynamic-system-antlr4-runtime.patch
|
|
|
|
# integer underflow causes incorrect behavior
|
|
# patch submitted upstream as https://github.com/adobe-type-tools/afdko/pull/1843
|
|
./0001-addfeatures-hmtx-avoid-unsigned-integer-underflow.patch
|
|
|
|
# spurious assertion when a high ghost stem is a glyph's first stem aborts
|
|
# variable-font hinting (e.g. cantarell-fonts, NixOS/nixpkgs#535887)
|
|
# patch submitted upstream as https://github.com/adobe-type-tools/afdko/pull/1844
|
|
./0002-otfautohint-fix-assertion-high-ghost-first-stem.patch
|
|
];
|
|
|
|
env = {
|
|
FORCE_SYSTEM_ANTLR4 = true;
|
|
# Use system libxml2
|
|
FORCE_SYSTEM_LIBXML2 = true;
|
|
};
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
dependencies = [
|
|
booleanoperations
|
|
defcon
|
|
fontmath
|
|
fonttools
|
|
lxml
|
|
tqdm
|
|
ufonormalizer
|
|
ufoprocessor
|
|
]
|
|
++ defcon.optional-dependencies.lxml
|
|
++ defcon.optional-dependencies.pens
|
|
++ fonttools.optional-dependencies.lxml
|
|
++ fonttools.optional-dependencies.ufo
|
|
++ fonttools.optional-dependencies.unicode
|
|
++ fonttools.optional-dependencies.woff;
|
|
|
|
nativeCheckInputs = [
|
|
addBinToPathHook
|
|
mypy
|
|
pytestCheckHook
|
|
uharfbuzz
|
|
];
|
|
|
|
disabledTests = [
|
|
]
|
|
++ lib.optionals (!runAllTests) [
|
|
# Disable slow tests, reduces test time ~25 %
|
|
"test_report"
|
|
"test_post_overflow"
|
|
"test_cjk"
|
|
"test_extrapolate"
|
|
"test_filename_without_dir"
|
|
"test_overwrite"
|
|
"test_options"
|
|
]
|
|
++ lib.optionals (stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isRiscV) [
|
|
# unknown reason so far
|
|
# https://github.com/adobe-type-tools/afdko/issues/1425
|
|
"test_spec"
|
|
]
|
|
++ lib.optionals (stdenv.hostPlatform.isi686) [
|
|
"test_dump_option"
|
|
"test_type1mm_inputs"
|
|
];
|
|
|
|
passthru.tests = {
|
|
fullTestsuite = afdko.override { runAllTests = true; };
|
|
};
|
|
|
|
meta = {
|
|
description = "Adobe Font Development Kit for OpenType";
|
|
changelog = "https://github.com/adobe-type-tools/afdko/blob/${finalAttrs.version}/NEWS.md";
|
|
homepage = "https://adobe-type-tools.github.io/afdko";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ sternenseemann ];
|
|
};
|
|
})
|