1.1.0 • Published 2 years ago

canvas-hansans v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Canvas-Hansans

This program allows you to use the SourceHanSans VF font in Canvas.

Font Family

・ExtraLight ・Light ・Medium ・Normal ・Regular ・Bold

Usage

const { registerFont, createCanvas } = require('canvas');
registerFont(require("canvas-hansans"), { family: "Source Han Sans VF Light" });
const canvas = createCanvas(400, 48);
const ctx = canvas.getContext('2d');
ctx.font = `24px "Source Han Sans VF Light"`;
ctx.fillText("Your message", 5, 30);
const png = canvas.toBuffer();

(All credits to RetroHacker. https://github.com/retrohacker/)