Class
LabelPlacementService
ChartForgeX.Rendering
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
- style ChartForgeX.Typography.TextStyle
Returns
TextMetricspublic 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>
- Label requests in stable input order.
- bounds ChartForgeX.Primitives.ChartRect
- The usable scene rectangle.
- obstacles System.Collections.Generic.IReadOnlyList<ChartForgeX.Rendering.LabelObstacle>? = null
- Mark rectangles to avoid.
- gap double = 2
- Minimum separation in logical pixels.
Returns
IReadOnlyList<PlacedLabel>