# GlyphDrawingOptions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-glyphdrawingoptions/

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

```rust
struct GlyphDrawingOptions
```

Options that influence how a single glyph is drawn, independent of variable-font
axis configuration: which CPAL palette to use for color glyphs, and which bitmap
strike size to prefer for bitmap-based glyphs.

All properties are optional. `None` means "use the font's default" (palette 0
for color glyphs; no bitmap strike preference). Concerns specific to variable fonts
(axis coordinates, named instances) live on `FontVariationSettings`.

A record with init-only properties: a value is built from `GlyphDrawingOptions::new`
with `GlyphDrawingOptions::with_palette_index` and
`GlyphDrawingOptions::with_pixel_size`, which validate as the property initialisers do.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L13)

## Members

- [`DEFAULT`](#assoc_const-default)
- [`new`](#function-new)
- [`palette_index`](#function-palette_index)
- [`with_palette_index`](#function-with_palette_index)
- [`pixel_size`](#function-pixel_size)
- [`with_pixel_size`](#function-with_pixel_size)

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

### DEFAULT

```rust
const DEFAULT: GlyphDrawingOptions
```

The instance representing "use the font's defaults".

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L20)

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

### new

```rust
const fn new() -> GlyphDrawingOptions
```

Creates options that use the font's defaults.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L23)

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

### palette_index

```rust
fn palette_index(self: &Self) -> Option<i32>
```

Gets the optional `CPAL` palette index used to resolve colors for
COLR v0 / COLR v1 glyphs.

When `None`, the font's default palette (palette 0) is used.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L31)

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

### with_palette_index

```rust
fn with_palette_index(self: Self, value: Option<i32>) -> GlyphDrawingOptions
```

Returns a copy of the options with the given palette index.
## Panics

When the value is negative (`ArgumentOutOfRangeException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L40)

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

### pixel_size

```rust
fn pixel_size(self: &Self) -> Option<i32>
```

Gets the optional pixel size used to select a bitmap strike from `sbix`,
`CBDT` or `EBDT` tables.

When `None`, no bitmap strike is selected and the font's outline (or
color-layer) representation is used instead.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L56)

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

### with_pixel_size

```rust
fn with_pixel_size(self: Self, value: Option<i32>) -> GlyphDrawingOptions
```

Returns a copy of the options with the given pixel size.
## Panics

When the value is less than 1 (`ArgumentOutOfRangeException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/glyph_drawing_options.rs#L65)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`

## Availability

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