Skip to content

Commit

Permalink
Merge pull request #4274 from mdboom/angstrom
Browse files Browse the repository at this point in the history
FIX : Angstrom symbol rendering
  • Loading branch information
tacaswell committed Apr 12, 2015
2 parents 775b7f4 + 1ed438a commit e262edb
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/matplotlib/_mathtext_data.py
Expand Up @@ -2281,7 +2281,7 @@
'obar' : 9021,
'supseteq' : 8839,
'nu' : 957,
'AA' : 8491,
'AA' : 197,
'AE' : 198,
'models' : 8871,
'ominus' : 8854,
Expand Down
14 changes: 9 additions & 5 deletions lib/matplotlib/mathtext.py
Expand Up @@ -2475,7 +2475,7 @@ def unknown_symbol(self, s, loc, toks):
# The first 2 entires in the tuple are (font, char, sizescale) for
# the two symbols under and over. The third element is the space
# (in multiples of underline height)
r'AA' : ( ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0),
r'AA' : ( ('it', 'A', 1.0), (None, '\circ', 0.5), 0.0),
}

def c_over_c(self, s, loc, toks):
Expand Down Expand Up @@ -2532,7 +2532,8 @@ def c_over_c(self, s, loc, toks):
r'.' : r'\combiningdotabove',
r'^' : r'\circumflexaccent',
r'overrightarrow' : r'\rightarrow',
r'overleftarrow' : r'\leftarrow'
r'overleftarrow' : r'\leftarrow',
r'mathring' : r'\circ'
}

_wide_accents = set(r"widehat widetilde widebar".split())
Expand All @@ -2546,11 +2547,14 @@ def accent(self, s, loc, toks):
raise ParseFatalException("Error parsing accent")
accent, sym = toks[0]
if accent in self._wide_accents:
accent = AutoWidthChar(
accent_box = AutoWidthChar(
'\\' + accent, sym.width, state, char_class=Accent)
else:
accent = Accent(self._accent_map[accent], state)
centered = HCentered([accent])
accent_box = Accent(self._accent_map[accent], state)
if accent == 'mathring':
accent_box.shrink()
accent_box.shrink()
centered = HCentered([Hbox(sym.width / 4.0), accent_box])
centered.hpack(sym.width, 'exactly')
return Vlist([
centered,
Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 141 additions & 0 deletions lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_69.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e262edb

Please sign in to comment.