Small utility to use Google Fonts for markup files
Project description
Overview
This is small utility to handle specs of Google Fonts in my products.
Usage
Simple case
>>> from googlefonts_markup import Font
>>> noto_sans_jp = Font(family_name="Noto Sans JP")
>>> noto_sans_jp.css_url()
'https://fonts.googleapis.com/css2?family=Noto+Sans+JP'
>>> noto_sans_jp.css_tag()
'<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP" rel="stylesheet">'
If you want only URL of CSS, use googlefonts_markup.shortcuts.
>>> from googlefonts_markup.shortcuts import font_css_url
>>> font_css_url("Noto Sans JP")
'https://fonts.googleapis.com/css2?family=Noto+Sans+JP'
With italic
>>> from googlefonts_markup import Axis, Font
>>> red_hat_mono = Font(family_name="Red Hat Mono", axis_list=[Axis(italic=True)])
>>> red_hat_mono.css_url()
'https://fonts.googleapis.com/css2?family=Red+Hat+Mono:ital,wght@1,400'
Extra attributes
>>> from googlefonts_markup import Font, FontSet
>>> noto_sans_jp = Font(family_name="Noto Sans JP")
>>> fontset = FontSet(fonts=[noto_sans_jp], display="swap")
>>> fontset.css_url()
'https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap'
Multiple fonts
>>> from googlefonts_markup import Font, FontSet
>>> noto_sans_jp = Font(family_name="Noto Sans JP")
>>> roboto_mono = Font(family_name="Roboto Mono")
>>> fontset = FontSet(fonts=[noto_sans_jp, roboto_mono], display="swap")
>>> fontset.css_url()
'https://fonts.googleapis.com/css2?family=Noto+Sans+JP&family=Roboto+Mono&display=swap'
Installation
pip install git+https://github.com/attakei-lab/googlefonts-markup
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
Built Distribution
Close
Hashes for googlefonts_markup-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d63af6a93efc1dfb739a4150fc311480bea92773fd304ab74fe4730072a0c7 |
|
MD5 | 7393d48f08581cfb65f21355e2f7305f |
|
BLAKE2b-256 | 09f8a676e87eae7d092a40e9a9834f18e82fea61ae97b452402986e3224e2396 |