Skip to content

Installation

Install with pip

pip install latticesvg

Optional Extras

LatticeSVG provides two optional dependency groups:

pip install latticesvg[png]

Installs CairoSVG for SVG → PNG conversion.

pip install latticesvg[hyphens]

Installs Pyphen for multi-language auto-hyphenation (hyphens: auto).

pip install latticesvg[png,hyphens]

System Dependencies

FreeType

LatticeSVG uses freetype-py for precise glyph measurement, which requires the FreeType library on your system.

sudo apt install libfreetype6-dev
sudo dnf install freetype-devel
brew install freetype

macOS usually comes with FreeType pre-installed.

freetype-py automatically downloads a pre-compiled FreeType DLL — no extra steps needed.

Cairo (PNG Output Only)

For PNG output, you also need the Cairo graphics library:

sudo apt install libcairo2-dev
brew install cairo

Verify Installation

import latticesvg
print(latticesvg.__version__)  # 0.1.0
from latticesvg import GridContainer, TextNode, Renderer

page = GridContainer(style={"width": "200px", "padding": "10px"})
page.add(TextNode("Hello LatticeSVG!"))
Renderer().render(page, "test.svg")
print("✓ LatticeSVG installed successfully")

Development Installation

To install from source and contribute:

git clone https://github.com/nicholasgasior/LatticeSVG.git
cd LatticeSVG
pip install -e ".[dev,docs]"
pytest  # Run tests