# OfficeRasterText

Text layout and raster effects shared by managed image-editing consumers.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`1d5ef38d1e0b` with working tree changes

**Source**

[OfficeRasterText.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L14)

**Modifiers**

static

Text layout and raster effects shared by managed image-editing consumers.

## Inheritance

- object
- OfficeRasterText

Filter members 

Show inherited

## Methods

Draw 2 overloads

`public static void Draw(OfficeRasterImage target, string? text, double x, double y, double width, double height, OfficeColor color, double fontSize = 16, string? fontFamily = null, CancellationToken cancellationToken = default)` [#](#method-draw-officeimo-drawing-officerasterimage-string-double-double-double-double-officeimo-officecolor-double-string-threading-cancellationtoken)

[OfficeRasterText.cs:46](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L46)

Draws measured text, optional shadow, and a rounded raster outline over existing pixels.

Parameters

**target OfficeIMO.Drawing.OfficeRasterImage required**

**text string? required**

**x double required**

**y double required**

**width double required**

**height double required**

**color OfficeIMO.OfficeColor required**

**fontSize double = 16 optional**

**fontFamily string? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

`public static void Draw(OfficeRasterImage target, string? text, double x, double y, double width, double height, OfficeColor color, OfficeRasterTextOptions options, CancellationToken cancellationToken = default)` [#](#method-draw-officeimo-drawing-officerasterimage-string-double-double-double-double-officeimo-officecolor-officeimo-drawing-officerastertextoptions-threading-cancellationtoken)

[OfficeRasterText.cs:54](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L54)

Draws text and optional effects with the same shared font and layout settings used by measurement.

Parameters

**target OfficeIMO.Drawing.OfficeRasterImage required**

**text string? required**

**x double required**

**y double required**

**width double required**

**height double required**

**color OfficeIMO.OfficeColor required**

**options OfficeIMO.Drawing.OfficeRasterTextOptions required**

**cancellationToken System.Threading.CancellationToken = default optional**

`public static long EstimateAdditionalWorkingBytes(int width, int height, OfficeRasterTextOptions options)` [#](#method-estimateadditionalworkingbytes-int32-int32-officeimo-drawing-officerastertextoptions)

[OfficeRasterText.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L14)

Estimates peak managed text scratch storage beyond the target RGBA pixel buffer.

Parameters

**width int required**

Target image width in pixels.

**height int required**

Target image height in pixels.

**options OfficeIMO.Drawing.OfficeRasterTextOptions required**

Shared text and effect settings used by drawing.

Returns

`long` Additional bytes to retain in a composed operation's working-set budget.

Measure 2 overloads

`public static OfficeTextBlockLayout Measure(string? text, double fontSize = 16, string? fontFamily = null, double? wrapWidth = null, CancellationToken cancellationToken = default)` [#](#method-measure-string-double-string-nullable-system-double-threading-cancellationtoken)

[OfficeRasterText.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L23)

Measures authored lines or wraps them to a requested width using managed font metrics.

Parameters

**text string? required**

**fontSize double = 16 optional**

**fontFamily string? = null optional**

**wrapWidth double? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`OfficeTextBlockLayout`

`public static OfficeTextBlockLayout Measure(string? text, OfficeRasterTextOptions options, double? wrapWidth = null, CancellationToken cancellationToken = default)` [#](#method-measure-string-officeimo-drawing-officerastertextoptions-nullable-system-double-threading-cancellationtoken)

[OfficeRasterText.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/1d5ef38d1e0bc45ee35fa9829701a5d52fd16d26/OfficeIMO.Core/Raster/OfficeRasterText.cs#L32)

Measures text using the same captured font and layout settings as raster drawing.

Parameters

**text string? required**

Text to measure.

**options OfficeIMO.Drawing.OfficeRasterTextOptions required**

Shared font and layout settings.

**wrapWidth double? = null optional**

Finite positive wrap width, required when Wrap is enabled.

**cancellationToken System.Threading.CancellationToken = default optional**

Observes cancellation during measurement and layout.

Returns

`OfficeTextBlockLayout`

## 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:760897BF0C004D9B57DACE2D383773770BF0E6485BC918C7249D1071DD844EFD -->
