aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/theme-studio/Makefile')
-rw-r--r--scripts/theme-studio/Makefile35
1 files changed, 34 insertions, 1 deletions
diff --git a/scripts/theme-studio/Makefile b/scripts/theme-studio/Makefile
index 374c7fb1b..02540720e 100644
--- a/scripts/theme-studio/Makefile
+++ b/scripts/theme-studio/Makefile
@@ -16,7 +16,16 @@ OUT ?= ../../themes
EMACS ?= emacs
EMACSCLIENT ?= emacsclient
-.PHONY: help test check check-generated coverage gen open theme theme-load theme-reload
+# Source TTF for the embedded nerd-icon font. `make font` re-encodes it to the
+# committed woff2 with fontTools — NOT woff2_compress, whose output headed Chrome
+# and Firefox reject (they render tofu) even though old-headless Chrome accepts it.
+NERD_TTF ?= /usr/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf
+NERD_WOFF2 ?= SymbolsNerdFontMono-Regular.woff2
+
+.PHONY: help test check check-generated coverage gen open theme theme-load theme-reload face-coverage-dump face-coverage face-coverage-diff font
+
+# Scratch path for the face-coverage Emacs data dump.
+FACE_DUMP ?= /tmp/face-coverage-data.json
.DEFAULT_GOAL := help
@@ -31,6 +40,17 @@ help:
@echo " make theme JSON=x.json - Convert a Theme Studio JSON export to OUT/<name>-theme.el"
@echo " make theme-load THEME=x - Disable all custom themes, then load THEME in current Emacs"
@echo " make theme-reload JSON=x - Convert JSON, then cleanly reload its theme in current Emacs"
+ @echo " make face-coverage - Regenerate face-coverage.org from the live Emacs daemon"
+ @echo " make face-coverage-diff - Show the coverage delta vs the committed face-coverage.org"
+ @echo " make font - Re-encode the embedded nerd woff2 from NERD_TTF (fontTools)"
+
+font:
+ @python3 -c "import os,sys; from fontTools.ttLib import TTFont; \
+src='$(NERD_TTF)'; \
+sys.exit('NERD_TTF not found: '+src) if not os.path.exists(src) else None; \
+f=TTFont(src); f.flavor='woff2'; f.save('$(NERD_WOFF2)'); \
+print('wrote $(NERD_WOFF2) (%d bytes) from %s' % (os.path.getsize('$(NERD_WOFF2)'), src))"
+ @echo "now run: make gen (re-inlines the woff2 as a data: URI into theme-studio.html)"
test:
@./run-tests.sh
@@ -101,3 +121,16 @@ endif
@theme_name='$(THEME)'; \
if [ -z "$$theme_name" ]; then theme_name="$$(basename '$(JSON)' .json)"; fi; \
$(MAKE) theme-load THEME="$$theme_name" OUT='$(OUT)' EMACSCLIENT='$(EMACSCLIENT)'
+
+# Dump face/group/package data from the running daemon (falls back to a batch
+# Emacs that loads the full init when no daemon is reachable).
+face-coverage-dump:
+ @$(EMACSCLIENT) -e '(progn (load "$(HERE)face-coverage-dump.el") (face-coverage-dump "$(FACE_DUMP)"))' >/dev/null 2>&1 \
+ || $(EMACS) --batch -l "$$HOME/.emacs.d/init.el" -l "$(HERE)face-coverage-dump.el" \
+ --eval '(face-coverage-dump "$(FACE_DUMP)")'
+
+face-coverage: face-coverage-dump
+ @python3 face_coverage.py --data "$(FACE_DUMP)"
+
+face-coverage-diff: face-coverage-dump
+ @python3 face_coverage.py --data "$(FACE_DUMP)" --compare face-coverage.org