Package Exports
- text2matrix
- text2matrix/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (text2matrix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Text2Matrix
Introduction
Convert text strings into customizable pixel matrices with options for max height, letter spacing, and more. Ideal for LED displays and creative typographic applications.
Installation
npm install text2matrix
Usage
const { Font, Text } = require("text2matrix");
async function main() {
const text = "Hello World!";
const myFont = "myFont.ttf";
const font = await Font.fromPath(myFont);
const text = new Text(text, font, { fontSize: 16 });
text.draw(); // only node environment, creates a png file
const matrix = text.matrix; // returns a 2D array of grayscale values between 0 and 1
}