Skip to content

Commit

Permalink
Some more cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Oct 10, 2023
1 parent 865806b commit 9ef2afe
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/rebuild-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ jobs:
git config --global user.name "CI"
git config --global user.email "[email protected]"
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.sfd-*
index.html
index.html
chars.txt
36 changes: 34 additions & 2 deletions compile.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
|#
Expand All @@ -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))))
Expand All @@ -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)))
5 changes: 4 additions & 1 deletion index.ctml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@
<h1>
PromptFont
<a class="button" href="https://github.com/Shinmera/promptfont/">GitHub</a>
<a class="button" href="https://github.com/Shinmera/promptfont/raw/master/PromptFont.otf">Download</a>
<a class="button" href="PromptFont.otf">OpenType</a>
<a class="button" href="PromptFont.ttf">TrueType</a>
<a class="button" href="glyphs.json">Metadata JSON</a>
<a class="button" href="chars.txt">Character List</a>
</h1>
<p>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.</p>
<p>PromptFont is based on the Xolonium font by Severin Meyer and licenced under the SIL Open Font Licence.</p>
Expand Down

0 comments on commit 9ef2afe

Please sign in to comment.