LatticeSVG
A declarative vector layout engine powered by CSS Grid. Describe layouts with Python dicts, get pixel-perfect SVG/PNG output.
Features
- Full CSS Grid Level 1 — fixed tracks,
frunits,minmax(),repeat(), named areas, auto-placement - Precise text typesetting — FreeType-based glyph measurement, auto line-breaking, CJK support, rich text (HTML/Markdown), vertical writing
- Multiple node types —
TextNode,ImageNode,SVGNode,MplNode(Matplotlib with auto font sync),MathNode(LaTeX) - Font query API —
get_font_path(),list_fonts()for programmatic font discovery - 63 CSS properties — box model, border-radius, gradients, shadows, transforms, filters, clip-path, opacity
- SVG & PNG output — vector SVG by default, optional high-res PNG via CairoSVG, WOFF2 font embedding
Installation
pip install latticesvg
# For PNG output
pip install latticesvg[png]
# For auto-hyphenation
pip install latticesvg[hyphens]
Quick Start
from latticesvg import GridContainer, TextNode, Renderer
page = GridContainer(style={
"width": "600px",
"padding": "24px",
"grid-template-columns": ["1fr", "1fr"],
"gap": "16px",
"background-color": "#ffffff",
})
page.add(TextNode("Hello", style={"font-size": "24px", "color": "#2c3e50"}))
page.add(TextNode("World", style={"font-size": "24px", "color": "#e74c3c"}))
Renderer().render(page, "hello.svg")
Documentation
Full documentation is available at https://qalxry.github.io/LatticeSVG/
Dependencies
- Python ≥ 3.8
- drawsvg — SVG generation
- freetype-py — text measurement
- quickjax — LaTeX math rendering
- cairosvg (optional) — PNG conversion
License
MIT
Metadata
Release files for latticesvg 0.1.3
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 |
|---|---|---|---|---|
| latticesvg-0.1.3.tar.gz | 838.5 kB | Without provenance | Details for latticesvg-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| latticesvg-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for latticesvg-0.1.3-py3-none-any.whl |
Total release size: 938.8 kB
Release files / latticesvg-0.1.3.tar.gz
| Download URL | latticesvg-0.1.3.tar.gz |
|---|---|
| Size | 838.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b883248f75b63e176cced175ac26f615e227fcc6e25b3cb673fb704c2cd1df83
|
|
BLAKE2b-256 checksum How to use checksums |
e6854ff44d67e318097c7b38f6d46a2877425cf871b6139126eb14b048587684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / latticesvg-0.1.3-py3-none-any.whl
| Download URL | latticesvg-0.1.3-py3-none-any.whl |
|---|---|
| Size | 100.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99732d548d07c1437973affe2901374304585cf60d1fb27e76c4d6f8ce84c53f
|
|
BLAKE2b-256 checksum How to use checksums |
4c0ebe445ff8272b3b0d29d40b918f024f8ba058ad6a2f264305109bce5278df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for latticesvg 0.1.3
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.