mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2024-11-12 18:03:14 -06:00
Compare commits
3 commits
56a06a32c9
...
e577167bdc
Author | SHA1 | Date | |
---|---|---|---|
|
e577167bdc | ||
|
a148894512 | ||
|
5006509e0a |
6 changed files with 51 additions and 181 deletions
|
@ -1,23 +1,23 @@
|
||||||
exclude: "^(src/.*|bin/font-patcher)"
|
exclude: "^(src/.*|bin/font-patcher)"
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v3.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/pycqa/isort
|
- repo: https://github.com/pycqa/isort
|
||||||
rev: 5.12.0
|
rev: 5.9.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.1.0
|
rev: 22.12.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
- repo: https://github.com/pycqa/flake8
|
||||||
rev: 'v0.0.257'
|
rev: 4.0.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: flake8
|
||||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||||
rev: v0.9.0.2
|
rev: v0.9.0.2
|
||||||
hooks:
|
hooks:
|
||||||
|
|
152
LICENSE
152
LICENSE
|
@ -1,152 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Daylin Morgan
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
-------
|
|
||||||
|
|
||||||
See below for licensing information related to ./src/ and ./bin/font-patcher.
|
|
||||||
|
|
||||||
# Nerd Fonts Licensing
|
|
||||||
|
|
||||||
There are various sources used under various licenses:
|
|
||||||
|
|
||||||
* Nerd Fonts source fonts, patched fonts, and folders with explict OFL SIL files are licensed under SIL OPEN FONT LICENSE Version 1.1 (see below).
|
|
||||||
* Nerd Fonts original source code files (such as `.sh`, `.py`, `font-patcher` and others) are licensed under the MIT License (MIT) (see below).
|
|
||||||
* Many other licenses are present in this project for even more detailed breakdown see: [License Audit](https://github.com/ryanoasis/nerd-fonts/blob/-/license-audit.md).
|
|
||||||
|
|
||||||
## Source files not in folders containing an explicit license are using the MIT License (MIT)
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Ryan L McIntyre
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
## Various Fonts, Patched Fonts, SVGs, Glyph Fonts, and any files in a folder with explicit SIL OFL 1.1 License
|
|
||||||
|
|
||||||
Copyright (c) 2014, Ryan L McIntyre (https://ryanlmcintyre.com).
|
|
||||||
|
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
||||||
This license is copied below, and is also available with a FAQ at:
|
|
||||||
http://scripts.sil.org/OFL
|
|
||||||
|
|
||||||
-----------------------------------------------------------
|
|
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
PREAMBLE
|
|
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
||||||
development of collaborative font projects, to support the font creation
|
|
||||||
efforts of academic and linguistic communities, and to provide a free and
|
|
||||||
open framework in which fonts may be shared and improved in partnership
|
|
||||||
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,
|
|
||||||
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
|
|
||||||
requirement for fonts to remain under this license does not apply
|
|
||||||
to any document created using the fonts or their derivatives.
|
|
||||||
|
|
||||||
DEFINITIONS
|
|
||||||
"Font Software" refers to the set of files released by the Copyright
|
|
||||||
Holder(s) under this license and clearly marked as such. This may
|
|
||||||
include source files, build scripts and documentation.
|
|
||||||
|
|
||||||
"Reserved Font Name" refers to any names specified as such after the
|
|
||||||
copyright statement(s).
|
|
||||||
|
|
||||||
"Original Version" refers to the collection of Font Software components as
|
|
||||||
distributed by the Copyright Holder(s).
|
|
||||||
|
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
||||||
or substituting -- in part or in whole -- any of the components of the
|
|
||||||
Original Version, by changing formats or by porting the Font Software to a
|
|
||||||
new environment.
|
|
||||||
|
|
||||||
"Author" refers to any designer, engineer, programmer, technical
|
|
||||||
writer or other person who contributed to the Font Software.
|
|
||||||
|
|
||||||
PERMISSION & CONDITIONS
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
||||||
redistribute, and sell modified and unmodified copies of the Font
|
|
||||||
Software, subject to the following conditions:
|
|
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components,
|
|
||||||
in Original or Modified Versions, may be sold by itself.
|
|
||||||
|
|
||||||
2) Original or Modified Versions of the Font Software may be bundled,
|
|
||||||
redistributed and/or sold with any software, provided that each copy
|
|
||||||
contains the above copyright notice and this license. These can be
|
|
||||||
included either as stand-alone text files, human-readable headers or
|
|
||||||
in the appropriate machine-readable metadata fields within text or
|
|
||||||
binary files as long as those fields can be easily viewed by the user.
|
|
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font
|
|
||||||
Name(s) unless explicit written permission is granted by the corresponding
|
|
||||||
Copyright Holder. This restriction only applies to the primary font name as
|
|
||||||
presented to the users.
|
|
||||||
|
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
||||||
Software shall not be used to promote, endorse or advertise any
|
|
||||||
Modified Version, except to acknowledge the contribution(s) of the
|
|
||||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole,
|
|
||||||
must be distributed entirely under this license, and must not be
|
|
||||||
distributed under any other license. The requirement for fonts to
|
|
||||||
remain under this license does not apply to any document created
|
|
||||||
using the Font Software.
|
|
||||||
|
|
||||||
TERMINATION
|
|
||||||
This license becomes null and void if any of the above conditions are
|
|
||||||
not met.
|
|
||||||
|
|
||||||
DISCLAIMER
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
||||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
||||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
9
Makefile
9
Makefile
|
@ -1,10 +1,13 @@
|
||||||
-include .env
|
-include .env
|
||||||
ARGS ?= -c
|
ARGS ?= -c
|
||||||
|
|
||||||
|
NF_SRC := $(shell ./bin/get-font-files src)
|
||||||
|
FONT_FLAGS := $(shell ./bin/get-font-files MonoLisa 'otf,ttf,woff,woff2')
|
||||||
|
|
||||||
patch: ./bin/font-patcher ## apply nerd fonts patch |> -gs b_magenta -ms bold
|
patch: ./bin/font-patcher ## apply nerd fonts patch |> -gs b_magenta -ms bold
|
||||||
@./patch-monolisa \
|
@./bin/patch-monolisa \
|
||||||
$(ARGS) \
|
$(FONT_FLAGS) \
|
||||||
-f MonoLisa/
|
$(ARGS)
|
||||||
|
|
||||||
update-fonts: ## move fonts and update fc-cache
|
update-fonts: ## move fonts and update fc-cache
|
||||||
$(call msg,Adding Fonts To System)
|
$(call msg,Adding Fonts To System)
|
||||||
|
|
|
@ -11,7 +11,7 @@ tested w/ MonoLisa v2.003
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- `python`
|
- `python`
|
||||||
- `make` (optional)
|
- `make`
|
||||||
- `fontforge` OR `docker`
|
- `fontforge` OR `docker`
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ you can easily apply the nerd font patches with `make`.
|
||||||
To patch all font types use the default `patch` rule.
|
To patch all font types use the default `patch` rule.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make # or ./patch-monolisa -f MonoLisa -c
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
By default the complete (`-c`) flag is passed to the font-patcher script to include all icons/symbols.
|
By default the complete (`-c`) flag is passed to the font-patcher script to include all icons/symbols.
|
||||||
|
@ -62,7 +62,7 @@ You can change this by specifying the `ARGS` at runtime.
|
||||||
ARGS="-c -w" make patch
|
ARGS="-c -w" make patch
|
||||||
```
|
```
|
||||||
|
|
||||||
See `./patch-monolisa --help` and `./bin/font-patcher --help` for available `ARGS`.
|
See `./bin/patch-monolisa --help` and `./bin/font-patcher --help` for available `ARGS`.
|
||||||
|
|
||||||
You can find your patched fonts in the `patched/` directory
|
You can find your patched fonts in the `patched/` directory
|
||||||
|
|
||||||
|
|
30
bin/get-font-files
Executable file
30
bin/get-font-files
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
EXTS = ["otf", "ttf", "woff", "woff2"]
|
||||||
|
|
||||||
|
|
||||||
|
def find_files(search_path, exts=None):
|
||||||
|
return (
|
||||||
|
[f for ext in exts for f in search_path.glob(f"**/*.{ext}")]
|
||||||
|
if exts
|
||||||
|
else [f for f in search_path.rglob("*") if f.is_file()]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
print("please specify directory to search")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
search_path = Path(sys.argv[1])
|
||||||
|
exts = sys.argv[2].split(",") if len(sys.argv) == 3 else EXTS
|
||||||
|
|
||||||
|
for f in find_files(search_path, exts):
|
||||||
|
sys.stdout.write(f"-f '{f}' ")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -10,7 +10,7 @@ import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Set
|
from typing import List, Set
|
||||||
|
|
||||||
FONT_SRC = (Path(__file__).parent / "MonoLisa").absolute()
|
FONT_SRC = (Path(__file__).parent.parent / "MonoLisa").absolute()
|
||||||
|
|
||||||
|
|
||||||
class Color:
|
class Color:
|
||||||
|
@ -159,6 +159,7 @@ def patch_single_font(
|
||||||
f"{color.yellow}:::{color.end} Patching font "
|
f"{color.yellow}:::{color.end} Patching font "
|
||||||
f"{color.bold}{font_path.name}{color.end}... "
|
f"{color.bold}{font_path.name}{color.end}... "
|
||||||
):
|
):
|
||||||
|
|
||||||
run_cmd(cmd, font_path, verbose)
|
run_cmd(cmd, font_path, verbose)
|
||||||
|
|
||||||
echo(f"{rel_path} patched!", hue="green")
|
echo(f"{rel_path} patched!", hue="green")
|
||||||
|
@ -204,17 +205,6 @@ def patch_font_dir_docker(
|
||||||
echo(f"{font_dir_path.name}/ fonts patched!", hue="green")
|
echo(f"{font_dir_path.name}/ fonts patched!", hue="green")
|
||||||
|
|
||||||
|
|
||||||
def get_font_files(p):
|
|
||||||
exts = ["otf", "ttf", "woff", "woff2"]
|
|
||||||
|
|
||||||
if p.is_file():
|
|
||||||
return (p,)
|
|
||||||
|
|
||||||
if p.is_dir():
|
|
||||||
return (f for ext in exts for f in p.glob(f"**/*.{ext}"))
|
|
||||||
return ()
|
|
||||||
|
|
||||||
|
|
||||||
def echo(msg: str, header=False, hue="cyan") -> None:
|
def echo(msg: str, header=False, hue="cyan") -> None:
|
||||||
if header:
|
if header:
|
||||||
print(f"==>{color.magenta} {msg} {color.end}<==")
|
print(f"==>{color.magenta} {msg} {color.end}<==")
|
||||||
|
@ -223,6 +213,7 @@ def echo(msg: str, header=False, hue="cyan") -> None:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
echo("MonoLisa NerdFont Patcher", header=True)
|
echo("MonoLisa NerdFont Patcher", header=True)
|
||||||
args, fp_args = get_args()
|
args, fp_args = get_args()
|
||||||
fp_args = " ".join(fp_args)
|
fp_args = " ".join(fp_args)
|
||||||
|
@ -232,15 +223,12 @@ def main():
|
||||||
echo("Patching the following files")
|
echo("Patching the following files")
|
||||||
for fontfile in args.font_path:
|
for fontfile in args.font_path:
|
||||||
sys.stdout.write(f" {color.magenta}->{color.end} {fontfile}\n")
|
sys.stdout.write(f" {color.magenta}->{color.end} {fontfile}\n")
|
||||||
|
|
||||||
fontfiles = [f for p in args.font_path for f in get_font_files(p)]
|
|
||||||
|
|
||||||
if args.docker:
|
if args.docker:
|
||||||
echo("==> DOCKER MODE ENABLED")
|
echo("==> DOCKER MODE ENABLED")
|
||||||
for font_dir in collect_files_by_dir(fontfiles):
|
for font_dir in collect_files_by_dir(args.font_path):
|
||||||
patch_font_dir_docker(font_dir, args.output, fp_args, args.verbose)
|
patch_font_dir_docker(font_dir, args.output, fp_args, args.verbose)
|
||||||
else:
|
else:
|
||||||
for fontfile in fontfiles:
|
for fontfile in args.font_path:
|
||||||
patch_single_font(Path(fontfile), args.output, fp_args, args.verbose)
|
patch_single_font(Path(fontfile), args.output, fp_args, args.verbose)
|
||||||
|
|
||||||
echo("fonts are patched", hue="green")
|
echo("fonts are patched", hue="green")
|
||||||
|
@ -248,5 +236,6 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
color = Color()
|
color = Color()
|
||||||
main()
|
main()
|
Loading…
Reference in a new issue