Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default font's spacing on mac incorrect #34

Closed
sbrugman opened this issue Sep 23, 2021 · 6 comments
Closed

Default font's spacing on mac incorrect #34

sbrugman opened this issue Sep 23, 2021 · 6 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@sbrugman
Copy link
Contributor

Default font

Compare with courier new

Courier New

Relevant code:

with ts.explain(fontname="Courier New"):
    y = np.multiply.outer(x, np.arange(2.0))
@parrt
Copy link
Owner

parrt commented Sep 23, 2021

Weird. is Consolas font installed on your system? Is it Intel or M1?

@parrt parrt added the bug Something isn't working label Sep 23, 2021
@sbrugman
Copy link
Contributor Author

sbrugman commented Sep 27, 2021

Consolas wasn't installed in my environment (Intel). The fallback font is "Dejavu Sans", which fails to display the code as seen above.

Advising users to install the font may involve recreating the environment etc. An alternative solution to consider is to explicitly specify a fallback font. This is much more user friendly in my opinion at nearly no burden on the package. For instance, "DejaVu Sans Mono" works well. This can be trivially achieved providing a sequence of font names:

@parrt
Copy link
Owner

parrt commented Sep 27, 2021

agreed this is a good change. I guess your PR only sets the arg default, but there's no code to fall back to the indicated font. Font name is now a tuple by default, which is really a comment for the developer. Shouldn't there be logic to check for font installations and use one that works?

@sbrugman
Copy link
Contributor Author

sbrugman commented Sep 27, 2021

Matplotlib handles all that logic, this PR just changes the default:

WARNING:matplotlib.font_manager:findfont: Font family ('Consolas', 'Consolas Sans Mono') not found. Falling back to DejaVu Sans.

@parrt
Copy link
Owner

parrt commented Sep 27, 2021

You are kidding me!? Wow. that's insane. You just took me to school!

@parrt parrt added the enhancement New feature or request label Sep 27, 2021
@parrt parrt added this to the 0.1.3 milestone Sep 27, 2021
@parrt
Copy link
Owner

parrt commented Sep 27, 2021

By the way gotta use "Fixes #34" not "Fix for #34" to get autoclose. :)

@parrt parrt closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants