New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

canvas-text-opentypejs-shim

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-text-opentypejs-shim

Consistent text rendering for <canvas>

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-58.54%
Maintainers
1
Weekly downloads
 
Created
Source

canvas-text-opentypejs-shim

Text rendering shim for <canvas> backed by opentype.js. It allows you to get consistent results regardless of the OS, browser and the environment (Node.js). Works great with kangax/fabric.js.

Installation

Get it directly from NPM:

npm i --save canvas-text-opentypejs-shim

or through unpkg:

<script src="https://unpkg.com/canvas-text-opentypejs-shim@0.1.0></script>
(in this case shim will be available as window['canvas-text-opentypejs-shim']).

Usage

const useOpenTypeJsForText = require('canvas-text-opentypejs-shim')

const canvas ...
const ctx = canvas.getContext('2d')

useOpenTypeJsForText(ctx, {resolveFont: (o) => opentypeFontInstance})

ctx.font = '26px Roboto'
ctx.fillText(text, 50, 50)

Live Demo @ JS Bin.

Live Demo (using kangax/fabric.js) @ JS Bin.

Live Demo (using automattic/node-canvas) @ RunKit. Node.js

Demo (using kangax/fabric.js). Node.js

License

MIT

FAQs

Package last updated on 26 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc