Metadata-Version: 2.4
Name: sphinx-fonts
Version: 0.0.1a6
Summary: Sphinx extension for self-hosted fonts via Fontsource CDN
Project-URL: Repository, https://github.com/git-pull/gp-sphinx
Author-email: Tony Narlock <tony@git-pull.com>
License: MIT
Keywords: fonts,fontsource,self-hosted,sphinx
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Sphinx
Classifier: Framework :: Sphinx :: Extension
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Documentation
Classifier: Topic :: Documentation :: Sphinx
Classifier: Typing :: Typed
Requires-Python: <4.0,>=3.10
Requires-Dist: sphinx
Description-Content-Type: text/markdown

# sphinx-fonts

Sphinx extension for self-hosted fonts via [Fontsource](https://fontsource.org/) CDN.

Downloads font files at build time, caches them locally (`~/.cache/sphinx-fonts`), and
injects `@font-face` declarations via Jinja2 template context.

## Install

```console
$ pip install sphinx-fonts
```

## Usage

In your `docs/conf.py`:

```python
extensions = ["sphinx_fonts"]

sphinx_fonts = [
    {
        "family": "IBM Plex Sans",
        "package": "@fontsource/ibm-plex-sans",
        "version": "5.2.8",
        "weights": [400, 500, 600, 700],
        "styles": ["normal", "italic"],
        "subset": "latin",
    },
]

sphinx_font_css_variables = {
    "--font-stack": '"IBM Plex Sans", sans-serif',
}
```

Requires a `page.html` template override that reads the `font_faces` and
`font_preload_hrefs` context variables. See the
[gp-sphinx docs](https://gp-sphinx.git-pull.com) for a complete template example.
