Recently Written · git

alt-hack0

The Hack font family with a non-weird zero, and other variants.

git clone https://github.com/equwal/alt-hack0

Log | Files | Refs


commit 2ef7da977eec04f4c9dab41074d8b26a18235564
Spenser Truex <web@spensertruex.com>
2019-11-18 17:08:17 -0800

Roswell (not working yet) script and symlinks.

 generator.ros | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 glyphs        |   1 +
 hack          |   1 +
 source        |   1 +
 tt-hinting    |   1 +
 5 files changed, 121 insertions(+)
diff --git a/generator.ros b/generator.ros
new file mode 100755
index 0000000..deb203c
--- /dev/null
+++ b/generator.ros
@@ -0,0 +1,117 @@
+#!/bin/sh
+#|-*- mode:lisp -*-|#
+#|
+exec ros -Q -- $0 "$@"
+|#
+(progn ;;init forms
+  (ros:ensure-asdf)
+  #+quicklisp(ql:quickload '(:alexandria :str :uiop) :silent t)
+  (asdf:load-system :utils) ;My utilities, has the COLLECT macro.
+  )
+
+(defpackage :ros.script.generator.3783095582
+  (:use :cl :alexandria)
+  (:import-from :str :concat)
+  (:import-from :utils :collect :group)
+  (:import-from
+   :uiop
+   :directory-files
+   :subdirectories
+   :launch-program))
+(in-package :ros.script.generator.3783095582)
+;;; Uses a magic symlinks to deal with directories. Make sure they exist in your
+;;; toplevel:
+;;; - tt-hinting (in hack/post_processing)
+;;; - glyphs (in alt-hack)
+;;; - source (in hack)
+;;; - hack
+(defvar *weights* '("Bold" "BoldItalic" "Italic" "Regular"))
+
+(defun canonicalize-groups (groups)
+  (loop for g in groups
+        collect (mapcar #'car (group g 2))))
+(defvar *groups* (canonicalize-groups
+                  '(("u0028-curved" "("
+                     "u0028-rounder" "("
+                     "u0029-curved" ")"
+                     "u0029-rounder" ")")
+                    ("u0030-backslash" "0"
+                     "u0030-diamond" "0"
+                     "u0030-dotted" "0"
+                     "u0030-forwardslash" "0")
+                    ("u0031-noslab" "1")
+                    ("u0033-flattop" "3")
+                    ("u003C-wider" "<")
+                    ("u003E-wider" ">")
+                    ("u0066-knife" "f")
+                    ("u0069-slab" "i"
+                     "u00EC-slab" "ì"
+                     "u00ED-slab" "í"
+                     "u00EE-slab" "î"
+                     "u00EF-slab" "ï"
+                     "u0129-slab" "ĩ"
+                     "u012B-slab" "ī"
+                     "u012D-slab" "ĭ"
+                     "u012F-slab" "į"
+                     "u0131-slab" "ı"
+                     "u0456-slab" "і"
+                     "u0457-slab" "ї")))
+  "Things you actually want to permute together.")
+
+(defun pprint-letters (letter-alist)
+  (dolist (p letter-alist)
+    (format t "~S ~S~%"
+            (car p) (string (cdr p)))))
+
+(defun show-characters ()
+  (let ((dirs (subdirectories "glyphs")))
+    (pprint-letters
+     (collect (d dirs)
+       (let ((mat (car (last (pathname-directory d)))))
+         (cons mat
+               (code-char (read (make-string-input-stream
+                                 (concat "#x"
+                                         (subseq mat 1 (search "-" mat))))))))))))
+
+(defun help ()
+  (format t "~@{~A~%~}"
+          "generator.ros {ALT-GLYPH-DIRNAME+ | show}"
+          "`show' demonstrates each variant code with its character."
+          "ALT-GLYPH-DIRNAME is something like u0028-curved"
+          "Each glyph is put into the hack directory."))
+(defun remove-hints ()
+  (let ((files (uiop:directory-files #P"tt-hinting")))
+    (dolist (f files)
+      (with-open-file (s f :direction :io)
+        (let ((line (read-line s nil nil)))
+          (when (and line (char/= #\#(elt line 0)))
+            (write-line (format nil "# ~S~%" line) s)))))))
+
+(defun put-glyphs (ufolders)
+  (dolist (arg ufolders)
+    (dolist (weight *weights*)
+      (launch-program (concat "cp " "glyphs/" arg "/"
+                              (string-downcase weight)
+                              "/*" " " "source/Hack-" weight
+                              ".ufo/glyphs/")))))
+(defun build (permutation)
+  (put-glyphs permutation)
+  (launch-program "make ttf && make woff"
+                  :directory #P"hack"))
+
+(defun main (&rest argv)
+  (declare (ignorable argv))
+  (cond ((null argv) (help)
+         (sb-ext:exit :code 0))
+        ((string-equal (first argv) "show")
+         (print (show-characters))
+         (sb-ext:exit :code 0)))
+  (progn (remove-hints)
+         (map-permutations (compose #'build #'flatten) *groups*)))
+
+
+
+
+
+
+;;; vim: set ft=lisp lisp:
diff --git a/glyphs b/glyphs
new file mode 120000
index 0000000..b44b72b
--- /dev/null
+++ b/glyphs
@@ -0,0 +1 @@
+/home/jose/src/github.com/source-foundry/alt-hack/glyphs/
\ No newline at end of file
diff --git a/hack b/hack
new file mode 120000
index 0000000..535ab1c
--- /dev/null
+++ b/hack
@@ -0,0 +1 @@
+/home/jose/src/github.com/source-foundry/hack
\ No newline at end of file
diff --git a/source b/source
new file mode 120000
index 0000000..4df09a0
--- /dev/null
+++ b/source
@@ -0,0 +1 @@
+/home/jose/src/github.com/source-foundry/hack/source/
\ No newline at end of file
diff --git a/tt-hinting b/tt-hinting
new file mode 120000
index 0000000..3a4409a
--- /dev/null
+++ b/tt-hinting
@@ -0,0 +1 @@
+/home/jose/src/github.com/source-foundry/hack/postbuild_processing/tt-hinting
\ No newline at end of file