|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +import os, sys, re |
| 4 | + |
| 5 | +import gc |
| 6 | + |
| 7 | +stests = [ |
| 8 | + r'$\mathcircled{123} \mathrm{\mathcircled{123}} \mathbf{\mathcircled{123}}$', |
| 9 | + r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \mathbf{\mathsf{Sans \Omega}}$', |
| 10 | + r'$\mathtt{Monospace}$', |
| 11 | + r'$\mathcal{CALLIGRAPHIC}$', |
| 12 | + r'$\mathbb{Blackboard \pi}$', |
| 13 | + r'$\mathrm{\mathbb{Blackboard \pi}}$', |
| 14 | + r'$\mathbf{\mathbb{Blackboard \pi}}$', |
| 15 | + r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', |
| 16 | + r'$\mathscr{Script}$', |
| 17 | + ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' |
| 18 | + ] |
| 19 | + |
| 20 | +from pylab import * |
| 21 | + |
| 22 | +def doall(): |
| 23 | + tests = stests |
| 24 | + |
| 25 | + figure(figsize=(8, (len(tests) * 1) + 2)) |
| 26 | + plot([0, 0], 'r') |
| 27 | + grid(False) |
| 28 | + axis([0, 3, -len(tests), 0]) |
| 29 | + yticks(arange(len(tests)) * -1) |
| 30 | + for i, s in enumerate(tests): |
| 31 | + print (i, s) |
| 32 | + text(0.1, -i, s, fontsize=32) |
| 33 | + |
| 34 | + savefig('stix_fonts_example') |
| 35 | + #close('all') |
| 36 | + show() |
| 37 | + |
| 38 | +if '--latex' in sys.argv: |
| 39 | + fd = open("stix_fonts_examples.ltx", "w") |
| 40 | + fd.write("\\documentclass{article}\n") |
| 41 | + fd.write("\\begin{document}\n") |
| 42 | + fd.write("\\begin{enumerate}\n") |
| 43 | + |
| 44 | + for i, s in enumerate(stests): |
| 45 | + s = re.sub(r"(?<!\\)\$", "$$", s) |
| 46 | + fd.write("\\item %s\n" % s) |
| 47 | + |
| 48 | + fd.write("\\end{enumerate}\n") |
| 49 | + fd.write("\\end{document}\n") |
| 50 | + fd.close() |
| 51 | + |
| 52 | + os.system("pdflatex stix_fonts_examples.ltx") |
| 53 | +else: |
| 54 | + doall() |
0 commit comments