package d2scenebuild
Import Path
github.com/pancsta/d2/d2renderers/d2scenebuild (on go.dev)
Dependency Relation
imports 48 packages, and imported by 2 packages
Involved Source Files
appendix.go
assets.go
Package d2scenebuild converts D2's typed export model into the immutable
scene consumed by d2raster.
code_shape.go
color.go
connection.go
font_fallback.go
labels.go
latex.go
legend.go
markdown.go
metadata.go
pattern_sources.go
patterns.go
shape_effects.go
sketch.go
sketch_connection.go
sketch_shapes.go
special_shapes.go
tooltip.go
Package-Level Type Names (total 6)
Resolver owns bounded image loading for this scene build.
[imageasset.ErrUnavailable] substitutes the built-in missing-image
placeholder; every other error aborts the build.
SVGImportBudget SVGImportBudget
SVGImportLimits d2svgimport.Limits
FontFallbackOptions bounds all primary/custom and resolved fallback font
assets retained by the scene. The resolver performs the explicit I/O phase
for code points absent from D2's configured fonts; d2raster never receives
it and performs no filesystem discovery while painting.
MaxAssets int
MaxBytes int64
MaxCoverageChecks int64
MaxFontFacesPerText, MaxShapingRuns, and MaxShapedGlyphs bound the
pure-Go shaping pass that materializes renderer-independent Glyphs after
fallback resolution. Zero selects bounded defaults.
MaxRunesPerText int
MaxShapedGlyphs int
MaxShapingRuns int
MaxTotalRunes int
Resolver d2fonts.FallbackResolver
LinkBudget is a document-wide ceiling on link/tooltip metadata and, when
Appendix is enabled, its corresponding static badges and row strings.
Callers rendering a diagram that contains such metadata must provide
positive limits; diagrams without metadata require no link budget.
MaxRegions int
MaxStringBytes int
Options configures scene construction. Scale changes the logical output
dimensions, while the raster device scale is supplied to d2raster
separately.
Appendix paints the numbered tooltip/link badges and static appendix
rows used by PNG, GIF, PDF, and PPTX exports. Interactive SVG callers
leave it false and retain typed metadata without static footnotes. Its
work is bounded by LinkBudget.
Assets configures the explicit, bounded I/O phase for image and
icon sources. Build stores only immutable bytes or imported vector scene
nodes in the returned document; d2raster never receives this resolver.
Center *bool
Fonts *FontFallbackOptions
LinkBudget LinkBudget
MaxNodes and MaxPathCommands enable an early, target-level admission
guard when positive. The guard rejects only when the target already
proves that the eventual scene must exceed a downstream renderer limit;
d2raster remains responsible for exact accounting of expanded geometry.
MaxPathCommands int
Pad *int64
Scale *float64
Sketch bool
SketchBudget SketchBudget
ThemeID *int64
ThemeOverrides *d2target.ThemeOverrides
func Build(ctx context.Context, diagram *d2target.Diagram, options Options) (*d2scene.Document, error)
SketchBudget is a document-wide ceiling on structured rough-go output.
MaxOperationSets and MaxOperations bound the generated intermediate work;
MaxPathCommands independently bounds the typed scene geometry retained by
the document. Callers enabling Sketch for paintable sketch geometry must
provide positive limits.
MaxOperationSets int
MaxOperations int
MaxPathCommands int
SVGImportBudget is a document-wide ceiling on parse and emitted-scene work
across all distinct imported SVG assets. SVGImportLimits independently
bounds the transient parse/compile work of each asset.
MaxAttributeBytes int
MaxAttributes int
MaxDeclaredResources int
MaxElements int
MaxExpandedUseInstances int
MaxPathCommands int
MaxSourceBytes int
MaxTransformFunctions int
Package-Level Functions (only one)
Build preflights diagram features and returns a fully resolved, network-free
scene. It never emits a partial scene on error.
Package-Level Constants (only one)
const DefaultPadding = 100
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |