GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — Fix glyphs for angle brackets by devRD · Pull Request #26518 · matplotlib/matplotlib Conversation
Contributor
PR summaryFixes #18740 PR checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
ksunden
approved these changes
|
There was an error while loading. Please reload this page.
|
I'm not sure about the spacing of the result. The rightmost side of the left angle appears to be half as close as the leftmost side of the right angle. For the first three examples, it's about 1 vs 2 pixels, while about 2 vs 4 on the rightmost largest one. If you take your test and call it with only @image_comparison(baseline_images=['math_angle_brackets.png']*2) def test_math_angle_brackets(): tests = [ r'$\left< x \right>$', r'$\left< ? \right>$', r'$\left< \frac{1}{2}\right>$', r'$\left< \frac{\sum_{0}^{1}}{2}\right>$', r'$\left<\frac{\sum_{0}^{1}}{\sum_{0}^{1}}\right>$' ] for left, right in [('<', '>'), (r'\langle', r'\rangle')]: fig = plt.figure(figsize=(5, 1)) for idx, text in enumerate(tests): fig.text((idx + 0.3)/len(tests), 0.5, text.replace('<', left).replace('>', right), math_fontfamily='cm') |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I reverted the changes and tested the code again. The misalignment appears due to the missing sizing of the angle brackets, but reordering the sizing for the glyphs following this diff, generates the following image, which seems to be centered(?) with --- a/lib/matplotlib/_mathtext.py +++ b/lib/matplotlib/_mathtext.py @@ -419,10 +419,10 @@ class BakomaFonts(TruetypeFonts): ('ex', '\xbb'), ('ex', '\x26')], r'\rceil': [('ex', '\xa8'), ('ex', '\x6d'), ('ex', '\xbc'), ('ex', '\x27')], - r'\langle': [('ex', '\xad'), ('ex', '\x44'), - ('ex', '\xbf')], - r'\rangle': [('ex', '\xae'), ('ex', '\x45'), - ('ex', '\xc0')], + r'\langle': [('ex', '\xad'), ('ex', '\x2a'), + ('ex', '\xbf'), ('ex', '\x44')], + r'\rangle': [('ex', '\xae'), ('ex', '\x2b'), + ('ex', '\xc0'), ('ex', '\x45')], r'\__sqrt__': [('ex', '\x70'), ('ex', '\x71'), ('ex', '\x72'), ('ex', '\x73')], r'\backslash': [('ex', '\xb2'), ('ex', '\x2f'), @@ -433,6 +433,8 @@ class BakomaFonts(TruetypeFonts): ('ex', '\x64')], r'\widetilde': [('rm', '\x7e'), ('ex', '\x65'), ('ex', '\x66'), ('ex', '\x67')], + r'<': [('ex', '\x44')], + r'>': [('ex', '\x45')] } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry it's taken a while to get back to this PR. I don't believe it is the correct approach as the glyph order is correct at the moment. The problem is really that the character code gets mapped twice. I've opened #29936 to correct this, which should replace this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Incorrect glyphs selected for angle brackets
There was an error while loading. Please reload this page.