public interface SVGDrawer extends Closeable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SVGDrawer.SVGImage |
| Modifier and Type | Method and Description |
|---|---|
void |
addFontFile(File fontFile,
String family,
Integer weight,
BaseRendererBuilder.FontStyle style) |
default void |
addFontStream(FSSupplier<InputStream> supplier,
String family,
Integer weight,
BaseRendererBuilder.FontStyle style)
Adds a font that is supplied as a stream rather than as a file, so that fonts
registered with
useFont(FSSupplier<InputStream>, ...) can be used
by SVG (or MathML) content too. |
default SVGDrawer.SVGImage |
buildStandaloneSVGImage(Element svgElement,
String uri,
double targetWidth,
double targetHeight,
double dotsPerPixel)
Builds an SVG image that is not tied to a replaced element, so that SVGs can be used
as CSS images, for example as a
background-image or a
list-style-image. |
SVGDrawer.SVGImage |
buildSVGImage(Element svgElement,
Box box,
CssContext cssContext,
double cssWidth,
double cssHeight,
double dotsPerPixel) |
void |
importFontFaceRules(List<FontFaceRule> fontFaces,
SharedContext shared) |
default void |
withUserAgent(UserAgentCallback userAgentCallback) |
void importFontFaceRules(List<FontFaceRule> fontFaces, SharedContext shared)
SVGDrawer.SVGImage buildSVGImage(Element svgElement, Box box, CssContext cssContext, double cssWidth, double cssHeight, double dotsPerPixel)
default SVGDrawer.SVGImage buildStandaloneSVGImage(Element svgElement, String uri, double targetWidth, double targetHeight, double dotsPerPixel)
background-image or a
list-style-image. In that position there is no box to size the image
against, so the image is sized by the SVG itself or by the caller.
The default implementation draws nothing, so that implementations written against an earlier version of this interface keep compiling and working. It logs a warning so that a silently undrawn image is at least visible.
svgElement - the root svg elementuri - where the SVG was loaded from, for loggingtargetWidth - the width to draw at, in dots, or -1 to use the intrinsic widthtargetHeight - the height to draw at, in dots, or -1 to use the intrinsic heightdotsPerPixel - dots per CSS pixeldefault void withUserAgent(UserAgentCallback userAgentCallback)
void addFontFile(File fontFile, String family, Integer weight, BaseRendererBuilder.FontStyle style) throws IOException, FontFormatException
IOExceptionFontFormatExceptiondefault void addFontStream(FSSupplier<InputStream> supplier, String family, Integer weight, BaseRendererBuilder.FontStyle style) throws IOException, FontFormatException
useFont(FSSupplier<InputStream>, ...) can be used
by SVG (or MathML) content too.
The default implementation ignores the font, so that implementations written against an earlier version of this interface keep compiling and working. It logs a warning so that a silently ignored font is at least visible.
IOExceptionFontFormatExceptionCopyright © 2004–2026. All rights reserved.