API Reference
@univerjs
@univerjs/engine-render
classes
Fontcache

@univerjs/engine-render v0.4.2Docs


Class: FontCache

Constructors

new FontCache()

new FontCache(): FontCache

Returns

FontCache

Accessors

globalFontMeasureCache

get static globalFontMeasureCache(): Map<string, Map<string, IMeasureTextCache>>

Returns

Map<string, Map<string, IMeasureTextCache>>

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:69 (opens in a new tab)

Methods

autoCleanFontMeasureCache()

static autoCleanFontMeasureCache(cacheLimit): boolean

Parameters

ParameterTypeDefault value
cacheLimitnumber1000000

Returns

boolean

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:104 (opens in a new tab)


clearFontMeasureCache()

static clearFontMeasureCache(path): boolean

Parameters

ParameterType
pathstring

Returns

boolean

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:84 (opens in a new tab)


getBBoxFromGlyphInfo()

static getBBoxFromGlyphInfo(glyphInfo, fontStyle): {
  aba: number;
  abd: number;
  ba: number;
  bd: number;
  sbo: number;
  sbr: 0.6;
  sp: number;
  spo: number;
  spr: 0.6;
  width: number;
}

Parameters

ParameterType
glyphInfoIOpenTypeGlyphInfo
fontStyleIDocumentSkeletonFontStyle

Returns

{
  aba: number;
  abd: number;
  ba: number;
  bd: number;
  sbo: number;
  sbr: 0.6;
  sp: number;
  spo: number;
  spr: 0.6;
  width: number;
}
NameTypeDefault valueDefined in
abanumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:370 (opens in a new tab)
abdnumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:371 (opens in a new tab)
banumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:368 (opens in a new tab)
bdnumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:369 (opens in a new tab)
sbonumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:376 (opens in a new tab)
sbrnumber0.6submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:373 (opens in a new tab)
spnumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:372 (opens in a new tab)
sponumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:377 (opens in a new tab)
sprnumber0.6submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:374 (opens in a new tab)
widthnumber-submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:367 (opens in a new tab)

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:204 (opens in a new tab)


getBaselineOffsetInfo()

static getBaselineOffsetInfo(fontFamily, fontSize): {
  sbo: fontSize;
  sbr: 0.6;
  spo: fontSize;
  spr: 0.6;
}

Parameters

ParameterType
fontFamilystring
fontSizenumber

Returns

{
  sbo: fontSize;
  sbr: 0.6;
  spo: fontSize;
  spr: 0.6;
}
NameTypeDefault valueDefined in
sbonumberfontSizesubmodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:34 (opens in a new tab)
sbrnumber0.6submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:33 (opens in a new tab)
sponumberfontSizesubmodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:36 (opens in a new tab)
sprnumber0.6submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:35 (opens in a new tab)

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:140 (opens in a new tab)


getFontMeasureCache()

static getFontMeasureCache(fontStyle, content): Nullable<IMeasureTextCache>

Parameters

ParameterType
fontStylestring
contentstring

Returns

Nullable<IMeasureTextCache>

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:99 (opens in a new tab)


getMeasureText()

static getMeasureText(content, fontString): IMeasureTextCache

Parameters

ParameterType
contentstring
fontStringstring

Returns

IMeasureTextCache

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:223 (opens in a new tab)


getTextSize()

static getTextSize(content, fontStyle): IDocumentSkeletonBoundingBox

Parameters

ParameterType
contentstring
fontStyleIDocumentSkeletonFontStyle

Returns

IDocumentSkeletonBoundingBox

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:188 (opens in a new tab)


getTextSizeByDom()

static getTextSizeByDom(text, fontStyle): {
  height: number;
  width: number;
}

Parameters

ParameterType
textstring
fontStylestring

Returns

{
  height: number;
  width: number;
}
NameTypeDefined in
heightnumbersubmodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:61 (opens in a new tab)
widthnumbersubmodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:61 (opens in a new tab)

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:166 (opens in a new tab)


setFontMeasureCache()

static setFontMeasureCache(
   fontStyle, 
   content, 
   tm): void

Parameters

ParameterType
fontStylestring
contentstring
tmIMeasureTextCache

Returns

void

Defined in

submodules/univer/packages/engine-render/src/components/docs/layout/shaping-engine/font-cache.ts:73 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.