Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65a4c0b

Browse files
committed
Add latin modern math font
1 parentb259094 commit65a4c0b

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

‎lib/matplotlib/_mathtext.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ def __init__(self, *args, **kwargs):
479479
font_cls= {'stix':StixFonts,
480480
'stixsans':StixSansFonts,
481481
'cm':BakomaFonts,
482-
'lm':LatinModernFonts
483482
}.get(fallback_rc)
484483
self._fallback_font=font_cls(*args,**kwargs)iffont_clselseNone
485484

@@ -649,15 +648,15 @@ class LatinModernFonts(UnicodeFonts):
649648
'rm':'Latin Modern Roman',
650649
'bf':'Latin Modern Roman:weight=bold',
651650
'it':'Latin Modern Roman:italic',
652-
'bfit':'Latin Modern Roman:italic:bold'
651+
'bfit':'Latin Modern Roman:italic:bold',
652+
'ex':'Latin Modern Math'
653653
}
654654
_fallback_font=False
655655

656656
def__init__(self,*args,**kwargs):
657657

658658
# This must come first so the backend's owner is set correctly
659659
self.fontmap= {}
660-
self.bakoma=BakomaFonts(*args,**kwargs)
661660
TruetypeFonts.__init__(self,*args,**kwargs)
662661

663662
forkey,nameinself._fontmap.items():
@@ -666,14 +665,13 @@ def __init__(self, *args, **kwargs):
666665
self.fontmap[name]=fullpath
667666

668667
def_get_glyph(self,fontname,font_class,sym):
669-
670668
uniindex=get_unicode_index(sym)
671-
font=self._get_font('ex')
669+
font=self._get_font(fontname)
672670
iffontisnotNone:
673671
glyphindex=font.get_char_index(uniindex)
674672
ifglyphindex!=0:
675-
returnsuper()._get_glyph('ex',font_class,sym)
676-
returnsuper()._get_glyph(fontname,font_class,sym)
673+
returnsuper()._get_glyph(fontname,font_class,sym)
674+
returnsuper()._get_glyph('ex',font_class,sym)
677675

678676

679677
classDejaVuSansFonts(DejaVuFonts):
Binary file not shown.

‎lib/matplotlib/tests/test_mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
245245
@pytest.mark.parametrize(
246246
'index, text',enumerate(font_tests),ids=range(len(font_tests)))
247247
@pytest.mark.parametrize(
248-
'fontset', ['cm','stix','stixsans','dejavusans','dejavuserif'])
248+
'fontset', ['cm','stix','stixsans','dejavusans','dejavuserif','lm'])
249249
@pytest.mark.parametrize('baseline_images', ['mathfont'],indirect=True)
250250
@image_comparison(baseline_images=None,extensions=['png'],
251251
tol=0.011ifplatform.machine()in ('ppc64le','s390x')else0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp