UNPKG

dropflow

Version:

A small CSS2 document renderer built from specifications

18 lines (17 loc) 470 B
// Registers a canvas environment for node-canvas if it's present import { fileURLToPath } from 'url'; import { setCanvasEnvironment } from './canvas-environment.js'; let Canvas; try { Canvas = await import('canvas'); } catch (e) { // Canvas is undefined } if (Canvas && Canvas.registerFont) { setCanvasEnvironment({ registerFont(match) { Canvas.registerFont(fileURLToPath(match.url), { family: match.uniqueFamily }); } }); }