Compare commits

..

No commits in common. "67e41cd3628414559b7180aa3cf168990894ee5b" and "683734abba82191ce1654f8b93436a4a59474be8" have entirely different histories.

8 changed files with 20 additions and 115 deletions

1
.gitignore vendored
View file

@ -185,4 +185,3 @@ patched/*
nerd-fonts
.env
font-patcher-log.txt
result

View file

@ -1,14 +1,20 @@
exclude: "^(src/.*|bin/scripts|font-patcher)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.257'
hooks:
- id: ruff-format
- id: ruff
args: [ --fix ]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck

View file

@ -77,7 +77,7 @@ with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The

View file

@ -83,14 +83,6 @@ make update-fonts
You can verify the fonts have been added with `make check`.
## with Nix
You can run using the included `flake.nix`.
```bash
nix run "github:daylinmorgan/monolisa-nerdfont-patch"
```
## Contributing
Before making changes to to any of the scripts in `bin` you should first install `pre-commit`.

View file

@ -8,18 +8,11 @@ divider() {
}
show-version() {
printf "%s %s %s\n" "$(divider)" "$1" "$(divider)"
which "$1" 2>/dev/null
which "$1"
"$@"
}
show-dir() {
dir="$( dirname -- "$( readlink -f -- "$0"; )"; )"/../"$1"
printf "%s\n%s\n%s\n" "$(divider)" "$(tree "$dir")" "$(divider)"
}
show-version python --version
show-version fontforge --version
show-version docker --version
show-version uname -a
show-dir MonoLisa
show-dir patched

View file

@ -1,27 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1706371002,
"narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c002c6aa977ad22c60398daaa9be52f2203d0006",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,58 +0,0 @@
{
description = "brain";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = inputs @ {
self,
nixpkgs,
}: let
inherit (nixpkgs.lib) genAttrs;
forAllSystems = f:
genAttrs
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
(system: f nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (
pkgs:
with pkgs; {
default = stdenv.mkDerivation {
name = "monolisa-nerdfont-patch";
src = ./.;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
fontforge
python3
];
unpackPhase = ":";
buildPhase = ":";
installPhase = ''
mkdir -p $out/bin
install -m755 -D ${./patch-monolisa} $out/bin/monolisa-nerdfont-patch
install -m755 -D ${./font-patcher} $out/bin/font-patcher
cp -r ${./bin} $out/bin/bin
cp -r ${./src} $out/bin/src
'';
postFixup = ''
wrapProgram $out/bin/monolisa-nerdfont-patch \
--set PATH ${lib.makeBinPath [
fontforge
]}
'';
};
}
);
devShells = forAllSystems (
pkgs:
with pkgs; {
default = mkShell {
buildInputs = [
fontforge
python3
pre-commit
];
};
}
);
};
}

View file

@ -10,6 +10,8 @@ import time
from pathlib import Path
from typing import List, Set
FONT_SRC = (Path(__file__).parent / "MonoLisa").absolute()
class Color:
def __init__(self):
@ -131,16 +133,16 @@ def patch_single_font(
font_path: Path, output_dir: Path, fp_args: str, verbose: bool
) -> None:
# update display name to full resolved path
rel_path = font_path.absolute()
output_path = (output_dir / rel_path.parent.name).absolute()
rel_path = font_path.absolute().relative_to(FONT_SRC)
output_path = (output_dir / rel_path).parent
output_path.mkdir(exist_ok=True, parents=True)
cmd = [
"fontforge",
"-script",
f"{Path(__file__).parent}/font-patcher",
"./font-patcher",
"--glyphdir",
f"{Path(__file__).parent}/src/glyphs/",
"./src/glyphs/",
"-out",
f"{output_path}",
f"{font_path.absolute()}",
@ -169,9 +171,7 @@ def collect_files_by_dir(fontfiles: List[Path]) -> Set[Path]:
def patch_font_dir_docker(
font_dir_path: Path, output_dir: Path, fp_args: str, verbose: bool
) -> None:
output_path = (
output_dir / font_dir_path.relative_to(font_dir_path.parent)
).absolute()
output_path = (output_dir / font_dir_path.relative_to(FONT_SRC)).absolute()
output_path.mkdir(exist_ok=True, parents=True)
cmd = [