@univerjs/engine-render v0.4.2 • Docs
Class: FontCache
Constructors
new FontCache()
new FontCache(): FontCache
Returns
Accessors
globalFontMeasureCache
get static globalFontMeasureCache(): Map<string, Map<string, IMeasureTextCache>>
Returns
Map
<string
, Map
<string
, IMeasureTextCache
>>
Defined in
Methods
autoCleanFontMeasureCache()
static autoCleanFontMeasureCache(cacheLimit): boolean
Parameters
Parameter | Type | Default value |
---|---|---|
cacheLimit | number | 1000000 |
Returns
boolean
Defined in
clearFontMeasureCache()
static clearFontMeasureCache(path): boolean
Parameters
Parameter | Type |
---|---|
path | string |
Returns
boolean
Defined in
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
Parameter | Type |
---|---|
glyphInfo | IOpenTypeGlyphInfo |
fontStyle | IDocumentSkeletonFontStyle |
Returns
{
aba: number;
abd: number;
ba: number;
bd: number;
sbo: number;
sbr: 0.6;
sp: number;
spo: number;
spr: 0.6;
width: number;
}
Defined in
getBaselineOffsetInfo()
static getBaselineOffsetInfo(fontFamily, fontSize): {
sbo: fontSize;
sbr: 0.6;
spo: fontSize;
spr: 0.6;
}
Parameters
Parameter | Type |
---|---|
fontFamily | string |
fontSize | number |
Returns
{
sbo: fontSize;
sbr: 0.6;
spo: fontSize;
spr: 0.6;
}
Defined in
getFontMeasureCache()
static getFontMeasureCache(fontStyle, content): Nullable<IMeasureTextCache>
Parameters
Parameter | Type |
---|---|
fontStyle | string |
content | string |
Returns
Defined in
getMeasureText()
static getMeasureText(content, fontString): IMeasureTextCache
Parameters
Parameter | Type |
---|---|
content | string |
fontString | string |
Returns
Defined in
getTextSize()
static getTextSize(content, fontStyle): IDocumentSkeletonBoundingBox
Parameters
Parameter | Type |
---|---|
content | string |
fontStyle | IDocumentSkeletonFontStyle |
Returns
Defined in
getTextSizeByDom()
static getTextSizeByDom(text, fontStyle): {
height: number;
width: number;
}
Parameters
Parameter | Type |
---|---|
text | string |
fontStyle | string |
Returns
{
height: number;
width: number;
}
Defined in
setFontMeasureCache()
static setFontMeasureCache(
fontStyle,
content,
tm): void
Parameters
Parameter | Type |
---|---|
fontStyle | string |
content | string |
tm | IMeasureTextCache |
Returns
void