# LabelPlacementService

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

 Class  

`ChartForgeX.Rendering`

**Namespace**

`ChartForgeX.Rendering`

**Assembly**

`ChartForgeX`

**Source**

[LabelPlacementService.cs:17](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Rendering/LabelPlacementService.cs#L17)

**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.

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Measured label placement](/docs/label-placement/) Guide 
  
  Shared SVG/PNG text measurement, collision handling and diagnostics.

 Filter members   

    Show inherited   

 

## Constructors

 `public LabelPlacementService()` [#](#constructor-ctor) 

[LabelPlacementService.cs:17](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Rendering/LabelPlacementService.cs#L17)

## Methods

 `public TextMetrics Measure(string text, TextStyle style)` [#](#method-measure-string-chartforgex-typography-textstyle) 

[LabelPlacementService.cs:21](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Rendering/LabelPlacementService.cs#L21)

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**

Returns

 `TextMetrics` 

 `public IReadOnlyList<PlacedLabel> Place(IReadOnlyList<LabelPlacementRequest> requests, ChartRect bounds, IReadOnlyList<LabelObstacle>? obstacles = null, double gap = 2)` [#](#method-place-collections-generic-ireadonlylist-chartforgex-rendering-labelplacementrequest-chartforgex-primitives-chartrect-collections-generic-ireadonlylist-chartforgex-rendering-labelobstacle-double) 

[LabelPlacementService.cs:92](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Rendering/LabelPlacementService.cs#L92)

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>` 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

<!-- PowerForge markdown artifact sha256:350364BAE784A85373113D7D9343ACBE37B447D8BD3F6D016494426BC1CA15E4 -->
