diff --git a/.github/workflows/rebuild-index.yml b/.github/workflows/rebuild-index.yml index 8476745..5f0dc93 100644 --- a/.github/workflows/rebuild-index.yml +++ b/.github/workflows/rebuild-index.yml @@ -26,8 +26,9 @@ jobs: git config --global user.name "CI" git config --global user.email "shinmera@tymoon.eu" git clone --quiet --branch=gh-pages https://${{ secrets.ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git ~/gh-pages - cp index.html PromptFont.ttf ~/gh-pages/ - cd ~/gh-pages - git add index.html PromptFont.ttf - git commit -qm "CI index rebuild." || echo "Nothing to commit." - git push -q origin gh-pages + cp $FILES ~/gh-pages/ + git -C ~/gh-pages add $FILES + git -C ~/gh-pages commit -qm "CI index rebuild." || echo "Nothing to commit." + git -C ~/gh-pages push -q origin gh-pages + env: + FILES: index.html glyphs.json chars.txt PromptFont.ttf PromptFont.otf diff --git a/.gitignore b/.gitignore index e8d8992..e1717e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.sfd-* -index.html \ No newline at end of file +index.html +chars.txt \ No newline at end of file diff --git a/compile.lisp b/compile.lisp index 4fbdd08..b1d1ffc 100755 --- a/compile.lisp +++ b/compile.lisp @@ -4,7 +4,7 @@ exec sbcl \ --disable-debugger \ --eval "(ql:quickload '(clip shasht) :silent T)" \ --load "$0" \ - --eval '(fixup)' --eval '(generate)' \ + --eval '(main)' \ --quit \ --end-toplevel-options "${@:1}" |# @@ -29,11 +29,17 @@ exec sbcl \ collect (list :name name :glyphs (sort glyphs #'< :key (lambda (a) (getf a :codepoint))))))) -(defun generate (&key (input (file "index" "ctml")) (output (file "index" "html"))) +(defun web (&key (input (file "index" "ctml")) (output (file "index" "html"))) (let ((sections (parse-glyphs))) (with-open-file (stream output :direction :output :if-exists :supersede) (plump:serialize (clip:process input :sections sections) stream)))) +(defun txt (&key (file (file "glyphs" "json")) (output (file "chars" "txt"))) + (with-open-file (stream output :direction :output :if-exists :supersede) + (loop for glyph across (with-open-file (stream file) + (shasht:read-json stream)) + do (write-string (gethash "character" glyph) stream)))) + (defun fixup (&optional (file (merge-pathnames "glyphs.json" *here*))) (let ((data (with-open-file (stream file) (shasht:read-json stream)))) @@ -46,3 +52,29 @@ exec sbcl \ (sort data #'< :key (lambda (entry) (gethash "codepoint" entry))) (with-open-file (stream file :direction :output :if-exists :supersede) (shasht:write-json data stream)))) + +(defun all () + (fixup) + (txt) + (web)) + +(defun help () + (format T "PromptFont data management utilities + +Commands: + help --- Show this help screen + all --- Performs all below commands. This is run by default + fixup --- Fixes up the glyphs.json file + txt --- Generates the chars.txt file + web --- Generates the index.html file + +You typically do not need this utility as it is run automatically by +the GitHub CI when you create a PR. + +https://github.com/shinmera/promptfont +")) + +(defun main () + (destructuring-bind (argv0 &optional (command "all") &rest args) (uiop:raw-command-line-arguments) + (declare (ignore argv0)) + (apply (intern (format NIL "~:@(~a~)" command) #.*package*) args))) diff --git a/index.ctml b/index.ctml index 7b192d2..95ce4fe 100644 --- a/index.ctml +++ b/index.ctml @@ -126,7 +126,10 @@
This is a font designed for button prompts in games. It includes the base alphabet, as well as icons for modifier and control keys, and gamepad buttons.
PromptFont is based on the Xolonium font by Severin Meyer and licenced under the SIL Open Font Licence.