NovaSVG 0.10.0
A header-only SVG library
Loading...
Searching...
No Matches
novasvg::ForeignObjectMetrics Struct Reference

Metrics for how ForeignObjectSimple::render() will lay out and size a <foreignObject>'s content, computed WITHOUT actually rendering it. More...

#include <svgelement.h>

Public Attributes

float height = 0.f
 Total height ForeignObjectSimple::render() will use for this content, in pixels.
 
float width = 0.f
 Widest line, per Font::measureText() – see this struct's own field-level note above measureForeignObjectContent() for why this is NOT what render() itself uses to size anything.
 
int lineCount = 0
 Number of lines wrapForeignObjectText() splits this content into.
 
float lineHeight = 0.f
 Per-line height (from the content's own inline line-height:, or font.height() * 1.2).
 

Detailed Description

Metrics for how ForeignObjectSimple::render() will lay out and size a <foreignObject>'s content, computed WITHOUT actually rendering it.

Exists so a caller building the SVG in the first place (i.e. before any SVGForeignObjectElement exists to query) – e.g. mermaid.js's own layout pass, run headless inside mermaidx's QuickJS/V8 DOM shim, computing a node box's height to fit a multi-line HTML label – can ask novasvg itself what height that content will need, rather than reimplementing (and risking drifting out of sync with) the line-counting/line-height logic ForeignObjectSimple::render() uses at actual paint time. See measureForeignObjectContent() below.

Definition at line 6917 of file svgelement.h.

Member Data Documentation

◆ height

float novasvg::ForeignObjectMetrics::height = 0.f

Total height ForeignObjectSimple::render() will use for this content, in pixels.

Definition at line 6918 of file svgelement.h.

Referenced by novasvg::measureForeignObjectSegments().

◆ lineCount

int novasvg::ForeignObjectMetrics::lineCount = 0

Number of lines wrapForeignObjectText() splits this content into.

Definition at line 6920 of file svgelement.h.

Referenced by novasvg::measureForeignObjectSegments().

◆ lineHeight

float novasvg::ForeignObjectMetrics::lineHeight = 0.f

Per-line height (from the content's own inline line-height:, or font.height() * 1.2).

Definition at line 6921 of file svgelement.h.

Referenced by novasvg::measureForeignObjectSegments().

◆ width

float novasvg::ForeignObjectMetrics::width = 0.f

Widest line, per Font::measureText() – see this struct's own field-level note above measureForeignObjectContent() for why this is NOT what render() itself uses to size anything.

Definition at line 6919 of file svgelement.h.

Referenced by novasvg::measureForeignObjectSegments().


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