1.0.2 โข Published 1 year ago
pseudofont v1.0.2
PseudoFont
PseudoFont is a JavaScript library for creating and converting Unicode pseudo fonts. It allows you to define custom fonts where the letters A-Z and digits 0-9 are represented using different Unicode symbols, resulting in a unique and stylized appearance for your text.
Installation
You can install PseudoFont via npm:
npm install pseudofont
Usage
To use PseudoFont in your JavaScript project, follow these steps:
- Import the PseudoFont class:
const PseudoFont = require('pseudofont');
- Create a new instance of the PseudoFont class by specifying your custom font definitions:
const customFont = new PseudoFont(
'MyCustomFont',
'๐ถ๐ท๐ธ๐นโฏ๐ปโ๐ฝ๐พ๐ฟ๐๐๐๐โด๐
๐๐๐๐๐๐๐๐๐๐',
'๐โฌ๐๐โฐโฑ๐ขโโ๐ฅ๐ฆโโณ๐ฉ๐ช๐ซ๐ฌโ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต',
'๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ'
);
- Use the
convert
method to transform your text into the custom pseudo font:
const convertedText = customFont.convert('Hello World');
console.log(convertedText); // Output: '๐๐ฎ๐ต๐ต๐ธ ๐ฆ๐ธ๐ป๐ต๐ญ'
Additional Features
Experimental Fonts
You can mark your custom font as experimental if it is incomplete or unsupported on some platforms. Use the setExperimental
method to set the experimental status of your font:
customFont.setExperimental(true);
Example
Here's an example of using PseudoFont to convert text into a custom pseudo font:
const PseudoFont = require('pseudofont');
const customFont = new PseudoFont(
'MyCustomFont',
'๐ถ๐ท๐ธ๐นโฏ๐ปโ๐ฝ๐พ๐ฟ๐๐๐๐โด๐
๐๐๐๐๐๐๐๐๐๐',
'๐โฌ๐๐โฐโฑ๐ขโโ๐ฅ๐ฆโโณ๐ฉ๐ช๐ซ๐ฌโ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต',
'๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ'
);
const convertedText = customFont.convert('Hello World');
console.log(convertedText); // Output: '๐๐ฎ๐ต๐ต๐ธ ๐ฆ๐ธ๐ป๐ต๐ญ'