![]() Thanks to Mark Lutz for writing the Learning Python and Programming Python books that make up my python foundation. They were born in 1990 to respond to the appeal of patients suffering from rare diseases.Ĭome today, we are organized to dare to listen to them and answers, every day of the year. The Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and Technological Research. This command save a fontpreview.png in a current directory.įontpreview is a open source project. The class used for command line previews is FontPreview. save ( '/tmp/fira_code.png' )Īlong with the package, a command line tool based on this python package is installed. append ( fb ) # Create a wall fw = FontWall ( banners, max_tile = 4 ) fw. add_image ( E, ( 339, 60 )) # Add to list of banners banners. set_text_position ( 'top' ) # Adding image on fb fb. ![]() bg_color = colors # Set foreground colors fb. ![]() save ( '/tmp/noto_book/' ) # save page1.png, page2.png in /tmp/noto_book/ folder Advanced usageīelow is an example of various previews of the "Fira Code regular" font.ĭoes it remind you of anything? Fira code original # FIRA CODE WALL from fontpreview import FontBanner, FontWall fira_code = '/tmp/firacode.ttf' # RGB group = ('background', 'FIRA COD color', 'Ligature color', 'E color background') colors_group = banners = # Create banners for colors in colors_group : # Create a FontBanner objects fb = FontBanner ( fira_code, ( 413, 240 )) liga = FontBanner ( fira_code, ( 413, 240 )) E = FontBanner ( fira_code, ( 40, 70 )) # Set background colors fb. draw () # Create book book = FontBooklet ( fpage1, fpage2 ) book. save ( '/tmp/fpage_template.png' )įont booklet example: from fontpreview import FontPage, FontBanner, FontBooklet # Define the various parts of page header = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'fontname' ) body = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'paragraph' ) footer = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'letter' ) # Create FontPage object fpage1 = FontPage ( header = header, body = body, footer = footer ) fpage2 = FontPage ( header = header, body = body, footer = footer ) # Design all parts fpage1. set_footer ( footer ) # Design all parts fpage. set_footer ( 100, 4, 'lcenter' ) # Create FontPage object fpage = FontPage ( template = template ) fpage. set_body ( 170, 1, 'lcenter' ) template. save ( '/tmp/fpage.png' )įont page with template example: from fontpreview import FontPage, FontPageTemplate, FontBanner # Define the various parts of page header = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'fontname' ) body = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'paragraph' ) footer = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'letter' ) # Create font page template template = FontPageTemplate ( 3508 ) template. save ( '/tmp/fw.png' )įont page example: from fontpreview import FontPage, FontBanner # Define the various parts of page header = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'fontname' ) body = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'paragraph' ) footer = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'letter' ) # Create FontPage object fpage = FontPage () fpage. save ( '/tmp/fl.png' )įont wall example: from fontpreview import FontBanner, FontWall # Define the various parts of wall fb = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'fontname' ) fb2 = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'alpha' ) fb3 = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'letter' ) fb4 = FontBanner ( '/tmp/noto.ttf', 'landscape', mode = 'paragraph' ) fw = FontWall () fw. Logo example: from fontpreview import FontLogo fl = FontLogo ( '/tmp/noto.ttf', 'Fp' ) fl. ![]() save ( '/tmp/fp.png' )īanner example: from fontpreview import FontBanner fb = FontBanner ( '/tmp/noto.ttf', 'landscape', bg_color = ( 153, 153, 255 ), mode = 'fontname' ) fb. Preview example: from fontpreview import FontPreview fp = FontPreview ( '/tmp/noto.ttf' ) fp. Note: If you want to use the command line tool, you need to install the system-wide library: pip install fontpreview Simple usage Use Pypi: $ pip install -user fontpreview If you want to test the package before installing, use the test: $ git clone This is a library that allows you to create preview images from one or more selected fonts. Fontpreview: Python library for font previews
0 Comments
Leave a Reply. |