An implementation of figlet written in Python

Overview
All of the documentation and the majority of the work done was by
    Christopher Jones ([email protected]).
Packaged by Peter Waller <[email protected]>,
various enhancements by Stefano Rivera <[email protected]>.

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


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 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 throroughly. 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 https://github.com/pwaller/pyfiglet/issues/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.

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')

        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

        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

        github:stefanor for various bug fixes and improvements and the debian packaging.

        Thanks to anyone who contributed an issue or code on github!

LICENSE

        The MIT License (MIT)
        Copyright © 2007-2018

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

        (see LICENSE for full details)

CHANGELOG

        2018-12-06 0.8.0
            #62 Change LICENSE to MIT
            #61 Provide font installation option (-L) and remove
                unlicenced fonts from the distribution

        2018-10-17 0.7.6

            #57 Implement colored print
            #53 Allow fonts to be specified by path

        2016-06-12 0.7.5

            #46 Add 100+ fonts from java.de figlet fonts collection v4.0
            #48 Include python3 in testing

        2015-05-27 0.7.4

            #43 Don't leak file handles

        2015-04-14 0.7.3

            #41 Add newline and text wrapping support

        2014-09-14 0.7.2

            #35 Add this CHANGELOG
            #36 Bug fix for #34 (broken --reverse and --flip)
                (reported "character mapping must return integer, None or unicode")

        2014-07-27 0.7.1

            #29 Fix for UTF8 regression
            #31 Add __main__ entry point
            #32 Pep8 the code and minor refactoring
            #33 Trove classifiers update

        2014-06-02 0.7

            #9  Add --list_fonts and --info_font
            #10 Add tools/pyfiglet_example for listing all fonts
            #11 Fix the pyfiglet command (had bad python path)
            #12 Pyflakes fixes
            #13 Configure Travis Continuous Integration
            #17 Documentation usage sample fix
            #19 Enable pyfiglet to use extended ASCII chars
            #20 Add two cyrillic fonts
            #21 Python 3 support
            #27 Code improvements
            #28 Human readable font list (-l)
Comments
  • Font Licensing

    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.

    help wanted 
    opened by LyesSaadi 57
  • Alternatives to GPL-2.0 license?

    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?

    opened by peterbrittain 42
  • Add newline support

    Add newline support

    Added carriage return support to pyfiglet refactored the FigletRenderingEngine: Use a Director - Builder - Product design pattern refactored test.py, tests are now easy to add. added a test_font script too diff fonts results with figlet added stats_erroneous_font.py based on test.py, show which font and type of smush value are failing the tests

    If the width is smaller than a character width of the font, we throw an exception, get a bigger terminal with more than 6 columns :-) This is different from figlet which will either send many spaces or little part of the characters

    Fixes #25.

    opened by grandemk 22
  • Fonts don't have a suitable license for distribution

    Fonts don't have a suitable license for distribution

    Please see comments raised by @peterbrittain in https://github.com/pwaller/pyfiglet/issues/58#issuecomment-425883141 #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.
    opened by pwaller 20
  • Fix for #89 - clarify font licensing

    Fix for #89 - clarify font licensing

    Hopefully this is everything we agreed...

    • Fonts now separated out into 2 directories
    • Makefule updated to make it easy to build minimal or full font definitions
    • Docs updated to say what's happened.

    I didn't go for the BDF files in the end as I wasn't so sure about the legality, while the other explicit license text was much more reassuring.

    Are we good to go?

    opened by peterbrittain 12
  • an unexpected keyword argument 'dir'?

    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'
    
    opened by asakasinsky 7
  • Implemented colored print

    Implemented colored print

    Hi,

    I just implemented this because I needed to use in a project and said, why not?

    I added to keyword args into the print_figlet method

    I also created a dictionary for storing the ASCII codes of the colors, and i created a method that converts the color passed to the escaped sequence

    I also added to more params to the optparse, -c and -b

    is my first time doing a PR so hope i do it right....

    opened by mnunezdm 6
  • Thank you!  ❤ your contribution to available Python packages....

    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

    opened by PySimpleGUI 5
  • More colours for output

    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?

    opened by synergiator 5
  • Don't Leak File Handles

    Don't Leak File Handles

    In pypy, which is garbage collected rather than refcounted, open file handles can sometimes collect too quickly for the garbage collector and trigger the operating system's file handle limit.

    In my test code, I was seeing this failure:

    ERROR: Failure: IOError ([Errno 24] Too many open files: u'/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/fonts/stellar.flf')
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/loader.py", line 414, in loadTestsFromName
        addr.filename, addr.module)
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/importer.py", line 47, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/importer.py", line 94, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/Users/llimllib/code/limbo/test/test_plugins/test_banner.py", line 10, in <module>
        from banner import on_message
      File "/Users/llimllib/code/limbo/test/test_plugins/../../limbo/plugins/banner.py", line 9, in <module>
        FONTS = FIGLET.getFonts()
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 750, in getFonts
        return self.Font.getFonts()
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 119, in getFonts
        if cls.isValidFont(font)]
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 111, in isValidFont
        f = pkg_resources.resource_stream('pyfiglet.fonts', font)
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pkg_resources/__init__.py", line 1161, in resource_stream
        self, resource_name
      File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pkg_resources/__init__.py", line 1715, in get_resource_stream
        return open(self._fn(self.module_path, resource_name), 'rb')
    IOError: [Errno 24] Too many open files: u'/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/fonts/stellar.flf'
    

    As soon as I patched pyfiglet's getFont method to close the file handle, all my tests passed.

    I don't know much about pkg_resources, but the docs promise that the result of resource_stream should be a file-like object, and so .close() should be legal on it.

    opened by llimllib 5
  • Extraneous newlines

    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  
    
    help wanted 
    opened by aerickson 4
  • How to install fonts

    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

    opened by aeciobf 0
  • Lack of spaces with some fonts

    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

    help wanted 
    opened by victorbnl 0
  • New line after each formatted string

    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?

    opened by G-us 0
  • No

    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

    help wanted 
    opened by The1TrueJoe 2
  • Problem with standalone JupyterLab on Windows

    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

    help wanted 
    opened by miklevin 1
Releases(0.7.3)
Owner
Peter Waller
Peter Waller
text-to-speach bot - You really do NOT have time for read a newsletter? Now you can listen to it

NewsletterReader You really do NOT have time for read a newsletter? Now you can listen to it The Newsletter of Filipe Deschamps is a great place to re

ItanuRomero 8 Sep 18, 2021
Extract price amount and currency symbol from a raw text string

price-parser is a small library for extracting price and currency from raw text strings.

Scrapinghub 252 Dec 31, 2022
A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

Derek Gulbranson 574 Dec 20, 2022
Repositori untuk belajar pemrograman Python dalam bahasa Indonesia

Python Repositori ini berisi kumpulan dari berbagai macam contoh struktur data, algoritma dan komputasi matematika yang diimplementasikan dengan mengg

Bellshade 111 Dec 19, 2022
Microsoft's Cascadia Code font customized to my liking.

Microsoft's Cascadia Code font customized to my liking. Also includes some simple batch patch and bake scripts to batch patch glyphs and bake font features into fonts!

Frederik List 3 Jan 29, 2022
Python tool to make adding to your armory spreadsheet armory less of a pain.

Python tool to make adding to your armory spreadsheet armory slightly less of a pain by creating a CSV to simply copy and paste.

1 Oct 20, 2021
Map Reduce Wordcount in Python using gRPC

This project is implemented in Python using gRPC. The input files are given in .txt format and the word count operation is performed.

Divija 4 Dec 05, 2022
PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different languages

PyMultiDictionary PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different

Pablo Pizarro R. 19 Dec 26, 2022
A neat little program to read the text from the "All Ten Fingers" program, and write them back.

ATFTyper A neat little program to read the text from the "All Ten Fingers" program, and write them back. How does it work? This program uses the Pillo

1 Nov 26, 2021
Shows twitch pay for any streamer from Twitch leaked CSV files.

twitch_leak_csv_reader Shows twitch pay for any streamer from Twitch leaked CSV files. Requirements: You need python3 (you can install python 3 from o

5 Nov 11, 2022
A simple text editor for linux

wolf-editor A simple text editor for linux Installing using Deb Package Download newest package from releases CD into folder where the downloaded acka

Focal Fossa 5 Nov 30, 2021
Um simulador de caixa registradora com database usando arquivos .txt

🛒 Caixa Registradora V2 ❓ - Como usar? Execute o caixa-registradora.py, nele vai ter um menu interativo, você pode cadastrar diversos produtos em um

Gabriel 0 Sep 25, 2022
You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.

You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.

8 Dec 20, 2022
box is a text-based visual programming language inspired by Unreal Engine Blueprint function graphs.

Box is a text-based visual programming language inspired by Unreal Engine blueprint function graphs. $ cat factorial.box ┌─ƒ(Factorial)───┐

Pranav 104 Dec 24, 2022
This repository contains scripts to control a RGB text fan attached to a Raspberry Pi.

RGB Text Fan Controller This repository contains scripts to control a RGB text fan attached to a Raspberry Pi. Setup The Raspberry Pi and RGB text fan

Luke Prior 1 Oct 01, 2021
A slugifier that works in unicode

Unicode Slugify Unicode Slugify is a slugifier that generates unicode slugs. It was originally used in the Firefox Add-ons web site to generate slugs

Mozilla 315 Nov 21, 2022
utoken is a multilingual tokenizer that divides text into words, punctuation and special tokens such as numbers, URLs, XML tags, email-addresses and hashtags.

utoken utoken is a multilingual tokenizer that divides text into words, punctuation and special tokens such as numbers, URLs, XML tags, email-addresse

Ulf Hermjakob 11 Jan 05, 2023
Python Lex-Yacc

PLY (Python Lex-Yacc) Copyright (C) 2001-2020 David M. Beazley (Dabeaz LLC) All rights reserved. Redistribution and use in source and binary forms, wi

David Beazley 2.4k Dec 31, 2022
Maiden & Spell community player ranking based on tournament data.

MnSRank Maiden & Spell community player ranking based on tournament data. Why? 2021 just ended and this seemed like a cool idea. Elo doesn't work well

Jonathan Lee 1 Apr 20, 2022
Export solved codewars kata challenges to a text file.

Codewars Kata Exporter Note:this is not totally my work.i've edited the project to make more easier and faster for me.you can find the original work h

Oussama Ben Sassi 4 Aug 13, 2021