aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2019-08-07 08:49:07 +0200
committerRobert Alessi <alessi@robertalessi.net>2019-08-07 08:49:07 +0200
commitd81410bb506e5627d3529b1cd1467a0610d3fdae (patch)
tree4cc2d883006aaf3c1a92917a7e650eefd9d813d6
parent0a7b11d11360cac5b20f29da6bca28cc3f5f3ffb (diff)
downloadoldstandard-d81410bb506e5627d3529b1cd1467a0610d3fdae.tar.gz
added font table
-rw-r--r--fonttable.lua36
-rw-r--r--fonttable.tex30
-rw-r--r--makefile5
3 files changed, 70 insertions, 1 deletions
diff --git a/fonttable.lua b/fonttable.lua
new file mode 100644
index 0000000..d50a314
--- /dev/null
+++ b/fonttable.lua
@@ -0,0 +1,36 @@
1-- the following is adapted from https://tex.stackexchange.com/a/380780
2ft = {}
3function ft.print_glyphs(maxCols,maxChars)
4 local id = font.current()
5 local fnt = font.getfont(id)
6 local col = 1
7 local maxU4 = 15*(16^3+16^2+16+1)
8 a = {}
9 for k, v in pairs(fnt.characters) do
10 a [#a + 1] = k
11 end
12 table.sort(a)
13 for i, k in ipairs(a) do
14 if i >= maxChars then break end
15 if col == 1 then
16 if k > maxU4 then
17 tex.sprint(string.format("U+%06x", k))
18 else
19 tex.sprint(string.format("U+%04x", k))
20 end
21 tex.sprint("&")
22 end
23 if (i) then
24 tex.sprint(string.format([[\char%i]], k))
25 else
26 tex.sprint("~")
27 end
28 if col == maxCols then
29 tex.sprint([[\\\cline{2-]] .. maxCols+1 .. "} ")
30 col = 1
31 else
32 tex.sprint("&")
33 col = col + 1
34 end
35 end
36end
diff --git a/fonttable.tex b/fonttable.tex
new file mode 100644
index 0000000..f1b2814
--- /dev/null
+++ b/fonttable.tex
@@ -0,0 +1,30 @@
1\documentclass[12pt]{article}
2\usepackage{fontspec}
3
4\usepackage{array}
5\usepackage{longtable}
6\usepackage{latexcolors}
7
8\usepackage{luacode}
9\luadirect{require("fonttable.lua")}
10
11\setmainfont{Old Standard}
12
13\title{\textsc{Old Standard}}
14\author{Font Table}
15\date{}
16
17\begin{document}
18\maketitle
19
20\color{cinnamon}
21
22\begin{longtable}{>{\color{gray}\ttfamily\footnotesize}r|
23 *{10}{>{\color{black}}p{1.5em}|}}
24\cline{2-11}
25\endhead
26
27\luadirect{ft.print_glyphs(10,65463)} \\ \cline{2-11}
28\end{longtable}
29
30\end{document} \ No newline at end of file
diff --git a/makefile b/makefile
index a7b8032..5c34fdf 100644
--- a/makefile
+++ b/makefile
@@ -10,6 +10,9 @@ doc: local
10 biber $(pkg) >/dev/null 10 biber $(pkg) >/dev/null
11 lualatex --shell-escape $(pkg).tex >/dev/null 11 lualatex --shell-escape $(pkg).tex >/dev/null
12 lualatex --shell-escape $(pkg).tex >/dev/null 12 lualatex --shell-escape $(pkg).tex >/dev/null
13 @echo "Building font table..."
14 lualatex --shell-escape fonttable.tex >/dev/null
15 lualatex --shell-escape fonttable.tex >/dev/null
13 @echo "Removing OldStandard .otf files from $(LOCALFONTDIR)..." 16 @echo "Removing OldStandard .otf files from $(LOCALFONTDIR)..."
14 rm -f $(LOCALFONTDIR)/OldStandard-*.otf 17 rm -f $(LOCALFONTDIR)/OldStandard-*.otf
15 luaotfload-tool --update 18 luaotfload-tool --update
@@ -26,7 +29,7 @@ local:
26 29
27package: doc 30package: doc
28 mkdir $(pkg)-$(ver) 31 mkdir $(pkg)-$(ver)
29 cp *.{txt,md,tex,pdf} $(pkg)-$(ver) 32 cp *.{txt,md,lua,tex,pdf} $(pkg)-$(ver)
30 cp otf/*.otf $(pkg)-$(ver) 33 cp otf/*.otf $(pkg)-$(ver)
31 tar czf $(pkg)-$(ver).tar.gz $(pkg)-$(ver) 34 tar czf $(pkg)-$(ver).tar.gz $(pkg)-$(ver)
32 @echo "$(pkg)-$(ver).tar.gz has been created." 35 @echo "$(pkg)-$(ver).tar.gz has been created."