# Format

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / Format

# Class: Format

Represents a text format.

## Extends

- [`ObjectBase`](ObjectBase)

## Constructors

### Constructor

> **new Format**(`formatProperties`): `Format`

Creates a new Format object with specified properties.

#### Parameters

##### formatProperties

[`FormatProperties`](../type-aliases/FormatProperties)

Text formatting attributes such as font, colors, decorations and so on.

#### Returns

`Format`

#### Overrides

`ObjectBase.constructor`

### Constructor

> **new Format**(`baseFormat`, `formatProperties`): `Format`

Creates a new Format based on properties of an existing Format.

#### Parameters

##### baseFormat

`Format`

The Format used as the base for the new Format.

##### formatProperties

[`FormatProperties`](../type-aliases/FormatProperties)

The settings overriding properties of the base Format.

#### Returns

`Format`

#### Overrides

`ObjectBase.constructor`

### Constructor

> **new Format**(`om`, `formatProperties`): `Format`

Creates a new Format object with specified properties.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the Format object.

##### formatProperties

[`FormatProperties`](../type-aliases/FormatProperties)

Text formatting attributes such as font, colors, decorations and so on.

#### Returns

`Format`

#### Overrides

`ObjectBase.constructor`

## Accessors

### allowFontSbits

#### Get Signature

> **get** **allowFontSbits**(): `boolean`

Gets a value indicating if the embedded bitmaps from the EBDT font table can be used.

##### Returns

`boolean`

***

### backColor

#### Get Signature

> **get** **backColor**(): [`Color`](../type-aliases/Color)

Gets the text background color.

##### Returns

[`Color`](../type-aliases/Color)

***

### bold

#### Get Signature

> **get** **bold**(): `boolean`

Gets a value indicating whether the font should be bolded.

##### Returns

`boolean`

***

### charWidthFactor

#### Get Signature

> **get** **charWidthFactor**(): `number`

Gets the character width scale factor. Values are between 0.1 and 10.0.

##### Returns

`number`

***

### doubleUnderline

#### Get Signature

> **get** **doubleUnderline**(): `boolean`

Gets a value indicating if the text is double underlined.

##### Returns

`boolean`

***

### fillBrush

#### Get Signature

> **get** **fillBrush**(): [`Brush`](Brush) \| `null`

Gets the brush to fill the glyphs.

##### Returns

[`Brush`](Brush) \| `null`

***

### font

#### Get Signature

> **get** **font**(): [`Font`](Font) \| `null`

Gets the [Font](Font) used by this Format.

##### Returns

[`Font`](Font) \| `null`

***

### fontFamily

#### Get Signature

> **get** **fontFamily**(): `string`

Gets the font family name.

##### Returns

`string`

***

### fontFeatures

#### Get Signature

> **get** **fontFeatures**(): [`FontFeature`](../type-aliases/FontFeature)[] \| `null`

Gets the array of assigned Microsoft OpenType typography properties.

##### Returns

[`FontFeature`](../type-aliases/FontFeature)[] \| `null`

***

### fontSize

#### Get Signature

> **get** **fontSize**(): `number`

Gets the logical font size, in graphic units.

##### Returns

`number`

***

### foreColor

#### Get Signature

> **get** **foreColor**(): [`Color`](../type-aliases/Color)

Gets the text foreground color.

##### Returns

[`Color`](../type-aliases/Color)

***

### glyphAdvanceFactor

#### Get Signature

> **get** **glyphAdvanceFactor**(): `number`

Gets the scaling factor for the glyph advance value relative to font's Average Character Width. Values are from 0.5 up.

##### Returns

`number`

***

### glyphAdvanceOffset

#### Get Signature

> **get** **glyphAdvanceOffset**(): `number`

Gets the absolute increment (delta) for the glyph advance value, in graphic units.

##### Returns

`number`

***

### glyphWidths

#### Get Signature

> **get** **glyphWidths**(): [`GlyphWidths`](../enumerations/GlyphWidths)

Gets the preferred glyph widths (generally used in CJKV fonts).

##### Returns

[`GlyphWidths`](../enumerations/GlyphWidths)

***

### hollow

#### Get Signature

> **get** **hollow**(): `boolean`

Gets a value indicating if the glyphs are hollow (outlined), otherwise they are solid.

##### Returns

`boolean`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### italic

#### Get Signature

> **get** **italic**(): `boolean`

Gets a value indicating whether the font should be italicized.

##### Returns

`boolean`

***

### language

#### Get Signature

> **get** **language**(): `string`

Gets the Neutral Culture string, if assigned.

##### Returns

`string`

***

### lineGap

#### Get Signature

> **get** **lineGap**(): `number` \| `null`

Gets the explicit line gap (if not null), in graphic units.

##### Returns

`number` \| `null`

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

***

### paletteIndex

#### Get Signature

> **get** **paletteIndex**(): `number` \| `null`

Gets the index of a palette used for drawing color fonts.

##### Returns

`number` \| `null`

***

### recalcFontSizeForFallbackFonts

#### Get Signature

> **get** **recalcFontSizeForFallbackFonts**(): `boolean`

Gets a value indicating whether the size of a fallback font should be coerced to the size of original font.

##### Returns

`boolean`

***

### sidewaysInVerticalText

#### Get Signature

> **get** **sidewaysInVerticalText**(): `boolean`

Gets a value indicating if all characters should appear as rotated 90 or -90 degrees in vertical text.

##### Returns

`boolean`

***

### skipNormalization

#### Get Signature

> **get** **skipNormalization**(): `boolean`

Gets a value indicating whether the canonical decomposition, reordering, and composition stages should be omitted.

##### Returns

`boolean`

***

### strictCanonicalDecomposition

#### Get Signature

> **get** **strictCanonicalDecomposition**(): `boolean`

Gets a value indicating whether to apply normalization to Singleton Decompositions and Post Composition Version precomposed characters.

##### Returns

`boolean`

***

### strikethrough

#### Get Signature

> **get** **strikethrough**(): `boolean`

Gets a value indicating if the strikethrough style is applied to the text.

##### Returns

`boolean`

***

### strokePen

#### Get Signature

> **get** **strokePen**(): [`Pen`](Pen) \| `null`

Gets the pen to draw glyph outlines.

##### Returns

[`Pen`](Pen) \| `null`

***

### subscript

#### Get Signature

> **get** **subscript**(): `boolean`

Gets a value indicating if the glyphs should be displayed as subscript.

##### Returns

`boolean`

***

### superscript

#### Get Signature

> **get** **superscript**(): `boolean`

Gets a value indicating if the glyphs should be displayed as superscript.

##### Returns

`boolean`

***

### textRunAsCluster

#### Get Signature

> **get** **textRunAsCluster**(): `boolean`

Gets a value indicating whether the whole text run should be considered as a single Grapheme Cluster.

##### Returns

`boolean`

***

### transformToFullWidth

#### Get Signature

> **get** **transformToFullWidth**(): `boolean`

Gets a value indicating if ASCII characters should be transformed into fullwidth characters.

##### Returns

`boolean`

***

### transverseOffset

#### Get Signature

> **get** **transverseOffset**(): `number`

Gets the offset of the text in the orthogonal direction, in graphic units.

##### Returns

`number`

***

### treatHyphenMinusAsHyphen

#### Get Signature

> **get** **treatHyphenMinusAsHyphen**(): `boolean`

Gets a value indicating whether the character 'HYPHEN-MINUS' (U+002D) is treated as the character 'HYPHEN' (U+2010) by the Unicode line breaking algorithm.

##### Returns

`boolean`

***

### underline

#### Get Signature

> **get** **underline**(): `boolean`

Gets a value indicating if the text is underlined.

##### Returns

`boolean`

***

### uprightInVerticalText

#### Get Signature

> **get** **uprightInVerticalText**(): `boolean`

Gets a value indicating if the normally sideways characters should be drawn upright in vertical text.

##### Returns

`boolean`

***

### useHorizontalMetricsForVerticalText

#### Get Signature

> **get** **useHorizontalMetricsForVerticalText**(): `boolean`

Gets a value indicating if the horizontal ascending, descending, and line gap settings should be applied to vertical text.

##### Returns

`boolean`

***

### useTypoMetrics

#### Get Signature

> **get** **useTypoMetrics**(): `boolean`

Gets a value indicating whether the typographical font metrics should be applied instead of Windows-specific and Apple-specific font metrics.

##### Returns

`boolean`

***

### useVerticalLineGapForSideways

#### Get Signature

> **get** **useVerticalLineGapForSideways**(): `boolean`

Gets a value indicating that for sideways text in vertical flow, line gap will be set according to [Font.verticalLineGap](Font#verticallinegap).
If false, line gap for lines containing sideways text is set according to [Font.horizontalLineGap](Font#horizontallinegap),
which can lead to different gaps between columns that contain sideways text runs and those that do not.

##### Returns

`boolean`

## Methods

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)
