@canvas-fonts/times-new-roman-bold-italic
v1.0.4
Published
Times New Roman Bold Italic font packaged for node-canvas
Downloads
10
Readme
@canvas-fonts/times-new-roman-bold-italic
Times New Roman Bold Italic package for canvas
Usage
const { registerFont, createCanvas } = require('canvas');
registerFont(require("@canvas-fonts/times-new-roman-bold-italic"), { family: "Times New Roman Bold Italic" });
const canvas = createCanvas(400, 48);
const ctx = canvas.getContext('2d');
ctx.font = `24px "Times New Roman Bold Italic"`;
ctx.fillText("Times New Roman Bold Italic", 5, 30);
const png = canvas.toBuffer();
Will create this image:
Creating your own Fonts
This font is part of the canvas-fonts collection. To use your own fonts, simply:
- Create a new npm package
- Add your font file to the same directory as the
package.json
created in step 1. - Add the following
index.js
file in that same directory:
// Replace "MyAwesomeFont.ttf" with the filename of your font!
module.exports = require('path').join(__dirname, "MyAwesomeFont.ttf")
- Publish to npm!