preeti-to-unicode
v1.0.12
Published
Preeti to Unicode Nepali converter for Preeti, Kantipur, PCS Nepali, and Romanized text
Maintainers
Readme
preeti-to-unicode
A lightweight Nepali Unicode converter for modern web apps and Node.js tools.
Convert legacy Nepali fonts like Preeti, Kantipur, PCS Nepali, and Romanized Nepali into standard Unicode Devanagari text.
Installation
npm install preeti-to-unicodeDemo
Use PreetiUnicodeUI to quickly embed a complete Preeti-to-Unicode converter interface in your React app.
If your repository uses a different image path, update the image URL accordingly.
Features
- Converts legacy Nepali fonts into Unicode Devanagari
- Supports:
- Preeti
- Kantipur
- PCS Nepali
- Romanized Nepali
- Works with:
- JavaScript
- TypeScript
- Node.js
- React
- Includes a ready-made React UI component:
PreetiUnicodeUI - Live conversion with copy-to-clipboard support
- Lightweight package with a simple API
Basic Usage
JavaScript (Node.js / Browser)
import { convertFont, listFonts } from 'preeti-to-unicode';
const input = 'g]kfn';
const output = convertFont(input, 'preeti');
console.log(output); // नेपाल
console.log(listFonts());
// [ 'preeti', 'kantipur', 'pcs nepali', 'romanize' ]TypeScript
import {
convertFont,
getFontMeta,
type BuiltInFontKey,
} from 'preeti-to-unicode';
const font: BuiltInFontKey = 'romanize';
const text = 'Phuldev';
const unicode = convertFont(text, font);
const meta = getFontMeta(font);
console.log(unicode); // फुलदेव
console.log(meta?.name); // RomanizeReact
import { PreetiUnicodeUI } from 'preeti-to-unicode';
export default function App() {
return (
<PreetiUnicodeUI
initialFont="preeti"
initialText="g]kfn"
theme={{
primary: '#0f766e',
accent: '#dc2626',
background: '#f8fafc',
}}
/>
);
}API
convertFont(text, font)
Convert legacy Nepali font text into Unicode.
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| text | string | Input text to convert |
| font | BuiltInFontKey | Source font name |
Example
import { convertFont } from 'preeti-to-unicode';
const unicode = convertFont('g]kfn', 'preeti');
console.log(unicode); // नेपालlistFonts()
Returns all supported font names.
Example
import { listFonts } from 'preeti-to-unicode';
console.log(listFonts());
// [ 'preeti', 'kantipur', 'pcs nepali', 'romanize' ]getFontMeta(font)
Returns metadata for a supported font.
Example
import { getFontMeta } from 'preeti-to-unicode';
console.log(getFontMeta('kantipur'));PreetiUnicodeUI Props
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| initialFont | 'preeti' \| 'kantipur' \| 'pcs nepali' \| 'romanize' | 'preeti' | Source font used for conversion |
| initialText | string | '' | Initial text shown in the input textarea |
| theme | Partial<ThemePalette> | {} | Theme overrides for colors and surfaces |
Notes
- Best results are achieved with clean text copied directly from legacy font documents.
- This package converts text encoding patterns, not image or PDF glyphs.
- React peer dependency:
react >= 17 - Minimum supported Node.js version:
18+
Keywords
- preeti to unicode
- preeti unicode converter
- nepali unicode converter
- kantipur to unicode
- pcs nepali to unicode
- romanized nepali to unicode
- nepali typing converter
- devanagari unicode converter
- javascript nepali converter
- react preeti unicode
License
MIT
