Skip to content
ChartForgeX
Class

LabelPlacementService

ChartForgeX.Rendering

Namespace
ChartForgeX.Rendering
Assembly
ChartForgeX
Modifiers
sealed

Places labels with the same font resolution and shaping used by PNG text, with a bounded measurement cache.

Inheritance

  • object
  • LabelPlacementService

Remarks

For the same fonts and input order, placement is deterministic. Unresolvable fonts use portable measurements. Intersections with other labels and marks are rejected. Intentional containment in an associated mark is allowed.

Constructors

public LabelPlacementService() #

Methods

public TextMetrics Measure(string text, TextStyle style) #

Measures shaped text with real font metrics, or a portable estimate if no font is available.

Parameters

text string required
style ChartForgeX.Typography.TextStyle required
public IReadOnlyList<PlacedLabel> Place(IReadOnlyList<LabelPlacementRequest> requests, ChartRect bounds, IReadOnlyList<LabelObstacle>? obstacles = null, double gap = 2) #

Places a complete scene, returning results in the original request order.

Parameters

requests System.Collections.Generic.IReadOnlyList<ChartForgeX.Rendering.LabelPlacementRequest> required
Label requests in stable input order.
bounds ChartForgeX.Primitives.ChartRect required
The usable scene rectangle.
obstacles System.Collections.Generic.IReadOnlyList<ChartForgeX.Rendering.LabelObstacle>? = null optional
Mark rectangles to avoid.
gap double = 2 optional
Minimum separation in logical pixels.

Returns

IReadOnlyList<PlacedLabel>