Skip to content

BlockSuite API Documentation / @blocksuite/affine-block-surface / TextUtils

Variable: TextUtils

const TextUtils: object

Type declaration

getCursorByCoord()

getCursorByCoord: (model, coord) => number

Parameters

model

TextElementModel

coord
x

number

y

number

Returns

number

getFontFaces()

getFontFaces: () => FontFace[]

Returns

FontFace[]

getFontFacesByFontFamily()

getFontFacesByFontFamily: (fontFamily) => FontFace[]

Parameters

fontFamily

string

Returns

FontFace[]

getLineHeight()

getLineHeight: (fontFamily, fontSize, fontWeight) => number

Parameters

fontFamily

string

fontSize

number

fontWeight

string

Returns

number

isFontStyleSupported()

isFontStyleSupported: (fontFamily, style) => boolean

Parameters

fontFamily

string

style

FontStyle

Returns

boolean

isFontWeightSupported()

isFontWeightSupported: (fontFamily, weight) => boolean

Parameters

fontFamily

string

weight

FontWeight

Returns

boolean

isSameFontFamily()

isSameFontFamily: (fontFamily) => (fontFace) => boolean

Parameters

fontFamily

string

Returns

Function

Parameters
fontFace

FontFace

Returns

boolean

normalizeTextBound()

normalizeTextBound: (__namedParameters, bound, dragging) => Bound

Parameters

__namedParameters
fontFamily

FontFamily

fontSize

number

fontStyle

FontStyle

fontWeight

FontWeight

hasMaxWidth

boolean

maxWidth

number

yText

YText

bound

Bound

dragging

boolean = false

Returns

Bound

splitIntoLines()

splitIntoLines: (text) => string[]

Parameters

text

string

Returns

string[]

wrapFontFamily()

wrapFontFamily: (fontFamily) => string

Parameters

fontFamily

string

Returns

string

Defined in

packages/affine/block-surface/src/index.ts:107