New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@canvas-fonts/arial-italic

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvas-fonts/arial-italic

Arial Italic font packaged for node-canvas

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@canvas-fonts/arial-italic

Arial Italic package for canvas

Usage

const { registerFont, createCanvas } = require('canvas');
registerFont(require("@canvas-fonts/arial-italic"), { family: "Arial Italic" });
const canvas = createCanvas(400, 48);
const ctx = canvas.getContext('2d');
ctx.font = `24px "Arial Italic"`;
ctx.fillText("Arial Italic", 5, 30);
const png = canvas.toBuffer();

Will create this image:

preview

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!

Keywords

canvas

FAQs

Package last updated on 07 Dec 2021

Related posts