MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / computeFontCacheKey

Function computeFontCacheKey

packages/core/ui/styling/font.ios.ts:20–24  ·  view source on GitHub ↗
(fontDescriptor: FontDescriptor)

Source from the content-addressed store, hash-verified

18const uiFontCache = new Map<string, UIFont>();
19
20function computeFontCacheKey(fontDescriptor: FontDescriptor) {
21 const { fontFamily, fontSize, fontWeight, fontVariationSettings, isBold, isItalic } = fontDescriptor;
22 const sep = ':';
23 return [fontFamily.join(sep), fontSize, fontWeight, String(FontVariationSettings.toString(fontVariationSettings)).replace(/'/g, '').replace(/[\s,]/g, '_'), isBold, isItalic].join(sep);
24}
25
26function getUIFontCached(fontDescriptor: FontDescriptor) {
27 const cacheKey = computeFontCacheKey(fontDescriptor);

Callers 1

getUIFontCachedFunction · 0.70

Calls 4

joinMethod · 0.80
replaceMethod · 0.80
StringClass · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected