Skip to content
generated from qq15725/starter-ts

🚀 A text renderer. supports measure、special effects、deformation、highlight etc.

License

Notifications You must be signed in to change notification settings

qq15725/modern-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modern-text

Minzip Version Downloads Issues License

Usage

import { fonts } from 'modern-font'
import { renderText } from 'modern-text'

fonts.loadFallbackFont('/fallback.woff').then(() => {
  const view = document.createElement('canvas')
  document.body.append(view)

  renderText({
    view,
    style: {
      width: 100,
      height: 200,
      fontSize: 22,
      textDecoration: 'underline',
    },
    content: [
      {
        letterSpacing: 3,
        fragments: [
          { content: 'He', color: 'red', fontSize: 12 },
          { content: 'llo', color: 'black' },
        ],
      },
      { content: ', ', color: 'grey' },
      { content: 'World!', color: 'black' },
    ],
  })
})

About

🚀 A text renderer. supports measure、special effects、deformation、highlight etc.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published