Metadata-Version: 2.4
Name: latticesvg
Version: 0.1.3
Summary: Grid-based vector layout engine — CSS Grid layout to SVG/PNG
Project-URL: Homepage, https://github.com/Qalxry/LatticeSVG
Project-URL: Documentation, https://Qalxry.github.io/LatticeSVG/
Project-URL: Repository, https://github.com/Qalxry/LatticeSVG
Project-URL: Issues, https://github.com/Qalxry/LatticeSVG/issues
Project-URL: Changelog, https://Qalxry.github.io/LatticeSVG/changelog/
Author: Qalxry
License-Expression: MIT
License-File: LICENSE
Keywords: css-grid,layout,png,report,svg,typesetting,vector
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
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: Topic :: Multimedia :: Graphics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Text Processing :: Markup
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: drawsvg>=2.0
Requires-Dist: freetype-py>=2.3
Requires-Dist: quickjax>=0.1.0
Provides-Extra: dev
Requires-Dist: cairosvg>=2.5; extra == 'dev'
Requires-Dist: matplotlib>=3.5; extra == 'dev'
Requires-Dist: pillow>=9.0; extra == 'dev'
Requires-Dist: pyphen>=0.16; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-glightbox>=0.4; extra == 'docs'
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs-static-i18n>=1.2; extra == 'docs'
Requires-Dist: mkdocs>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
Provides-Extra: hyphens
Requires-Dist: pyphen>=0.16; extra == 'hyphens'
Provides-Extra: png
Requires-Dist: cairosvg>=2.5; extra == 'png'
Description-Content-Type: text/markdown

# 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, `fr` units, `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

```bash
pip install latticesvg

# For PNG output
pip install latticesvg[png]

# For auto-hyphenation
pip install latticesvg[hyphens]
```

## Quick Start

```python
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/](https://qalxry.github.io/LatticeSVG/)

## Dependencies

- Python ≥ 3.8
- [drawsvg](https://pypi.org/project/drawsvg/) — SVG generation
- [freetype-py](https://pypi.org/project/freetype-py/) — text measurement
- [quickjax](https://pypi.org/project/quickjax/) — LaTeX math rendering
- [cairosvg](https://pypi.org/project/cairosvg/) (optional) — PNG conversion

## License

MIT
