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

Tidy up fonts and provide a font installation option #61

Merged
merged 7 commits into from
Dec 6, 2018

Conversation

peterbrittain
Copy link
Collaborator

Hopefully this is the PR to resolve #59

Copy link
Owner

@pwaller pwaller left a comment

Choose a reason for hiding this comment

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

Looks good in general. Nice clear comments. Couple of things need to be addressed?

pyfiglet/__init__.py Outdated Show resolved Hide resolved
pyfiglet/__init__.py Outdated Show resolved Hide resolved
@peterbrittain
Copy link
Collaborator Author

Well that's an interesting one @pwaller... I only test as far back as 2.7 and don't have python 2.6 installed anywhere.

I guess I can nest the with statements or drop python 2.6 support. Let me know which works for you.

@pwaller
Copy link
Owner

pwaller commented Dec 4, 2018

I guess I can nest the with statements or drop python 2.6 support. Let me know which works for you.

The rationale I would take is "Let's not drop support for a version just for a want of a single extra statement and a bit of extra nesting". It would be frustrating to "almost have support", I think, given that the level of pain to have the support is minimal.

@peterbrittain
Copy link
Collaborator Author

If 2.6 was still supported, I'd totally agree. However, it went EOL years ago (https://www.python.org/download/releases/2.6.9/), so I thought this might be a good time to remove support. No worries - I'll push an update shortly.

@pwaller
Copy link
Owner

pwaller commented Dec 4, 2018

Thanks for working with me on this. I'm afraid it only has a tiny portion of my focus because it is a spare time project, so there may yet be a bit more slogging. I hope we can complete this within the next week or so. Please keep pinging me if I go silent, and you have my apologies in advance.

I still need to test this. If anyone else wants to chime in that they're able to test it and it WorksForThem™, then that will help with completing this.

On that front, it occurs to me that I can't find any instructions which tell someone (or me) how to use this new flag. Could you please update the PR body so that it is self standing and also contemplate adding details to the README? Ideally it should cover at least:

@pwaller
Copy link
Owner

pwaller commented Dec 5, 2018

Thanks for that - do we want to include some links as to where you can find fonts?

@peterbrittain
Copy link
Collaborator Author

OK - I've updated the README. As for testing? I've run this code on:

  • Windows 10, Python 3.4
    • Upload single font to a site-packages
    • Upload single font to shared directory (due to zipped egg install)
  • Centos 7, Python 2.7
    • Upload single font and zip file to site-packages
    • Upload single font and zip file to shared directory

Good to go?

@pwaller
Copy link
Owner

pwaller commented Dec 5, 2018

I guess you might have missed my above comment, between your commit and your comment?

@peterbrittain
Copy link
Collaborator Author

Yup - that just appeared in my notifications... Now done.

@pwaller
Copy link
Owner

pwaller commented Dec 5, 2018

I tried installing the jave fonts from http://www.jave.de/figlet/figletfonts40.zip, and doing pyfiglet -L figletfonts40.zip, but what I find is that I end up with zip-compressed fonts in my installation directory, which don't work.

pyfiglet/fonts$ file wavy.flf
wavy.flf: Zip archive data, at least v1.0 to extract

Do you have the same behaviour?

$ pyfiglet -f wow a quick brown fox
Traceback (most recent call last):
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 230, in loadFont
    raise FontError('%s is not a valid figlet font' % self.font)
pyfiglet.FontError: wow is not a valid figlet font

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pwaller/.local/bin/pyfiglet", line 11, in <module>
    load_entry_point('pyfiglet', 'console_scripts', 'pyfiglet')()
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 922, in main
    justify=opts.justify, width=opts.width,
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 787, in __init__
    self.setFont()
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 794, in setFont
    self.Font = FigletFont(font=self.font)
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 120, in __init__
    self.loadFont()
  File "/home/pwaller/.local/src/github.com/pwaller/pyfiglet/pyfiglet/__init__.py", line 313, in loadFont
    raise FontError('problem parsing %s font: %s' % (self.font, e))
pyfiglet.FontError: problem parsing wow font: wow is not a valid figlet font

@peterbrittain
Copy link
Collaborator Author

Hmm... I didn't use that zip file for my testing. Looks like all the figlet fonts are actually also zip files and need decoding to plain text, despite their file extensions.

@pwaller pwaller mentioned this pull request Dec 6, 2018
@pwaller
Copy link
Owner

pwaller commented Dec 6, 2018

Hmm. That is surprising! Maybe the solution to that is to have pyfiglet understand compressed fonts. I've filed that separately.

#63

@pwaller pwaller merged commit 0632986 into pwaller:master Dec 6, 2018
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.

Fonts don't have a suitable license for distribution
2 participants