autosubset – Automatically subset a font based on actual text
autosubset creates a subset font exactly for the set of characters that you
actually use.
Usage
Just pipe the text into autosubset and specify the font.
Assuming all your text is in the HTML files in the current directory:
html2text *.html | autosubset.py MyFont.woff2
autosubset analyzes the content, extracts the characters used and uses
pyftsubst from
fonttools to create a matching
subset.
After that, just add lines like the following to your web site:
- HTML: Preload the font for faster availability.
<link rel="preload" href="MyFont.subset.woff2" as="font" type="font/woff2">
- CSS: Define and use the font.
@font-face { font-family: "My Font"; src: local("Tenor Sans"), url("MyFont.subset.woff2") format("woff2"); font-display: fallback; } @body { font-family: "My Font", "System Fallback Font", sans; }
Whenever you change your text, make sure to rerun autosubst. This ensures
that the browser does not need to substitute characters from the fallback
fonts.
Metadata
Release files for autosubset 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autosubset-0.3.0.tar.gz | 5.0 kB | Without provenance | Details for autosubset-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autosubset-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for autosubset-0.3.0-py3-none-any.whl |
Total release size: 10.1 kB
Release files / autosubset-0.3.0.tar.gz
| Download URL | autosubset-0.3.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa36d9f95dc22279db201259bfc26c4840d3764b2cd7870ddad6b0c6829a64fd
|
|
BLAKE2b-256 checksum How to use checksums |
5e9acbef31056f9a562d40e4c75086fb08ce5486f8106e5ebf923d7cebdb113c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / autosubset-0.3.0-py3-none-any.whl
| Download URL | autosubset-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e6cd48ce70b34d7c52cd5a9690e83b02357f9698b80396286a612b03782048e
|
|
BLAKE2b-256 checksum How to use checksums |
77e596541b43d65082e8ee7922c169c763ce3402f70c499b70a89bd0da369569
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for autosubset 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.