fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
3 lines (2 loc) • 772 B
JavaScript
import{defineProperty as t}from"../_virtual/_rollupPluginBabelHelpers.min.mjs";import{config as e}from"./config.min.mjs";class h{constructor(){t(this,"charWidthsCache",{}),t(this,"boundsOfCurveCache",{})}getFontCache(t){let{fontFamily:e,fontStyle:h,fontWeight:a}=t;e=e.toLowerCase(),this.charWidthsCache[e]||(this.charWidthsCache[e]={});const o=this.charWidthsCache[e],r="".concat(h.toLowerCase(),"_").concat((a+"").toLowerCase());return o[r]||(o[r]={}),o[r]}clearFontCache(t){(t=(t||"").toLowerCase())?this.charWidthsCache[t]&&delete this.charWidthsCache[t]:this.charWidthsCache={}}limitDimsByArea(t){const{perfLimitSizeTotal:h}=e,a=Math.sqrt(h*t);return[Math.floor(a),Math.floor(h/a)]}}const a=new h;export{h as Cache,a as cache};
//# sourceMappingURL=cache.min.mjs.map