Skip to main content

A collection of beautiful free and open source fonts.

Project description

py-open-fonts

Open Fonts in pip and conda.

Install

Needs python 3.6+

conda install -c defaults -c conda-forge py-open-fonts

or

pip install py-open-fonts

API

CLI

Usage: open-fonts-css [OPTIONS] [FONTS]...

  Generates CSS source with @font-face definitions with absolute paths to
  fonts files as URL.

  Multiple FONTS like FontName can be provided. For example "FontName"
  argument means using $PYTHONPREFIX/fonts/open-fonts/css/FontName.css If
  none were provided then all fonts definitions from
  $PYTHONPREFIX/fonts/open-fonts/css/ would be used.

  Note that spaces would be removed from provided font names and CSS files
  do not contain spaces in their names.

Options:
  -p, --pref TEXT  Generated CSS would have TEXT as prefix in URL to fonts
                   files (instead of default absolute path as URL). Like:
                   ${PREFIX}FontName.ttf ("<...>" to "TEXT"replacement
                   actually)
  -o, --out TEXT   Save CSS to TEXT filepath. "-" means write to stdout
                   (default behaviour)
  --help           Show this message and exit.

open_fonts_css

def open_fonts_css(*fonts: str, pref: str=None, out: str=None) -> str:
    """
    Generates CSS source with @font-face definitions with absolute paths
    to fonts files as URL.

    Multiple ``fonts`` like ``"FontName"`` can be provided. For example ``"FontName"``
    argument means using ``$PYTHONPREFIX/fonts/open-fonts/css/FontName.css``
    If none were provided (``fonts`` is ``()``) then all fonts definitions from
    ``$PYTHONPREFIX/fonts/open-fonts/css/`` would be used.

    Note that spaces would be removed from provided font names and CSS files
    do not contain spaces in their names. 

    :param pref:
        Generated CSS would have ``pref`` as prefix in URL to fonts files (instead
        of default absolute path as URL). Like: ``f"{pref}FontName.ttf"``
        ("<...>" to ``pref`` replacement actually).
    :param out:
        Save CSS to ``out`` filepath. ``"-"`` or ``None`` mean do nothing.

    :return: CSS source code if out is None or '-' else returns ''
    """

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-open-fonts, version 0.5.1
Filename, size File type Python version Upload date Hashes
Filename, size py-open-fonts-0.5.1.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page