npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

devanagari-fonts

v1.0.0

Published

A comprehensive package for Devanagari text rendering and font utilities

Readme

Devanagari Fonts

A comprehensive npm package for working with Devanagari text and fonts, providing utilities for text rendering, font loading, and text processing.

Features

  • 📝 Sample Devanagari Text: Pre-built collection of common phrases, greetings, and text samples
  • 🔤 Font Loading: Easy integration with popular Devanagari fonts
  • 🎨 Text Rendering: Utilities for styling and displaying Devanagari text
  • 🔧 Text Processing: Convert numbers, validate text, and analyze characters
  • 🌐 Unicode Support: Full Unicode range support for Devanagari script

Installation

npm install devanagari-fonts

Quick Start

import { DevanagariText, FontLoader, TextRenderer } from 'devanagari-fonts';

// Get sample text
const samples = DevanagariText.getSamplesByCategory('greetings');
console.log(samples[0].text); // "नमस्ते"

// Load fonts
const fontLoader = new FontLoader();
await fontLoader.loadFont({
  name: 'Noto Sans Devanagari',
  url: 'https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400&display=swap',
  format: 'woff2'
});

// Render text
const element = TextRenderer.createTextElement('नमस्ते', {
  fontFamily: 'Noto Sans Devanagari',
  fontSize: '24px',
  color: '#2563eb'
});

API Reference

DevanagariText

Static methods for working with Devanagari text samples and number conversion.

// Get samples by category
const greetings = DevanagariText.getSamplesByCategory('greetings');
const religious = DevanagariText.getSamplesByCategory('religious');

// Convert numbers
const devanagariNum = DevanagariText.convertNumbersToDevanagari('123'); // "१२३"
const arabicNum = DevanagariText.convertNumbersToArabic('१२३'); // "123"

// Check if text is Devanagari
const isDevanagari = DevanagariText.isDevanagari('नमस्ते'); // true

FontLoader

Load and manage Devanagari fonts.

const fontLoader = new FontLoader();

// Load single font
await fontLoader.loadFont({
  name: 'Noto Sans Devanagari',
  url: 'path/to/font.woff2',
  format: 'woff2'
});

// Load multiple fonts
await fontLoader.loadFonts([font1, font2, font3]);

// Check if font is loaded
const isLoaded = fontLoader.isFontLoaded('Noto Sans Devanagari');

// Generate CSS
const css = fontLoader.generateFontCSS(fontConfig);

TextRenderer

Render and style Devanagari text.

// Create styled element
const element = TextRenderer.createTextElement('देवनागरी', {
  fontFamily: 'Noto Sans Devanagari',
  fontSize: '20px',
  color: '#1f2937',
  textAlign: 'center'
});

// Generate CSS
const css = TextRenderer.generateCSS('.devanagari-text', {
  fontFamily: 'Noto Sans Devanagari',
  fontSize: '18px'
});

DevanagariUtils

Utility functions for text analysis and processing.

// Get character information
const info = DevanagariUtils.getCharacterInfo('क');
// { character: 'क', unicode: 'U+0915', name: 'DEVANAGARI LETTER KA', category: 'consonant' }

// Get Unicode point
const unicode = DevanagariUtils.getUnicodePoint('न'); // "U+0928"

// Count Devanagari characters
const count = DevanagariUtils.countDevanagariCharacters('नमस्ते world'); // 5

// Validate Devanagari text
const isValid = DevanagariUtils.isValidDevanagari('नमस्ते'); // true

Sample Text Categories

The package includes sample text in various categories:

  • greetings: Common greetings and polite expressions
  • religious: Religious phrases and mantras
  • philosophy: Philosophical sayings and quotes
  • motto: National and cultural mottos

Font Recommendations

Popular Devanagari fonts that work well with this package:

  • Noto Sans Devanagari: Modern, clean font from Google Fonts
  • Mukti: Traditional style font
  • Samarkan Normal: Decorative font for headings

Browser Support

  • Modern browsers with FontFace API support
  • Node.js environments (returns HTML strings)
  • Full Unicode support for Devanagari range (U+0900-U+097F)

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT License - see LICENSE file for details.