Companion

Functions

Link copied to clipboard

Build from an already-parsed <svg> element (inline SVG in XHTML).

Build from an <svg> element that a host document includes, such as an inline SVG in XHTML, whose style sheets style its elements too (#509). hostStyle gives what the host's style sheets declare for an element, as a style attribute holds it, or null for nothing. Those declarations outrank presentation attributes and yield to the SVG's own <style> rules, which come later in the document, unless they are important.

fromElement whose <image> elements ask images for their picture first, by their href, so a host that holds an image decoded hands it over without a file.

Link copied to clipboard
fun isSvg(bytes: ByteArray): Boolean

True when bytes open like an SVG file.

Link copied to clipboard
fun parse(bytes: ByteArray): SvgImage?

Parse a whole .svg file, or null when there is no <svg> in it.

Link copied to clipboard

The commands of an SVG path's d attribute, up to the first one in error (SVG 2, 9.5.4).

Link copied to clipboard
fun textAdvance(text: String, fontFamily: String?, fontWeight: String?, fontStyle: String?, fontSize: Double): Double

The advance of text at fontSize in user units, as <text> lays it out: in the standard-font metrics for the family, weight and style that font-family, font-weight and font-style name.