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.
Source Distribution
py-open-fonts-0.7.0.tar.gz
(6.5 kB
view details)
File details
Details for the file py-open-fonts-0.7.0.tar.gz
.
File metadata
- Download URL: py-open-fonts-0.7.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb6fcae2d812c3c8d4b3794bb5342a27119970666f3be7812eb3e9bad63d0bb6 |
|
MD5 | 2d2d0f443576890375e5638159bf114e |
|
BLAKE2b-256 | 31d8cddc98843216b52a6a666dd91a8ed37588526e5a72d9a8970fafcdc163bf |