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
Template and fonts fixes #843
Conversation
704c9c4
to
3f79dc9
Compare
Updated commit message in the second commit with exact error |
Thanks @pshchelo. Are you able to create a test that fails without the changes applied and then passes when they are? |
@akrabat haven't looked at how tests are done in the repo yet, but will try to come up with something |
Came out with a test for #601 , working on font loading one. @akrabat what is your preferred process re git history? Should I add tests to each corresponding commit, or create a separate commits with tests and place them before the commits with fixes in the PR so that you can checkout only tests commits and see that they are failing? Travis will then check that they are working with fixes.. |
Separate commits please. Order would be convenient, but not strictly necessary. |
sphinx conf.py set to use cover page and non-existing cover template, will fail to load the default fallback template (issue rst2pdf#601). also add two dummy non-font TTF files to fail some tests that are loading fonts from the input folder. This in fact is a bit random due to how os.walk/os.listdir works, (see https://docs.python.org/3/library/os.html#os.listdir). To maximize chances of failure one dummy ttf file name starts with 0, and another with Z (not an ideal and stable solution, but is the best I could quickly think of).
Fixes issue rst2pdf#601 seems this logging code line was copy-pasted from createpdf.py, and now fallback fails as it can not output log message as the object has no 'custom_resource' attribute
currently TTFError exceptions raised in loadFonts() result in UnboundLocalError: local variable 'font' referenced before assignment on the next line as the execution continues further. Just skip to next font after producing the warning log.
3f79dc9
to
722ebc5
Compare
tests added, the one for font loading may not be ideal (as the order of files in os.walk is not guaranteed), but is the best I could quickly think of |
@akrabat plz review I bet the issue with font loading can affect multiple users.
Depending on the order in which Python's |
The generated PDF has to be consisted each time, so we set the date printed on the cover page to a specific date rather than using today's date.
Fixes issue #601 and failures to load fonts