mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2024-12-22 23:10:44 -06:00
Compare commits
No commits in common. "b71e7d3aef889e396d1c787ef05e74c55edea0fa" and "58b19699b9bcae8ffcee572ab93324ab172a5d9f" have entirely different histories.
b71e7d3aef
...
58b19699b9
4 changed files with 33 additions and 101 deletions
116
.task.mk
116
.task.mk
|
@ -1,7 +1,7 @@
|
||||||
# }> [github.com/daylinmorgan/task.mk] <{ #
|
# }> [github.com/daylinmorgan/task.mk] <{ #
|
||||||
# Copyright (c) 2022 Daylin Morgan
|
# Copyright (c) 2022 Daylin Morgan
|
||||||
# MIT License
|
# MIT License
|
||||||
# version: v22.9.19-5-g5f593e3-dev
|
# version: 22.9.19
|
||||||
#
|
#
|
||||||
# task.mk should be included at the bottom of your Makefile with `-include .task.mk`
|
# task.mk should be included at the bottom of your Makefile with `-include .task.mk`
|
||||||
# See below for the standard configuration options that should be set prior to including this file.
|
# See below for the standard configuration options that should be set prior to including this file.
|
||||||
|
@ -18,12 +18,7 @@ HELP_SEP ?= │
|
||||||
# python f-string literals
|
# python f-string literals
|
||||||
EPILOG ?=
|
EPILOG ?=
|
||||||
USAGE ?={ansi.$(HEADER_STYLE)}usage{ansi.end}:\n make <recipe>\n
|
USAGE ?={ansi.$(HEADER_STYLE)}usage{ansi.end}:\n make <recipe>\n
|
||||||
INHERIT_SHELL ?=
|
# ---- [buitlin recipes] ---- #
|
||||||
# ---- [builtin recipes] ---- #
|
|
||||||
ifeq (help,$(firstword $(MAKECMDGOALS)))
|
|
||||||
HELP_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
||||||
export HELP_ARGS
|
|
||||||
endif
|
|
||||||
## h, help | show this help
|
## h, help | show this help
|
||||||
.PHONY: help h
|
.PHONY: help h
|
||||||
help h:
|
help h:
|
||||||
|
@ -52,32 +47,29 @@ _update-task.mk:
|
||||||
$(call tprint,{a.b_cyan}Updating task.mk{a.end})
|
$(call tprint,{a.b_cyan}Updating task.mk{a.end})
|
||||||
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
||||||
export MAKEFILE_LIST
|
export MAKEFILE_LIST
|
||||||
ifndef INHERIT_SHELL
|
|
||||||
SHELL := /bin/bash
|
|
||||||
endif
|
|
||||||
# ---- [python/bash script runner] ---- #
|
# ---- [python/bash script runner] ---- #
|
||||||
define _newline
|
define \n
|
||||||
|
|
||||||
|
|
||||||
endef
|
endef
|
||||||
_escape_shellstring = $(subst `,\`,$(subst ",\",$(subst $$,\$$,$(subst \,\\,$1))))
|
escape_shellstring = $(subst `,\`,$(subst ",\",$(subst $$,\$$,$(subst \,\\,$1))))
|
||||||
_escape_printf = $(subst \,\\,$(subst %,%%,$1))
|
escape_printf = $(subst \,\\,$(subst %,%%,$1))
|
||||||
_create_string = $(subst $(_newline),\n,$(call _escape_shellstring,$(call _escape_printf,$1)))
|
create_string = $(subst $(\n),\n,$(call escape_shellstring,$(call escape_printf,$1)))
|
||||||
_printline = printf -- "<----------------------------------->\n"
|
printline = printf -- "<----------------------------------->\n"
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
define _debug_runner
|
define _debug_runner
|
||||||
@printf "$(1) Script:\n";$(_printline);
|
@printf "$(1) Script:\n";$(printline);
|
||||||
@printf "$(call _create_string,$(3))\n" | cat -n
|
@printf "$(call create_string,$(3))\n" | cat -n
|
||||||
@$(_printline)
|
@$(printline)
|
||||||
@$(2) <(printf "$(call _create_string,$(3))")
|
@printf "$(call create_string,$(3))" | $(2)
|
||||||
endef
|
endef
|
||||||
py = $(call _debug_runner,Python,python3,$($(1)))
|
py = $(call _debug_runner,Python,python3,$($(1)))
|
||||||
tbash = $(call _debug_runner,Bash,bash,$($(1)))
|
tbash = $(call _debug_runner,Bash,bash,$($(1)))
|
||||||
else
|
else
|
||||||
py = @python3 <(printf "$(call _create_string,$($(1)))")
|
py = @python3 <(printf "$(call create_string,$($(1)))")
|
||||||
tbash = @bash <(printf "$(call _create_string,$($(1)))")
|
tbash = @bash <(printf "$(call create_string,$($(1)))")
|
||||||
endif
|
endif
|
||||||
pysh = python3 <(printf "$(call _create_string,$($(1)))")
|
pysh = python3 <(printf "$(call create_string,$($(1)))")
|
||||||
# ---- [python scripts] ---- #
|
# ---- [python scripts] ---- #
|
||||||
define help_py
|
define help_py
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -85,12 +77,10 @@ from collections import namedtuple
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
$(ansi_py)
|
$(ansi_py)
|
||||||
$(quit_make_py)
|
|
||||||
MaxLens = namedtuple("MaxLens", "goal msg")
|
MaxLens = namedtuple("MaxLens", "goal msg")
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
r"^## (?P<goal>.*?) \| (?P<msg>.*?)(?:\s?\| args: (?P<msgargs>.*?))?$$|^### (?P<rawmsg>.*?)?(?:\s?\| args: (?P<rawargs>.*?))?$$"
|
r"^## (?P<goal>.*?) \| (?P<msg>.*?)(?:\s?\| args: (?P<msgargs>.*?))?$$|^### (?P<rawmsg>.*?)?(?:\s?\| args: (?P<rawargs>.*?))?$$"
|
||||||
)
|
)
|
||||||
goal_pattern = re.compile(r"""^(?!#|\t)(.*):.*\n\t""", re.MULTILINE)
|
|
||||||
def parseargs(argstring):
|
def parseargs(argstring):
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--align")
|
parser.add_argument("--align")
|
||||||
|
@ -106,51 +96,16 @@ def gen_makefile():
|
||||||
with open(file, "r") as f:
|
with open(file, "r") as f:
|
||||||
makefile += f.read() + "\n\n"
|
makefile += f.read() + "\n\n"
|
||||||
return makefile
|
return makefile
|
||||||
def parse_help(file, hidden=False):
|
def parse_make(file):
|
||||||
for line in file.splitlines():
|
for line in file.splitlines():
|
||||||
match = pattern.search(line)
|
match = pattern.search(line)
|
||||||
if match:
|
if match:
|
||||||
if (
|
if not os.getenv("SHOW_HIDDEN") and str(
|
||||||
not hidden
|
match.groupdict().get("goal")
|
||||||
and not os.getenv("SHOW_HIDDEN")
|
).startswith("_"):
|
||||||
and str(match.groupdict().get("goal")).startswith("_")
|
|
||||||
):
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
yield {k: v for k, v in match.groupdict().items() if v is not None}
|
yield {k: v for k, v in match.groupdict().items() if v is not None}
|
||||||
def recipe_help_header(goal):
|
|
||||||
item = [
|
|
||||||
i
|
|
||||||
for i in list(parse_help(gen_makefile(), hidden=True))
|
|
||||||
if "goal" in i and goal == i["goal"]
|
|
||||||
]
|
|
||||||
if item:
|
|
||||||
return fmt_goal(
|
|
||||||
item[0]["goal"],
|
|
||||||
item[0]["msg"],
|
|
||||||
len(item[0]["goal"]),
|
|
||||||
item[0].get("msgargs", ""),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
return f" {ansi.style(goal,'$(GOAL_STYLE)')}:"
|
|
||||||
def parse_goal(file, goal):
|
|
||||||
goals = goal_pattern.findall(file)
|
|
||||||
matched_goal = [i for i in goals if goal in i.split()]
|
|
||||||
output = []
|
|
||||||
if matched_goal:
|
|
||||||
output.append(recipe_help_header(matched_goal[0]))
|
|
||||||
lines = file.splitlines()
|
|
||||||
loc = [n for n, l in enumerate(lines) if l.startswith(f"{matched_goal[0]}:")][0]
|
|
||||||
recipe = []
|
|
||||||
for line in lines[loc + 1 :]:
|
|
||||||
if not line.startswith("\t"):
|
|
||||||
break
|
|
||||||
recipe.append(line)
|
|
||||||
output.append(divider(max((len(l) for l in recipe)) + 5))
|
|
||||||
output.append("\n".join(recipe) + "\n")
|
|
||||||
else:
|
|
||||||
output.append(f"{ansi.b_red}ERROR{ansi.end} Failed to find goal: {goal}")
|
|
||||||
return output
|
|
||||||
def fmt_goal(goal, msg, max_goal_len, argstr):
|
def fmt_goal(goal, msg, max_goal_len, argstr):
|
||||||
args = parseargs(argstr)
|
args = parseargs(argstr)
|
||||||
goal_style = args.goal_style.strip() if args.goal_style else "$(GOAL_STYLE)"
|
goal_style = args.goal_style.strip() if args.goal_style else "$(GOAL_STYLE)"
|
||||||
|
@ -160,8 +115,6 @@ def fmt_goal(goal, msg, max_goal_len, argstr):
|
||||||
+ f" $(HELP_SEP) "
|
+ f" $(HELP_SEP) "
|
||||||
+ ansi.style(msg, msg_style)
|
+ ansi.style(msg, msg_style)
|
||||||
)
|
)
|
||||||
def divider(len):
|
|
||||||
return ansi.style(f" {'$(DIVIDER)'*len}", "$(DIVIDER_STYLE)")
|
|
||||||
def fmt_rawmsg(msg, argstr, maxlens):
|
def fmt_rawmsg(msg, argstr, maxlens):
|
||||||
args = parseargs(argstr)
|
args = parseargs(argstr)
|
||||||
lines = []
|
lines = []
|
||||||
|
@ -178,13 +131,18 @@ def fmt_rawmsg(msg, argstr, maxlens):
|
||||||
else:
|
else:
|
||||||
lines.append(f" {ansi.style(msg,msg_style)}")
|
lines.append(f" {ansi.style(msg,msg_style)}")
|
||||||
if args.divider:
|
if args.divider:
|
||||||
lines.append(divider(len("$(HELP_SEP)") + sum(maxlens) + 2))
|
lines.append(
|
||||||
|
ansi.style(
|
||||||
|
f" {'$(DIVIDER)'*(len('$(HELP_SEP)')+sum(maxlens)+2)}",
|
||||||
|
"$(DIVIDER_STYLE)",
|
||||||
|
)
|
||||||
|
)
|
||||||
if args.whitespace:
|
if args.whitespace:
|
||||||
lines.append("\n")
|
lines.append("\n")
|
||||||
return lines
|
return lines
|
||||||
def print_help():
|
def print_help():
|
||||||
lines = [f"""$(USAGE)"""]
|
lines = [f"""$(USAGE)"""]
|
||||||
items = list(parse_help(gen_makefile()))
|
items = list(parse_make(gen_makefile()))
|
||||||
maxlens = MaxLens(
|
maxlens = MaxLens(
|
||||||
*(max((len(item[x]) for item in items if x in item)) for x in ["goal", "msg"])
|
*(max((len(item[x]) for item in items if x in item)) for x in ["goal", "msg"])
|
||||||
)
|
)
|
||||||
|
@ -199,19 +157,7 @@ def print_help():
|
||||||
lines.extend(fmt_rawmsg(item["rawmsg"], item.get("rawargs", ""), maxlens))
|
lines.extend(fmt_rawmsg(item["rawmsg"], item.get("rawargs", ""), maxlens))
|
||||||
lines.append(f"""$(EPILOG)""")
|
lines.append(f"""$(EPILOG)""")
|
||||||
print("\n".join(lines))
|
print("\n".join(lines))
|
||||||
def print_arg_help(help_args):
|
print_help()
|
||||||
for arg in help_args.split():
|
|
||||||
print(f"{ansi.style('task.mk recipe help','$(HEADER_STYLE)')}\n")
|
|
||||||
print("\n".join(parse_goal(gen_makefile(), arg)))
|
|
||||||
def main():
|
|
||||||
help_args = os.getenv("HELP_ARGS")
|
|
||||||
if help_args:
|
|
||||||
quit_make()
|
|
||||||
print_arg_help(help_args)
|
|
||||||
else:
|
|
||||||
print_help()
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
endef
|
endef
|
||||||
define ansi_py
|
define ansi_py
|
||||||
import os
|
import os
|
||||||
|
@ -309,7 +255,6 @@ endef
|
||||||
define confirm_py
|
define confirm_py
|
||||||
import sys
|
import sys
|
||||||
$(ansi_py)
|
$(ansi_py)
|
||||||
$(quit_make_py)
|
|
||||||
def confirm():
|
def confirm():
|
||||||
"""
|
"""
|
||||||
Ask user to enter Y or N (case-insensitive).
|
Ask user to enter Y or N (case-insensitive).
|
||||||
|
@ -321,12 +266,7 @@ def confirm():
|
||||||
answer = input(f"""$(2) {a.b_red}[Y/n]{a.end} """).lower()
|
answer = input(f"""$(2) {a.b_red}[Y/n]{a.end} """).lower()
|
||||||
return answer == "y"
|
return answer == "y"
|
||||||
if confirm():
|
if confirm():
|
||||||
sys.exit()
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
quit_make()
|
sys.exit(1)
|
||||||
endef
|
|
||||||
define quit_make_py
|
|
||||||
import os, signal
|
|
||||||
def quit_make():
|
|
||||||
os.kill(os.getppid(), signal.SIGQUIT)
|
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -667,11 +667,11 @@ class font_patcher:
|
||||||
ligature_subtables = json.loads(self.config.get("Subtables", "ligatures"))
|
ligature_subtables = json.loads(self.config.get("Subtables", "ligatures"))
|
||||||
for subtable in ligature_subtables:
|
for subtable in ligature_subtables:
|
||||||
print("Removing subtable:", subtable)
|
print("Removing subtable:", subtable)
|
||||||
try:
|
try:
|
||||||
self.sourceFont.removeLookupSubtable(subtable)
|
self.sourceFont.removeLookupSubtable(subtable)
|
||||||
print("Successfully removed subtable:", subtable)
|
print("Successfully removed subtable:", subtable)
|
||||||
except Exception:
|
except Exception:
|
||||||
print("Failed to remove subtable:", subtable)
|
print("Failed to remove subtable:", subtable)
|
||||||
elif self.args.removeligatures:
|
elif self.args.removeligatures:
|
||||||
print("Unable to read configfile, unable to remove ligatures")
|
print("Unable to read configfile, unable to remove ligatures")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
### Contents
|
|
||||||
|
|
||||||
This directory contains all the glyphs (glyph sets) that the `font-patcher` puts into the fonts.
|
|
||||||
|
|
||||||
If a icon font here is updated, do not forget to update the database file in `bin/script/libs`.
|
|
||||||
|
|
||||||
The 'Seti and Original' icons (in `original-source.otf`) is automatically generated from the glyphs in `src/svgs`.
|
|
||||||
Do not edit and commit changes to that font directly.
|
|
Binary file not shown.
Loading…
Reference in a new issue