renderChar method

  1. @override
void renderChar(
  1. int x,
  2. int y,
  3. Char char
)
override

Render the given Char at column x, row y in a Terminal

Implementation

@override
void renderChar(int x, int y, Char char) {
  // setup
  ctx.textBaseline = 'top';
  ctx.font = font;

  // first render the background as a full block
  ctx.fillStyle = char.background.cssColor;
  ctx.fillText(String.fromCharCode(0x2588), x * charWidth, y * charHeight);

  // then render the character
  ctx.fillStyle = char.foreground.cssColor;
  ctx.fillText(String.fromCharCode(char.charCode), x * charWidth,
      y * charHeight, charWidth);
}