# PdfFontType1

## Content

# Class: PdfFontType1

Represents a Type1 font in a PDF document.

## Extends

- [`PdfFontSimple`](PdfFontSimple)

## Accessors

### baseFont

#### Get Signature

```ts
get baseFont(): string;
```

Gets or sets the PostScript name of the font.

##### Returns

`string`

#### Set Signature

```ts
set baseFont(value): void;
```

Gets or sets the PostScript name of the font.

##### Parameters

###### value

`string`

##### Returns

`void`

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`baseFont`](PdfFontSimple#basefont)

***

### id

#### Get Signature

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

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

***

### isEmbedded

#### Get Signature

```ts
get isEmbedded(): boolean;
```

Gets a value indicating whether the font is embedded.

##### Returns

`boolean`

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`isEmbedded`](PdfFontSimple#isembedded)

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

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

## Methods

### createNativeFont()

```ts
createNativeFont(): Font;
```

Gets a [Font](Font) object created from the embedded font data.

Note that this method will return <b>null</b> if the font is not embedded
or does not support this operation (e.g. Type3 fonts).

#### Returns

[`Font`](Font)

The [Font](Font) object.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`createNativeFont`](PdfFontSimple#createnativefont)

***

### findNativeFont()

```ts
findNativeFont(doc, allowStandardPdfFonts?): Font;
```

Finds the most suitable native font for rendering text associated with this PDF font.

The PDF specification does not define a precise algorithm for selecting a font
when no embedded font data is available. This method uses a combination
of heuristics and practical strategies to choose an appropriate native font.

#### Parameters

##### doc

[`PdfDocument`](PdfDocument)

The [PdfDocument](PdfDocument) that owns this font.

##### allowStandardPdfFonts?

`boolean`

If true (the default), also searches the 14 standard PDF fonts
if a suitable font could not be found among the registered fonts.

#### Returns

[`Font`](Font)

The native font that matches the current PDF font, or null if a match could not be found.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`findNativeFont`](PdfFontSimple#findnativefont)

***

### free()

```ts
free(): void;
```

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

#### Returns

`void`

#### Inherited from

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

***

### getEmbeddedData()

```ts
getEmbeddedData(): Uint8Array<ArrayBufferLike>;
```

Returns the embedded font data, returns null if the font is not embedded.

#### Returns

`Uint8Array`&lt;`ArrayBufferLike`&gt;

The embedded font data or null if the font is not embedded.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`getEmbeddedData`](PdfFontSimple#getembeddeddata)

***

### getFontAttributes()

```ts
getFontAttributes(): PdfFontAttributes;
```

Extracts the attributes of the current font.
If a specific attribute cannot be determined,
the corresponding value is set to null.

#### Returns

[`PdfFontAttributes`](../interfaces/PdfFontAttributes)

The [PdfFontAttributes](../interfaces/PdfFontAttributes) object containing the font attributes.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`getFontAttributes`](PdfFontSimple#getfontattributes)

***

### getFontDescriptor()

```ts
getFontDescriptor(): PdfFontDescriptor;
```

Gets a [PdfFontDescriptor](PdfFontDescriptor) object that describes the font.

#### Returns

[`PdfFontDescriptor`](PdfFontDescriptor)

The [PdfFontDescriptor](PdfFontDescriptor) object.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`getFontDescriptor`](PdfFontSimple#getfontdescriptor)

***

### rebind()

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

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

***

### removeEmbeddedData()

```ts
removeEmbeddedData(doc): void;
```

Removes the embedded font data.

Please note that a PDF may display incorrectly after removing an embedded font's data. Use with caution.

#### Parameters

##### doc

[`PdfDocument`](PdfDocument)

The document that owns the font.

#### Returns

`void`

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`removeEmbeddedData`](PdfFontSimple#removeembeddeddata)

***

### tryGetPdfCode()

```ts
tryGetPdfCode(unicode): PdfCodeInfo;
```

Tries to convert a Unicode value to the character's PDF code.

Note that this method can fail if the font does not contain the necessary info for the conversion
or does not contain the specified Unicode value, in this case null is returned.

Note also that this method can be slow as it uses large font tables like /Encoding, /ToUnicode etc.,
so it is recommended that the returned results are cached by the caller.

#### Parameters

##### unicode

`string`

The character Unicode.

#### Returns

[`PdfCodeInfo`](../interfaces/PdfCodeInfo)

The [PdfCodeInfo](../interfaces/PdfCodeInfo) object containing the character PDF code, or null if the conversion failed.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`tryGetPdfCode`](PdfFontSimple#trygetpdfcode)

***

### tryGetUnicode()

```ts
tryGetUnicode(pdfCode): string;
```

Converts a character's PDF code to its Unicode value.

Note that this method can fail if the font does not contain the necessary info for the conversion,
in this case null is returned.

Note also that this method can be slow as it uses large font tables like /Encoding, /ToUnicode etc.,
so the returned results better be cached by the caller.

#### Parameters

##### pdfCode

`number`

The character PDF code.

#### Returns

`string`

The character Unicode, or null if the conversion failed.

#### Inherited from

[`PdfFontSimple`](PdfFontSimple).[`tryGetUnicode`](PdfFontSimple#trygetunicode)
