NovaSVG 0.10.0
A header-only SVG library
Loading...
Searching...
No Matches
novasvg::ForeignObjectRenderer Class Referenceabstract

Renders the (HTML-ish) content captured inside a <foreignObject>. More...

#include <svgelement.h>

Inheritance diagram for novasvg::ForeignObjectRenderer:

Public Member Functions

virtual ~ForeignObjectRenderer ()=default
 
virtual void render (const SVGForeignObjectElement *element, SVGRenderState &state) const =0
 

Detailed Description

Renders the (HTML-ish) content captured inside a <foreignObject>.

This is an extension point on purpose: ForeignObjectSimple below only understands a small, deliberately shallow slice of HTML5 – it strips every tag (div/span/p/i/b/...) and just draws the remaining plain text centered in the foreignObject's box, using the font/fill already inherited through the normal SVG/CSS cascade. That's enough to cover what tools like Mermaid actually emit (a single short, non-wrapping, centered text run per foreignObject), without pretending to be a real HTML/CSS layout engine.

A more complete renderer (e.g. one backed by litehtml) can be hooked in later without touching SVGForeignObjectElement itself: implement this interface and call SVGForeignObjectElement::setRenderer() (or replace ForeignObjectSimple::instance() below) to swap it in.

Definition at line 1145 of file svgelement.h.

Constructor & Destructor Documentation

◆ ~ForeignObjectRenderer()

virtual novasvg::ForeignObjectRenderer::~ForeignObjectRenderer ( )
virtualdefault

Member Function Documentation

◆ render()

virtual void novasvg::ForeignObjectRenderer::render ( const SVGForeignObjectElement *  element,
SVGRenderState &  state 
) const
pure virtual

The documentation for this class was generated from the following file: