Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 709 Bytes

File metadata and controls

42 lines (32 loc) · 709 Bytes

API

Factory

const doc = ByeText.create({
  canvas,
  text: 'Hello world',
  width: 320,
  height: 180,
  font: { family: 'system-ui', size: 16 }
})

High-level methods

  • setText(text)
  • setWidth(width)
  • setHeight(height)
  • layout()
  • render()

Query methods

  • getLineCount()
  • getTotalHeight()
  • getLine(index)
  • charToPosition(index)
  • positionToChar(x, y)
  • getRunAt(index)

Edit methods

  • insert(charIndex, text)
  • delete(charStart, charEnd)
  • setStyle(style, range)
  • layoutRange(charStart, charEnd)
  • invalidateMeasurements()

Plugins

Install plugins with doc.use(plugin) and retrieve exposed plugin facades with doc.getPlugin(name).