|
5 | 5 |
|
6 | 6 | """
|
7 | 7 |
|
8 |
| -import subprocess |
9 |
| -import sys |
10 |
| -import re |
11 |
| -import gc |
12 | 8 | import matplotlib.pyplot as plt
|
13 | 9 | import numpy as np
|
14 | 10 |
|
15 |
| -stests = [ |
| 11 | +tests = [ |
16 | 12 | r'$\mathcircled{123} \mathrm{\mathcircled{123}}'
|
17 | 13 | r' \mathbf{\mathcircled{123}}$',
|
18 | 14 | r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}}'
|
|
25 | 21 | r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$',
|
26 | 22 | r'$\mathscr{Script}$']
|
27 | 23 |
|
28 |
| -if sys.maxunicode > 0xffff: |
29 |
| - s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' |
30 | 24 |
|
| 25 | +plt.figure(figsize=(8, (len(tests) * 1) + 2)) |
| 26 | +plt.plot([0, 0], 'r') |
| 27 | +plt.axis([0, 3, -len(tests), 0]) |
| 28 | +plt.yticks(-np.arange(len(tests))) |
| 29 | +for i, s in enumerate(tests): |
| 30 | + plt.text(0.1, -i, s, fontsize=32) |
31 | 31 |
|
32 |
| -def doall(): |
33 |
| - tests = stests |
34 |
| - |
35 |
| - plt.figure(figsize=(8, (len(tests) * 1) + 2)) |
36 |
| - plt.plot([0, 0], 'r') |
37 |
| - plt.grid(False) |
38 |
| - plt.axis([0, 3, -len(tests), 0]) |
39 |
| - plt.yticks(np.arange(len(tests)) * -1) |
40 |
| - for i, s in enumerate(tests): |
41 |
| - plt.text(0.1, -i, s, fontsize=32) |
42 |
| - |
43 |
| - plt.savefig('stix_fonts_example') |
44 |
| - plt.show() |
45 |
| - |
46 |
| - |
47 |
| -if '--latex' in sys.argv: |
48 |
| - fd = open("stix_fonts_examples.ltx", "w") |
49 |
| - fd.write("\\documentclass{article}\n") |
50 |
| - fd.write("\\begin{document}\n") |
51 |
| - fd.write("\\begin{enumerate}\n") |
52 |
| - |
53 |
| - for i, s in enumerate(stests): |
54 |
| - s = re.sub(r"(?<!\\)\$", "$$", s) |
55 |
| - fd.write("\\item %s\n" % s) |
56 |
| - |
57 |
| - fd.write("\\end{enumerate}\n") |
58 |
| - fd.write("\\end{document}\n") |
59 |
| - fd.close() |
60 |
| - |
61 |
| - subprocess.call(["pdflatex", "stix_fonts_examples.ltx"]) |
62 |
| -else: |
63 |
| - doall() |
| 32 | +plt.show() |
0 commit comments