Skip to content

API Reference / @gtkx/cairo / ScaledFont

Class: ScaledFont ​

Defined in: scaled-font.d.ts:10

A cairo scaled font (cairo_scaled_font_t): a font face frozen at a given font matrix, transformation and set of font options, ready to measure text and positioned glyphs.

Constructors ​

Constructor ​

new ScaledFont(fontFace, fontMatrix, ctm, options): ScaledFont

Defined in: scaled-font.d.ts:16

Creates a scaled font from a font face, a font matrix, a user-to-device transformation and font options.

Parameters ​

fontFace ​

FontFace

fontMatrix ​

Matrix

ctm ​

Matrix

options ​

FontOptions

Returns ​

ScaledFont

Properties ​

__type__ ​

__type__: bigint

Defined in: scaled-font.d.ts:14

GType of CairoScaledFont, the boxed type this class is registered under.

Methods ​

extents() ​

extents(): FontExtents

Defined in: scaled-font.d.ts:20

Returns the metrics of the font.

Returns ​

FontExtents


getCtm() ​

getCtm(): Matrix

Defined in: scaled-font.d.ts:32

Returns the user-to-device transformation the scaled font was created with.

Returns ​

Matrix


getFontFace() ​

getFontFace(): FontFace

Defined in: scaled-font.d.ts:26

Returns the font face the scaled font was created from, wrapped as its concrete class.

Returns ​

FontFace


getFontMatrix() ​

getFontMatrix(): Matrix

Defined in: scaled-font.d.ts:30

Returns the font matrix the scaled font was created with.

Returns ​

Matrix


getFontOptions() ​

getFontOptions(): FontOptions

Defined in: scaled-font.d.ts:28

Returns a copy of the font options the scaled font was created with.

Returns ​

FontOptions


getReferenceCount() ​

getReferenceCount(): number

Defined in: scaled-font.d.ts:38

Returns the reference count of the scaled font.

Returns ​

number


getScaleMatrix() ​

getScaleMatrix(): Matrix

Defined in: scaled-font.d.ts:34

Returns the scale matrix: the font matrix multiplied by the transformation, without translation.

Returns ​

Matrix


getType() ​

getType(): FontType

Defined in: scaled-font.d.ts:36

Returns the backend the scaled font belongs to.

Returns ​

FontType


glyphExtents() ​

glyphExtents(glyphs): TextExtents

Defined in: scaled-font.d.ts:24

Measures positioned glyphs with the font.

Parameters ​

glyphs ​

CairoGlyph[]

Returns ​

TextExtents


status() ​

status(): Status

Defined in: scaled-font.d.ts:18

Returns the error status of the scaled font, Status.SUCCESS when it is usable.

Returns ​

Status


textExtents() ​

textExtents(text): TextExtents

Defined in: scaled-font.d.ts:22

Measures text with the font.

Parameters ​

text ​

string

Returns ​

TextExtents


create() ​

static create(fontFace, fontMatrix, ctm, options): ScaledFont

Defined in: scaled-font.d.ts:12

Creates a scaled font, the same as new ScaledFont(fontFace, fontMatrix, ctm, options).

Parameters ​

fontFace ​

FontFace

fontMatrix ​

Matrix

ctm ​

Matrix

options ​

FontOptions

Returns ​

ScaledFont