1.2.2 • Published 2 years ago

canvas-emojicdn v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

CANVAS + EMOJICDN

This is a simple implementation of the emojicdn service for Canvas.

Installation

npm install canvas-emojicnd

Usage

import { createCanvas, measureText } from 'canvas'
import { fillText } from 'canvas-emojicnd'

(async () => {
  const text = 'Hello, world!👋🥳'
  const canvas = createCanvas(200, 200)
  const ctx = canvas.getContext('2d')
  ctx.fillStyle = '#000'
  ctx.strokeStyle = '#fff'
  ctx.font = '25px Arial'
  
  // Get the width of the text
  const { width } = await measureText(ctx, text, 'whatsapp')

  // Draw the text:
  await fillText(ctx, text, canvas.width / 2 - width / 2, 100, 'whatsapp')
  await strokeText(ctx, text, canvas.width / 2 - width / 2, 200, 'whatsapp')

})()

Supported emoji styles:

  • apple
  • google
  • microsoft
  • samsung
  • whatsapp
  • twitter
  • messenger
  • joypixels
  • openmoji
  • emojidex
  • lg
  • htc
  • mozilla

If the emoji is not supported by the selected style, the emoji will be ignored.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago