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