AstroJacobLi / smplotlib

Matplotlib template for SuperMongo style 🔭
MIT License
124 stars 8 forks source link

fixing the Complex Heavy TTF font #2

Closed yangcht closed 1 year ago

yangcht commented 1 year ago

Hey! I found a bug in my TTF font for the set Complex Heavy. I fixed it, and you might want to update the font. https://github.com/yangcht/Hershey_font_TTF

AstroJacobLi commented 1 year ago

Hey Chentao! Thanks for letting me know! I'll update it shortly 😄

AstroJacobLi commented 1 year ago

@yangcht When I'm trying to add the new fonts, I find that matplotlib font_manager cannot correctly find Complex Heavy if I ask it to search following font_manager.findfont('AVHershey Complex:heavy'). It returns AVHersheyComplexMedium.ttf. Below is the code I use:

pkg_path = '/Users/jiaxuanl/Dropbox (Princeton)/Research/SideProjects/Hershey_font_TTF'
import matplotlib.font_manager as font_manager
for font in font_manager.findSystemFonts(pkg_path):
    print(font)
    font_manager.fontManager.addfont(font)

print(font_manager.findfont('AVHershey Complex:heavy'))

It returns '/Users/jiaxuanl/Dropbox (Princeton)/Research/Packages/smplotlib/src/smplotlib/ttf/AVHersheyComplexMedium.ttf'

Moreover, font_manager.findfont('AVHershey Complex:heavy:italic') gives AVHersheyComplexHeavy.ttf, but not AVHersheyComplexHeavyItalic.ttf.

Any thoughts?? Thanks!

yangcht commented 1 year ago

Thanks for finding out about this bug. I think there was a mistake in setting up Complex Heavy. I have fixed it and updated it. Now I think it should be fine according to the list below.

AVHersheySimplexLight.ttf: AVHershey Simplex:style=Light,Regular
AVHersheySimplexMedium.ttf: AVHershey Simplex:style=Medium,Regular
AVHersheySimplexHeavy.ttf: AVHershey Simplex:style=Heavy,Bold
AVHersheySimplexLightItalic.ttf: AVHershey Simplex:style=Light Italic,Italic
AVHersheySimplexMediumItalic.ttf: AVHershey Simplex:style=Medium Italic,Italic
AVHersheySimplexHeavyItalic.ttf: AVHershey Simplex:style=Heavy Italic,Bold Italic

AVHersheyComplexLight.ttf: AVHershey Complex:style=Light,Regular
AVHersheyComplexMedium.ttf: AVHershey Complex:style=Medium,Regular
AVHersheyComplexHeavy.ttf: AVHershey Complex:style=Heavy,Bold
AVHersheyComplexLightItalic.ttf: AVHershey Complex:style=Light Italic,Italic
AVHersheyComplexMediumItalic.ttf: AVHershey Complex:style=Medium Italic,Italic
AVHersheyComplexHeavyItalic.ttf: AVHershey Complex:style=Heavy Italic,Bold Italic

AVHersheyDuplexLight.ttf: AVHershey Duplex:style=Light,Regular
AVHersheyDuplexMedium.ttf: AVHershey Duplex:style=Medium,Regular
AVHersheyDuplexHeavy.ttf: AVHershey Duplex:style=Heavy,Bold
AVHersheyDuplexLightItalic.ttf: AVHershey Duplex:style=Light Italic,Italic
AVHersheyDuplexMediumItalic.ttf: AVHershey Duplex:style=Medium Italic,Italic
AVHersheyDuplexHeavyItalic.ttf: AVHershey Duplex:style=Heavy Italic,Bold Italic
AstroJacobLi commented 1 year ago

Okay, now it works very well!! Thanks so much for making these files available! I'll close the issue. 🤞