Expand description
Render a formula to a gpui image — the display primitive (the ratex-gtk4 analog).
model → LaTeX → RaTeX layout → display list → ratex-render raster (PNG) → decode → BGRA → gpui RenderImage. RaTeX only exposes a PNG encoder (not the raw pixmap), so we
round-trip through PNG for now; a pixmap accessor (or a small fork) would skip the
re-decode. RaTeX rasters black-on-opaque-white; we recolor to the host’s text color on a
transparent background (a pixel’s darkness becomes the glyph alpha), so a formula blends
into any theme.
Structs§
- Rendered
- A rasterized formula plus its logical (pre-DPR) size in px.
Constants§
- PAD
- Logical padding (px) RaTeX leaves around the formula. The view offsets caret/slot
geometry by this much, since the same value feeds
RenderOptions::padding.
Functions§
- render_
latex - Render raw LaTeX to a gpui image — the display path for a
$$…$$block, which has no edit model. Glyphs are painted incolor(the host’s text color) on a transparent background.Noneif the LaTeX fails to parse / lay out / rasterize. - render_
latex_ to_ png - Render raw LaTeX to PNG file bytes (black on white) at the given font size and DPR.
Suitable for writing directly to a
.pngfile. - render_
latex_ to_ svg - Render raw LaTeX to an SVG string at the given font size.
- render_
row - Render a row to a gpui image at
font_sizepx/em anddprdevice-pixel-ratio.Noneif the row’s LaTeX fails to parse / lay out / rasterize.