Coder Social home page Coder Social logo

pyfiglet's Introduction

pyfiglet

                        _|_|  _|            _|              _|
_|_|_|    _|    _|    _|            _|_|_|  _|    _|_|    _|_|_|_|
_|    _|  _|    _|  _|_|_|_|  _|  _|    _|  _|  _|_|_|_|    _|
_|    _|  _|    _|    _|      _|  _|    _|  _|  _|          _|
_|_|_|      _|_|_|    _|      _|    _|_|_|  _|    _|_|_|      _|_|
_|              _|                      _|
_|          _|_|                    _|_|

Synopsis

pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure python. It takes ASCII text and renders it in ASCII art fonts (like the title above, which is the 'block' font).

FAQ

  • Q: Why? WHY?!!

    A: I [cjones] was bored. Really bored.

  • Q: What the hell does this do that FIGlet doesn't?

    A: Not much, except allow your font collection to live in one big zipfile. The point of this code is to embed dynamic figlet rendering in Python without having to execute an external program, although it operates on the commandline as well. See below for USAGE details. You can think of this as a python FIGlet driver.

  • Q: Does this support kerning/smushing like FIGlet?

    A: Yes, yes it does. Output should be identical to FIGlet. If not, this is a bug, which you should report to me!

  • Q: Can I use/modify/redstribute this code?

    A: Yes, under the terms of the MIT (see LICENSE below).

  • Q: I improved this code, what should I do with it?

    A: You can submit changes to https://github.com/pwaller/pyfiglet/pulls. If you make changes to the kerning/mushing/rendering portion, PLEASE test it thoroughly. The code is fragile and complex.

  • Q: Where did my font go?

    A: It turns out that we didn't have distribution rights for some of the fonts and so we had to remove them. Full details of the change and why we did it are in #59.

  • Q: Where can I find these and other fonts?

    A: Do a quick search for "figlet fonts" on your favourite search engine should give you what you need. However, if you are looking for the specific removed fonts, please go to http://www.jave.de/figlet/fonts.html.

  • Q: Why are some fonts missing in distribution?

    A: Some Linux distributions have very strict legal restrictions on what contributions they will take. For these systems, we have divided the fonts into ones that have a clear redistribution license and those that don't. These are the fonts-standard and fonts-contrib directories in this repository.

  • Q: What about those other fonts?

    A: While there isn't a watertight case for the license, we believe that any legal constraint for these fonts has long expired and so they are public domain, so are continuing to redistribute via pypi. If an owner of any of these fonts wants us to stop, please just raise an issue on https://github.com/pwaller/pyfiglet/issues proving your ownership and we will remove the requested fonts.

Usage

You can use pyfiglet in one of two ways. First, it operates on the commandline as C figlet does and supports most of the same options. Run with --help to see a full list of tweaks. Mostly you will only use -f to change the font. It defaults to standard.flf.

tools/pyfiglet 'text to render'

Pyfiglet is also a library that can be used in python code:

from pyfiglet import Figlet
f = Figlet(font='slant')
print(f.renderText('text to render'))

or

import pyfiglet
f = pyfiglet.figlet_format("text to render", font="slant")
print(f)

If you have found some new fonts that you want to use, you can use the command line interface to install your font file as follows:

pyfiglet -L <font file>

The font file can be a ZIP file of lots of fonts or just a single font. Depending on how you installed pyfiglet, you may find that you need root access to install the font - e.g. sudo pyfiglet -L <font file>.

Author

All of the documentation and the majority of the work done was by Christopher Jones ([email protected]) and many other contributors. Packaged by Peter Waller ([email protected]), various enhancements by Stefano Rivera ([email protected]), and lots of help from many contributors!

Thank you all for your efforts, please send a pull request to add yourself to this list if you would like to take credit.

(In the words of the original author) pyfiglet is a port of FIGlet, and much of the code is directly translated from the C source. I optimized some bits where I could, but because the smushing and kerning code is so incredibly complex, it was safer and easier to port the logic almost exactly. Therefore, I can't really take much credit for authorship, just translation. The original authors of FIGlet are listed on their website at http://www.figlet.org/.

The Python port was done by Christopher Jones [email protected] (http://gruntle.org/).

It is currently maintained by Peter Waller ([email protected], github:pwaller)

The toilet fonts (.tlf) were imported from toilet 0.3-1, by Sam Hocevar ([email protected]).

Thanks

Lots of people have helped make pyfiglet what it is but I particularly want to call out.

github:stefanor for various bug fixes and improvements and the debian packaging. github:peterbrittain for helping to close lots of issues.

License

The MIT License (MIT) Copyright © 2007-2023

Christopher Jones <[email protected]>
Stefano Rivera <[email protected]>
Peter Waller <[email protected]>
And various contributors (see git history).

(see LICENSE for full details)

Packaging status

Packaging status

pyfiglet's People

Contributors

aerickson avatar alexey-t avatar aminsoheyli avatar anz-ableton avatar asakasinsky avatar bjornfjohansson avatar drakbar avatar everlanes avatar gl-yziquel avatar grandemk avatar gregorni avatar irskep avatar livibetter avatar llimllib avatar lyessaadi avatar marlboromoo avatar minchinweb avatar mkinney avatar mnunezdm avatar oto-ledger avatar peterbrittain avatar pmlandwehr avatar polyzen avatar pwaller avatar sergbobrovsky avatar stefanor avatar timgates42 avatar u0nel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyfiglet's Issues

Flood control

Implement a flood control, where users cannot flood the channel with things like !ascii SOMETEXT every half a second, sending hundreds of lines into DongerDong's queue.

Ideally it would be independent of the "!ascii" command, so it could be used for other commands.

Problem with standalone JupyterLab on Windows

pyfiglet doesn't import. Here's the error:

import pyfiglet

KeyError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_17912/2380198760.py in
----> 1 import pyfiglet

C:\JupyterLab\resources\jlab_server\lib\site-packages\pyfiglet_init_.py in
57
58 if sys.platform == 'win32':
---> 59 SHARED_DIRECTORY = os.path.join(os.environ["APPDATA"], "pyfiglet")
60 else:
61 SHARED_DIRECTORY = '/usr/local/share/pyfiglet/'

C:\JupyterLab\resources\jlab_server\lib\os.py in getitem(self, key)
673 except KeyError:
674 # raise KeyError with the original key value
--> 675 raise KeyError(key) from None
676 return self.decodevalue(value)
677

KeyError: 'APPDATA'

And here's the contents of os.environ

environ{'HOMEDRIVE': 'C:',
'HOMEPATH': '\Users\mike',
'JUPYTER_CONFIG_DIR': 'C:\Users\mike\AppData\Roaming\jupyterlab-desktop',
'JUPYTER_TOKEN': 'foo(removed)',
'LOGONSERVER': '\\LUNDERVAND',
'PATH': 'C:\JupyterLab\resources\jlab_server;C:\JupyterLab\resources\jlab_server\Library\mingw-w64\bin;C:\JupyterLab\resources\jlab_server\Library\usr\bin;C:\JupyterLab\resources\jlab_server\Library\bin;C:\JupyterLab\resources\jlab_server\Scripts;C:\JupyterLab\resources\jlab_server\bin;C:\Python39\Scripts\;C:\Python39\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\JupyterLab;C:\Users\mike\AppData\Local\Microsoft\WindowsApps;C:\Users\mike\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\mike\AppData\Roaming\npm',
'SYSTEMDRIVE': 'C:',
'SYSTEMROOT': 'C:\WINDOWS',
'TEMP': 'C:\Users\mike\AppData\Local\Temp',
'USERDOMAIN': 'LUNDERVAND',
'USERNAME': 'mike',
'USERPROFILE': 'C:\Users\mike',
'WINDIR': 'C:\WINDOWS',
'PYDEVD_USE_FRAME_EVAL': 'NO',
'JPY_INTERRUPT_EVENT': '2248',
'IPY_INTERRUPT_EVENT': '2248',
'JPY_PARENT_PID': '1996',
'TERM': 'xterm-color',
'CLICOLOR': '1',
'PAGER': 'cat',
'GIT_PAGER': 'cat',
'MPLBACKEND': 'module://matplotlib_inline.backend_inline'}

And here's the JupyterLab version (standalone / Electron app): Version 3.2.5-1

TypeError: character mapping must return integer, None or unicode

$ pyfiglet -r abc

Traceback (most recent call last):
File "/usr/bin/pyfiglet", line 9, in
load_entry_point('pyfiglet==0.7.1', 'console_scripts', 'pyfiglet')()
File "/usr/lib64/python2.7/site-packages/pyfiglet/init.py", line 617, in main
r = r.reverse()
File "/usr/lib64/python2.7/site-packages/pyfiglet/init.py", line 284, in reverse
out.append(row.translate(self.reverse_map)[::-1])
TypeError: character mapping must return integer, None or unicode

Use additionnal font

Hi,
I want to use a additionnal font that is not in the fonts directory.
I use this as a Python3 library. I used the font param from Figlet class, but it does not work with path and openned file.

failed pip install of pyfiglet

I'm running os s Mavericks. Here's the error message:

~ $: pip install #21
Downloading/unpacking #21
Downloading 21 (unknown size): 26kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req.py", line 1197, in prepare_files
do_download,
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/req.py", line 1375, in unpack_url
self.session,
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/download.py", line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/util.py", line 627, in unpack_file
and is_svn_page(file_contents(filename))):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/util.py", line 210, in file_contents
return fp.read().decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

More colours for output

Using the colored module, you can access quite many colors available in the terminal.

Is it anyhow possible to confugure pyfiglet to use color settings (as) provided by this module?

Fails with "dosrebel" font.

Attached is a simple script that uses the dosrebel font. The script test8.py includes the results of executing the script and an example of an 'H' pasted from the dosrebel font.
I am not sure why there are '?' generated. Any suggestions?
Thanks.

test8.zip

Fonts don't have a suitable license for distribution

Please see comments raised by @peterbrittain in #58 (comment)
#58

In essence, I think we need to revert #46, or come to an understanding that distributing these is legitimate.

Paging @peterbrittain, @stefanor @asakasinsky (#20) @MinchinWeb (#46).

I could use some help figuring out what needs to be done here, I also don't have much free time for actioning this. Here is a quick first pass proposal:

  1. Identify fonts which need removing.
    • (or equivalently, which can be kept, so that the code is self standing)
  2. Remove them from the github repository.
    • Decode if they need removing from the history of the repository.
  3. Remove them from source distributions on PyPi.
    • Decide if they need removing from older versions (if they should be removed from the repository
  4. Provide a mechanism for the user to obtain/use additional fonts from sources where the license is valid.

Thank you! ❤ your contribution to available Python packages....

I don't see a sponsor button, so I'm going to at least say

M""""""""M dP                         dP       
Mmmm  mmmM 88                         88       
MMMM  MMMM 88d888b. .d8888b. 88d888b. 88  .dP  
MMMM  MMMM 88'  `88 88'  `88 88'  `88 88888"   
MMMM  MMMM 88    88 88.  .88 88    88 88  `8b. 
MMMM  MMMM dP    dP `88888P8 dP    dP dP   `YP 
MMMMMMMMMM                                     
                                               
M""MMMM""M                   dP 
M. `MM' .M                   88 
MM.    .MM .d8888b. dP    dP 88 
MMMb  dMMM 88'  `88 88    88 dP 
MMMM  MMMM 88.  .88 88.  .88    
MMMM  MMMM `88888P' `88888P' oo 
MMMMMMMMMM

You've made my code so much more enjoyable, fun, and provided the library that my GUI sits on top of. Without your code, there would be no figlets in my code.

Much happier code after finding pyfiglet

image

About packing as exe

I try to use the pyinstaller to turn it as a exe file. but it doesn't work finally.

Fonts without lower case are rendered as random

If you use a font that does not have support for lower case, the output appears random.

         ...: f = Figlet(font='ugalympi')
         ...: print(f.renderText('this appears weird'))
   #     #    # #  #     # # ##
## #      #       # #  #      ##
    #### # ###  #  #    ## # #  # #
# ## # #   #### # # #  # #  #   # #
# ####   # # ## #  #    #    ###
  ###     ## #  # ####     #### # #
###  # #              # ## ##   #
 #   #   #    # # ##  #  # ##  #  #
## #         # #      # #   ###     ## #     # #   #  # ##
### ##       # #      # #  # #  ### ### ##        # #    ##
# # #  #  ## #  #  ## #  # # #### # # # #  # # ## # # # #  # #
  ###       # # #    # # #  ## # ##   ###    # ## #    #   # #
#  # # # #    # # #    # # # #  ### #  # # # ####       ###
##  # #   #   # #  #   # # #    # # ##  # #     ###   #### # #
# ####   # ####   # ####    #    ## # ####   ##  #  # ##   #
    ##    ## # ##  ## # ## ##   ##      ##       # ## ##  #  #
 #    #   ###      #     # # #   #  # # ## #
# #  ##  # #  ### # #  #        # #  #######
  #####  # #### #  #    ## # ## # #  # ##  #
 #  ##    ## # ## # #  # # # ## #     # #  #
 # #  ## # #  ###  #    #  ####           ##
   #  ## #    # # ####        ###   ## #
# #   #   #    ##     # ## ##  #  #       ##
   #   # ##   ##  ##  #  #     # ## ## ####

Of course, using upper case is a workaround:

         ...: f = Figlet(font='ugalympi')
         ...: print(f.renderText('this appears weird'.upper()))

 ###### ##   #
 # ##   ##  ##  #####
   #    ######   ##     ####
   ##   #   ##   ##    ###
   ##   ##  ##  ###     ####
  ###           #####     ##
                       ####

  ####              #####  ####   #####
  #  ## ####  ####  ###    #  ## ##  ##
 ##  ## #  ## #  ## ####  ##  ## ##   #   ####
 ###### #   # #   # ##    ###### #####   ###
 #   ## ##### ##### ## ## #   ## ##  ##   ####
 ##  ## ##    ##    ##### ##  ## ##  ##     ##
        ###   ###                        ####

        #####         #####  ####
 ##   # ###    ##### ##  ##  ##  #
 ##   # ####    ##   ##   #   #  #
 #    # ##      ##   #####   ##  #
 # ## # ## ##  ###   ##  ##  #####
 ###### #####  ##### ##  ##
  #  #```

Is there a way for the user to detect that the font doesn't support lower case? Or even better, can Figlet automatically convert to upper case when lower isn't supported?
- jneb

an unexpected keyword argument 'dir'?

pyfiglet-0.6.1 from pip

>>> f = Figlet(dir=fontPath, font='slant')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'dir'

Random font and style? :-)

How can I get a random font and style every time I print something?

In the examples you show:

f = Figlet(font='slant')

But I want to have a fun slideshow with random fonts, can I do something like?

f = Figlet(font=random.choice(available_styles))

Allow loading fonts automatically from /usr/share/figlet

Hi, so there are a number of great fonts installed with the figlet package under Debian/Ubuntu, but don't seem to be included with pyfiglet.

I'm not sure if that is by design or not, but in the meantime it would be nice if pyfliglet could read the fonts out of /usr/share/figlet automatically without having to use the load -L path option beforehand.

That would allow me to use better fonts than standard and small (which seem to be the only legible ones included in pyfiglet) for my app. Cheers,

Alternatives to GPL-2.0 license?

First off, I just wanted to say that I love that you've spent the time to port FIGlet to Python. This is a great project and I want to say thank you for creating it. But that's not why I've raised this issue... :-)

It turns out that many of your dependent projects/packages (https://github.com/pwaller/pyfiglet/network/dependents) are using pyfiglet, but are not redistributing under the terms of the GPL-2.0 license that you are using. My own package (https://github.com/peterbrittain/asciimatics) appears to have fallen foul of this.

I really want to continue to deploy my package under the terms of the Apache-2.0 license, which as I understand it means I have to follow one of the following options:

  1. Remove/replace the use of your package
  2. Convert all direct use of pyfiglet (via import) into separate process calls (via your command-line script).
  3. Agree with you (as the copyright holders) a separate license for my project.
  4. Persuade you to change your standard license to something that allows for this use case - e.g. LGPL-3.0.

Given how many other projects depend on this one (and are actually breaking the terms as I now understand them), I'd like to try to do the right thing here and explore options 3 and 4 with you before just diving into options 1 or 2.

So... Would you be willing to consider some other form of licensing like LGPL?

Error formating text

Run the following code and see the following error.

#!/usr/bin/env python

import pyfiglet

fnames = os.listdir('pyfiglet/fonts')
for fname in fnames:
    if not fname.endswith('.flf'):
        continue
    print fname
    print pyfiglet.figlet_format('ERROR', font=fname[:-4])
    print pyfiglet.figlet_format('Error', font=fname[:-4])
  File "pyfiglet/__init__.py", line 40, in figlet_format
    return fig.renderText(text, **kwargs)
  File "pyfiglet/__init__.py", line 444, in renderText
    return self.engine.render(text)
  File "pyfiglet/__init__.py", line 382, in render
    buffer[row] = (' ' * (self.base.width - len(buffer[row]) - 1)) + buffer[row]
IndexError: list index out of range

Extraneous newlines

Maybe trim to 1 newline at front and end?

Happy to work on this. Let me know what you think. Thanks for the project. :)

Example:

➜  /tmp  pyfiglet -f doh 0
                   
                   
     000000000     
   00:::::::::00   
 00:::::::::::::00 
0:::::::000:::::::0
0::::::0   0::::::0
0:::::0     0:::::0
0:::::0     0:::::0
0:::::0 000 0:::::0
0:::::0 000 0:::::0
0:::::0     0:::::0
0:::::0     0:::::0
0::::::0   0::::::0
0:::::::000:::::::0
 00:::::::::::::00 
   00:::::::::00   
     000000000     
                   
                   
                   
                   
                   
                   
                   

➜  /tmp  

Fonts with block elements

Hello, I noticed that there are not any fonts using block ascii characters, is there a specific reason for that?

I put together one by simply converting an existing one. ansi-blocks.flf

Would it be worth submitting a pull request?

Cyrillic letters not supported

Some of fonts include russian letters, such as «moscow», «graceful». Pyfiglet cannt render this

Example:

f = Figlet( font='graceful')
print f.renderText('папа')

How to create your own figlet font?

how can i make my own font, i have looked at the files but it is confusing what order the symbols are in at the start, does anybody know what order i need to make the letters in, and the format? if you do, could you please share it.

alternatively, is there a font that looks like a casino machine font (i am making a slot machine: https://repl.it/@Vortetty/lucky-py-slots)

Lack of spaces with some fonts

With the font ANSI Regular, the output text lacks spaces between the letters. Which, that goes without saying, makes the text pretty much unreadable. The issue occurs only with pyfiglet and not figlet.

image

image

better error handling of "FontNotFound"

Currently, when the font is not found, it spews a large traceback:

% pyfiglet -f "ANSI Regular" "Hello"
Traceback (most recent call last):
  File "/nix/code/python_large_font/venv/bin/pyfiglet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/code/python_large_font/venv/lib/python3.11/site-packages/pyfiglet/__init__.py", line 927, in main
    f = Figlet(
        ^^^^^^^
  File "/nix/code/python_large_font/venv/lib/python3.11/site-packages/pyfiglet/__init__.py", line 794, in __init__
    self.setFont()
  File "/nix/code/python_large_font/venv/lib/python3.11/site-packages/pyfiglet/__init__.py", line 801, in setFont
    self.Font = FigletFont(font=self.font)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/code/python_large_font/venv/lib/python3.11/site-packages/pyfiglet/__init__.py", line 126, in __init__
    self.data = self.preloadFont(font)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/code/python_large_font/venv/lib/python3.11/site-packages/pyfiglet/__init__.py", line 147, in preloadFont
    raise FontNotFound(font)
pyfiglet.FontNotFound: ANSI Regular

Perhaps it could be improved to simply say something like "Error: pyfiglet.FontNotFound: ANSI Regular".

It is correct, kwargs?

Is this correct?
IMO not because Figlet has kwargs, but not renderText method.

def figlet_format(text, font=DEFAULT_FONT, **kwargs):
  fig = Figlet(font)
  return fig.renderText(text, **kwargs)

Upload to pypi

Hrm, we never uploaded to pypi.

That would require getting sdist to include the fonts, though.

Documentation?

Are there any docs containing list of colors, fonts, and functions/classes as well as their args(that the user is supposed to use)?

These would be extremely helpful...

How to install fonts

I've try to install custom fonts, but the command returns error.

pyfiglet -L ansi_shadow
Usage: pyfiglet [options] [text..]
pyfiglet: error: no such option: -L

Chg log

Imo. U may not agree. But i think Changelog file looks best as it's own separate file. so i can easily find this file in GH, and see changes

Command line works, but in Python fonts cannot be found

Hi

When I use pyfiglet from command line, it works fine.

If I import the module in Python and try to use it, I get FontNotFound.

f = Figlet(font = "standard") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/pyfiglet/__init__.py", line 710, in __init__ self.setFont() File "/usr/lib/python2.7/dist-packages/pyfiglet/__init__.py", line 717, in setFont self.Font = FigletFont(font=self.font) File "/usr/lib/python2.7/dist-packages/pyfiglet/__init__.py", line 90, in __init__ self.data = self.preloadFont(font) File "/usr/lib/python2.7/dist-packages/pyfiglet/__init__.py", line 105, in preloadFont raise FontNotFound(font) pyfiglet.FontNotFound: standard
How can I resolve this issue?

I am on Linux Mint 18.

Wheel file

I'm distributing my program using pynsist.
It allows to import packages on a chosen version only if a .whl is available on pypi.
It would be much more easy to distribute.
Would it be possible to do it and publish future releases with a wheel file ?

Terminal width option doesn't seem to work

$ python3
Python 3.2.3 (default, Feb 28 2014, 00:21:38)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyfiglet import Figlet; f = Figlet(font='standard', width=10); print (f.renderText('test'))
 _            _
| |_ ___  ___| |_
| __/ _ \/ __| __|
| ||  __/\__ \ |_
 \__\___||___/\__|



$ python
Python 2.7.3 (default, Feb 27 2014, 19:37:34)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyfiglet import Figlet; f = Figlet(font='standard', width=10); print f.renderText('test')
 _            _
| |_ ___  ___| |_
| __/ _ \/ __| __|
| ||  __/\__ \ |_
 \__\___||___/\__|



$ ./pyfiglet -w 10 -f standard test
 _            _
| |_ ___  ___| |_
| __/ _ \/ __| __|
| ||  __/\__ \ |_
 \__\___||___/\__|

# dpkg -l |grep figlet
ii  figlet                                         2.2.5-1                             amd64        Make large character ASCII banners out of ordinary text
# figlet -w 10 -f standard test
 _
| |_ ___
| __/ _ \
| ||  __/
 \__\___|

     _
 ___| |_
/ __| __|
\__ \ |_
|___/\__|

Unneeded function

IMO, such func not needed

def print_figlet(text, font=DEFAULT_FONT, **kwargs):

it's very simple, one print, so not much needed.

More in-depth docs/API

Hi,

Been toying around with this project for a bit and it's been great. But I'm having trouble figuring out what goes where. For example:

  • Where do I define the color to use (the pyfiglet class or the Figlet class?)

Very likely that I'm missing something obvious. But for me, the short "Quickstart" guide on how to use the package (by importing into code) is not very clear.
Maybe this is something that can be accomplished along with #74?

Font Licensing

Hello :),

A while ago (nearly a year!), I submitted pyfiglet for inclusion in the Fedora repositories. It was approved, but its inclusion was aborted as I found out about all the fonts included and nearly fainted at the sight of reviewing each of these fonts licenses. In retrospect, I should've contacted you to help me with those issues, which is why I decided to do it now.

Indeed, today @peterbrittain found out by luck of our effort to package pyfiglet and let us know that all the fonts which were not distributable were removed (as per #59). That is great, but unfortunately not enough. Indeed, for Fedora, it is required that the license of each font is documented and shipped with its license. And this package has fonts... A lot of them... And most are undocumented.

I also found out thanks to @peterbrittain that there is prior art in FIGlet licensing in Fedora, and what I seem to take out from that discussion is that if the shape and appearance of the fonts themselves are Public Domain, the files still remain under a font license.

So, what needs to be done is the curation of each font file in this repository. What could also be done is the creation of a new repository containing non-free or lost fonts that users can add easily using pyfiglet -L, while keeping safe fonts in the main repository.

Umlaute

The Umlauts ä, ü and ö don't work even though, the font has them.

Lack of Python 3 support

print repr(line)
                 ^
    SyntaxError: invalid syntax

Could you provide support for Python 3 +? 😊

New line after each formatted string

I'm trying to make a calculator, but I need to format different strings with different colors but when I add all the formatted strings together they each appear on a new line. I've been looking through the code for the library but can't find any thing that can help

Any ideas?

No "pyfiglet.fonts" module found

I installed pyserial without the pip package manager. I could not get the SSL module to work on my Nvidia Jetson (ubuntu 14), so installing via pip was not an option. Instead, I cloned the repo and installed from the setup script.

This is not an issue when installing via pip on another computer (same python and pip versions).

Here are the commands I used:

git clone https://github.com/pwaller/pyfiglet
cd pyfiglet
sudo python3.7 setup.py install

When I checked out the most recent release tag, it solved the issue. (I deleted the previous version from site-packages)

git clone https://github.com/pwaller/pyfiglet
cd pyfiglet
git checkout d7079e9 # Working version
sudo python3.7 setup.py install

Screen Shot 2022-05-02 at 1 38 33 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.