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

Fix bug when no fonts are available #871

Merged
merged 6 commits into from
Jul 16, 2021
Merged

Conversation

aaronayres35
Copy link
Contributor

@aaronayres35 aaronayres35 commented Jul 14, 2021

This PR will fix #870

Currently it only includes a failing regression test. Current plan for a fix is to include a basic freely licensed font with kiva that can be used as a default if we can't find anything else. EDIT: I've added a quick fix of using a TestTTF.ttf font we already had included in the package for testing as the default if we can't find any other fonts. This prevents the failure, but we may want to include a more legitimate default with the package? TBH I don't know very much at all about fonts / ttf so I'm not sure what would make a good default here.

@rahulporuri rahulporuri changed the title [WIP] Fix bug when no fonts are available Fix bug when no fonts are available Jul 15, 2021
@rahulporuri
Copy link
Contributor

I've removed the WIP label.

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should raise a warning here as suggested by @rahulporuri in #870

kiva/fonttools/font_manager.py Outdated Show resolved Hide resolved
kiva/fonttools/tests/test_font_manager.py Outdated Show resolved Hide resolved
@jwiggins
Copy link
Member

Celiagg includes the free Montserrat font.

@jwiggins
Copy link
Member

Due to the new file, you will also need to update:

  • font_LICENSE.txt
  • MANIFEST.in
  • setup.py

@aaronayres35
Copy link
Contributor Author

Thanks @jwiggins!

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would test the packaging, but otherwise LGTM

@aaronayres35
Copy link
Contributor Author

I built an sdist and saw the font file was included as expected. I then pip installed the sdist in a fresh env and ran the test added here which passed (ie the font was available). Gonna go ahead and merge now

@aaronayres35 aaronayres35 merged commit 5017799 into master Jul 16, 2021
@aaronayres35 aaronayres35 deleted the fix-no-available-fonts branch July 16, 2021 16:00
@jwiggins
Copy link
Member

Thanks for the quick fix here @aaronayres35

aaronayres35 added a commit that referenced this pull request Jul 16, 2021
* add a failing regression test

* make test pass with a 'fix' of using a TestTTF font already available in the package

* use default font from celiagg and update test

* actually add the ttf file and license

* move license to LICENSES folder rather than directly next to font file

* update manifest.in setup.py and font_license.txt
@rahulporuri rahulporuri mentioned this pull request Jul 19, 2021
aaronayres35 added a commit that referenced this pull request Jul 19, 2021
* add a failing regression test

* make test pass with a 'fix' of using a TestTTF font already available in the package

* use default font from celiagg and update test

* actually add the ttf file and license

* move license to LICENSES folder rather than directly next to font file

* update manifest.in setup.py and font_license.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font machinery crashes hard when no fonts are available on a machine
3 participants