Skip to content

@pdfa-lab/fontkit / BoundingBox

Class: BoundingBox ​

Defined in: src/glyph/bounding-box.ts:4

Represents a glyph bounding box.

Extended by ​

Constructors ​

Constructor ​

new BoundingBox(minX?, minY?, maxX?, maxY?): BoundingBox

Defined in: src/glyph/bounding-box.ts:25

Creates an instance of a bounding box.

Parameters ​

ParameterTypeDefault valueDescription
minXnumberInfinityThe initial minimum X position. Defaults to Infinity.
minYnumberInfinityThe initial minimum Y position. Defaults to Infinity.
maxXnumber-InfinityThe initial maximum X position. Defaults to -Infinity.
maxYnumber-InfinityThe initial maximum Y position. Defaults to -Infinity.

Returns ​

BoundingBox

Accessors ​

height ​

Get Signature ​

get height(): number

Defined in: src/glyph/bounding-box.ts:79

The height of the bounding box.

Returns ​

number


maxX ​

Get Signature ​

get maxX(): number

Defined in: src/glyph/bounding-box.ts:53

Returns ​

number

Set Signature ​

set maxX(x): void

Defined in: src/glyph/bounding-box.ts:57

Parameters ​
ParameterType
xnumber
Returns ​

void


maxY ​

Get Signature ​

get maxY(): number

Defined in: src/glyph/bounding-box.ts:61

Returns ​

number

Set Signature ​

set maxY(y): void

Defined in: src/glyph/bounding-box.ts:65

Parameters ​
ParameterType
ynumber
Returns ​

void


minX ​

Get Signature ​

get minX(): number

Defined in: src/glyph/bounding-box.ts:37

Returns ​

number

Set Signature ​

set minX(x): void

Defined in: src/glyph/bounding-box.ts:41

Parameters ​
ParameterType
xnumber
Returns ​

void


minY ​

Get Signature ​

get minY(): number

Defined in: src/glyph/bounding-box.ts:45

Returns ​

number

Set Signature ​

set minY(y): void

Defined in: src/glyph/bounding-box.ts:49

Parameters ​
ParameterType
ynumber
Returns ​

void


width ​

Get Signature ​

get width(): number

Defined in: src/glyph/bounding-box.ts:72

The width of the bounding box.

Returns ​

number

Methods ​

addPoint() ​

addPoint(x, y): void

Defined in: src/glyph/bounding-box.ts:91

Expands the bounding box to include the specified coordinate point. Finite coordinates are ignored if they don't expand the current bounds. Infinite values are explicitly ignored.

Parameters ​

ParameterTypeDescription
xnumberThe X coordinate of the point to add.
ynumberThe Y coordinate of the point to add.

Returns ​

void


copy() ​

copy(): BoundingBox

Defined in: src/glyph/bounding-box.ts:118

Creates a deep copy of the current bounding box instance.

Returns ​

BoundingBox

A new BoundingBox instance with matching dimensions.