|
16 | 16 |
|
17 | 17 | s = r'$\mathcal{R}\prod_{i=\alpha\mathcal{B}}^\infty a_i\sin(2 \pi f x_i)$'
|
18 | 18 |
|
19 |
| - The fonts \cal, \rm, \it, and \tt are allowed. |
| 19 | + Different fonts may be selected: |
| 20 | + \mathcal Calligraphic fonts |
| 21 | + \mathrm Roman (upright) font |
| 22 | + \mathit Italic font |
| 23 | + \mathtt Typewriter (monospaced) font, similar to Courier |
| 24 | +
|
| 25 | + Additionally, if using the STIX fonts: |
| 26 | + \mathbb Blackboard (double-struck) font |
| 27 | + \mathcircled Circled characters |
| 28 | + \mathfrak Fraktur (Gothic-style) font |
| 29 | + \mathscr Script (cursive) font |
| 30 | + \mathsf Sans-serif font |
20 | 31 |
|
21 | 32 | The following accents are provided: \hat, \breve, \grave, \bar,
|
22 | 33 | \acute, \tilde, \vec, \dot, \ddot. All of them have the same
|
@@ -539,10 +550,7 @@ def _get_font(self, font):
|
539 | 550 |
|
540 | 551 | cached_font = self._fonts.get(basename)
|
541 | 552 | if cached_font is None:
|
542 |
| - try: |
543 |
| - font = FT2Font(basename) |
544 |
| - except RuntimeError: |
545 |
| - return None |
| 553 | + font = FT2Font(basename) |
546 | 554 | cached_font = self.CachedFont(font)
|
547 | 555 | self._fonts[basename] = cached_font
|
548 | 556 | self._fonts[font.postscript_name] = cached_font
|
@@ -650,13 +658,20 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
|
650 | 658 | if fontname in self.fontmap and latex_to_bakoma.has_key(sym):
|
651 | 659 | basename, num = latex_to_bakoma[sym]
|
652 | 660 | slanted = (basename == "cmmi10") or sym in self._slanted_symbols
|
653 |
| - cached_font = self._get_font(basename) |
654 |
| - symbol_name = cached_font.font.get_glyph_name(num) |
655 |
| - num = cached_font.glyphmap[num] |
| 661 | + try: |
| 662 | + cached_font = self._get_font(basename) |
| 663 | + except RuntimeError: |
| 664 | + pass |
| 665 | + else: |
| 666 | + symbol_name = cached_font.font.get_glyph_name(num) |
| 667 | + num = cached_font.glyphmap[num] |
656 | 668 | elif len(sym) == 1:
|
657 | 669 | slanted = (fontname == "it")
|
658 |
| - cached_font = self._get_font(fontname) |
659 |
| - if cached_font is not None: |
| 670 | + try: |
| 671 | + cached_font = self._get_font(fontname) |
| 672 | + except RuntimeError: |
| 673 | + pass |
| 674 | + else: |
660 | 675 | num = ord(sym)
|
661 | 676 | gid = cached_font.charmap.get(num)
|
662 | 677 | if gid is not None:
|
@@ -793,9 +808,12 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
|
793 | 808 | new_fontname = 'rm'
|
794 | 809 |
|
795 | 810 | slanted = (new_fontname == 'it') or sym in self._slanted_symbols
|
796 |
| - cached_font = self._get_font(new_fontname) |
797 | 811 | found_symbol = False
|
798 |
| - if cached_font is not None: |
| 812 | + try: |
| 813 | + cached_font = self._get_font(new_fontname) |
| 814 | + except RuntimeError: |
| 815 | + pass |
| 816 | + else: |
799 | 817 | try:
|
800 | 818 | glyphindex = cached_font.charmap[uniindex]
|
801 | 819 | found_symbol = True
|
|
0 commit comments