Skip to content

Instantly share code, notes, and snippets.

@mariotacke
Last active July 11, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariotacke/494aea915fe4c27278da0482a03d27cb to your computer and use it in GitHub Desktop.
Save mariotacke/494aea915fe4c27278da0482a03d27cb to your computer and use it in GitHub Desktop.
const fontHeight = 12;
if (width && height) {
// canvas setup removed for brevity
hiddenContext.drawImage(video, 0, 0, width, height);
outputContext.textBaseline = 'top';
outputContext.font = `${fontHeight}px Consolas`;
const text = outputContext.measureText('@');
const fontWidth = parseInt(text.width);
// more processing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment