# Block

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/documents/struct-block/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct Block
```

Base class for block-level text content. A block owns paragraph formatting;
character formatting continues to use the inherited [`TextElement`](/docs/0.5.0/api/ferroui-controls/documents/struct-textelement/) properties.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L30)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`text`](#function-text)
- [`build_text_runs`](#function-build_text_runs)
- [`measure_embedded_controls`](#function-measure_embedded_controls)
- [`text_alignment_property`](#function-text_alignment_property)
- [`line_height_property`](#function-line_height_property)
- [`line_stacking_strategy_property`](#function-line_stacking_strategy_property)
- [`margin_property`](#function-margin_property)
- [`flow_direction_property`](#function-flow_direction_property)
- [`construct`](#function-construct)
- [`text_length`](#function-text_length)
- [`text_alignment`](#function-text_alignment)
- [`set_text_alignment`](#function-set_text_alignment)
- [`horizontal_text_alignment`](#function-horizontal_text_alignment)
- [`set_horizontal_text_alignment`](#function-set_horizontal_text_alignment)
- [`line_height`](#function-line_height)
- [`set_line_height`](#function-set_line_height)
- [`line_stacking_strategy`](#function-line_stacking_strategy)
- [`set_line_stacking_strategy`](#function-set_line_stacking_strategy)
- [`margin`](#function-margin)
- [`set_margin`](#function-set_margin)
- [`flow_direction`](#function-flow_direction)
- [`set_flow_direction`](#function-set_flow_direction)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L34)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<Block>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L34)

<a id="function-text"></a>

### text

```rust
fn text(self: &Self) -> String
```

Returns the text of this block, without a following paragraph separator.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L34)

<a id="function-build_text_runs"></a>

### build_text_runs

```rust
fn build_text_runs(self: &Self, text_runs: &mut Vec<Rc<dyn TextRun>>)
```

Appends formatter runs in content order.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L34)

<a id="function-measure_embedded_controls"></a>

### measure_embedded_controls

```rust
fn measure_embedded_controls(self: &Self, available_size: Size) -> bool
```

Measures inline controls and reports whether a size changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L34)

<a id="function-text_alignment_property"></a>

### text_alignment_property

```rust
fn text_alignment_property() -> &'static StyledProperty<TextAlignment>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L79)

<a id="function-line_height_property"></a>

### line_height_property

```rust
fn line_height_property() -> &'static StyledProperty<f64>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L79)

<a id="function-line_stacking_strategy_property"></a>

### line_stacking_strategy_property

```rust
fn line_stacking_strategy_property() -> &'static StyledProperty<LineStackingStrategy>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L79)

<a id="function-margin_property"></a>

### margin_property

```rust
fn margin_property() -> &'static StyledProperty<Thickness>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L79)

<a id="function-flow_direction_property"></a>

### flow_direction_property

```rust
fn flow_direction_property() -> &'static StyledProperty<FlowDirection>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L79)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L107)

<a id="function-text_length"></a>

### text_length

```rust
fn text_length(self: &Self) -> usize
```

Length in UTF-16 code units, matching text formatter and document offsets.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L114)

<a id="function-text_alignment"></a>

### text_alignment

```rust
fn text_alignment(self: &Self) -> TextAlignment
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L118)

<a id="function-set_text_alignment"></a>

### set_text_alignment

```rust
fn set_text_alignment(self: &Self, value: TextAlignment)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L122)

<a id="function-horizontal_text_alignment"></a>

### horizontal_text_alignment

```rust
fn horizontal_text_alignment(self: &Self) -> TextAlignment
```

Alias of TextAlignment, sharing its backing property and inheritance.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L127)

<a id="function-set_horizontal_text_alignment"></a>

### set_horizontal_text_alignment

```rust
fn set_horizontal_text_alignment(self: &Self, value: TextAlignment)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L130)

<a id="function-line_height"></a>

### line_height

```rust
fn line_height(self: &Self) -> f64
```

`NaN` chooses the natural line height, as in the shared text formatter properties.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L135)

<a id="function-set_line_height"></a>

### set_line_height

```rust
fn set_line_height(self: &Self, value: f64)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L139)

<a id="function-line_stacking_strategy"></a>

### line_stacking_strategy

```rust
fn line_stacking_strategy(self: &Self) -> LineStackingStrategy
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L146)

<a id="function-set_line_stacking_strategy"></a>

### set_line_stacking_strategy

```rust
fn set_line_stacking_strategy(self: &Self, value: LineStackingStrategy)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L150)

<a id="function-margin"></a>

### margin

```rust
fn margin(self: &Self) -> Thickness
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L154)

<a id="function-set_margin"></a>

### set_margin

```rust
fn set_margin(self: &Self, value: Thickness)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L158)

<a id="function-flow_direction"></a>

### flow_direction

```rust
fn flow_direction(self: &Self) -> FlowDirection
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L162)

<a id="function-set_flow_direction"></a>

### set_flow_direction

```rust
fn set_flow_direction(self: &Self, value: FlowDirection)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/block.rs#L166)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`BlockImplExt`](/docs/0.5.0/api/ferroui-controls/documents/trait-blockimplext/)
- [`TextElementImplExt`](/docs/0.5.0/api/ferroui-controls/documents/trait-textelementimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Block>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`TextElementImpl`](/docs/0.5.0/api/ferroui-controls/documents/trait-textelementimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`BlockImpl`](/docs/0.5.0/api/ferroui-controls/documents/trait-blockimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
