Technical Documentation
Complete developer guide for integrating Hindi and Indian fonts in websites, applications, and digital products.
🚀 Performance Optimized • 🌐 Cross-Browser • 📱 Mobile-First
Developer Topics
Font Formats Guide
Choose the right font format for optimal performance and browser compatibility
WOFF2
RecommendedBest format for modern web browsers with superior compression
WOFF
RecommendedUniversal web font format with excellent browser support
TTF
Desktop font format, larger file size for web use
OTF
OpenType format with advanced typography features
EOT
Microsoft's format for Internet Explorer compatibility
CSS Integration Examples
Ready-to-use code examples for implementing fonts in your projects
Basic @font-face Declaration
CSS @font-face {
font-family: 'AMS Leafy';
src: url('/fonts/ams-leafy.woff2') format('woff2'),
url('/fonts/ams-leafy.woff') format('woff'),
url('/fonts/ams-leafy.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}
Multiple Font Weights
CSS /* Regular Weight */
@font-face {
font-family: 'AMS Rekha';
src: url('/fonts/ams-rekha-regular.woff2') format('woff2');
font-weight: 400;
font-display: swap;
}
/* Bold Weight */
@font-face {
font-family: 'AMS Rekha';
src: url('/fonts/ams-rekha-bold.woff2') format('woff2');
font-weight: 700;
font-display: swap;
}
Using Fonts in CSS
CSS .hindi-text {
font-family: 'AMS Leafy', 'Noto Sans Devanagari', sans-serif;
font-size: 18px;
line-height: 1.6;
text-rendering: optimizeLegibility;
}
.heading {
font-family: 'AMS Rekha', serif;
font-weight: 700;
font-size: 2rem;
}
Font Loading with JavaScript
JAVASCRIPT // Using Font Loading API
const font = new FontFace(
'AMS Leafy',
'url(/fonts/ams-leafy.woff2)',
{ weight: '400', style: 'normal' }
);
// Load and add to document
font.load().then((loadedFont) => {
document.fonts.add(loadedFont);
console.log('Font loaded successfully');
}).catch((error) => {
console.error('Font loading failed:', error);
});
Preloading Fonts (HTML)
HTML <!-- Preload critical fonts -->
<link rel="preload"
href="/fonts/ams-leafy.woff2"
as="font"
type="font/woff2"
crossorigin>
<link rel="preload"
href="/fonts/ams-rekha-bold.woff2"
as="font"
type="font/woff2"
crossorigin>
React Font Integration
JAVASCRIPT // styles/fonts.css
@import url('./fonts/ams-leafy.css');
// App.jsx
import './styles/fonts.css';
function App() {
return (
<div style={{fontFamily: 'AMS Leafy, sans-serif'}}>
<h1>नमस्ते दुनिया</h1>
<p>Beautiful Hindi typography</p>
</div>
);
}
Performance Optimization
Best practices to ensure fast font loading and excellent user experience
Use font-display: swap
High ImpactPrevents invisible text during font load and shows fallback fonts immediately
Preload Critical Fonts
High ImpactLoad essential fonts as early as possible to reduce render delays
Font Subsetting
Medium ImpactInclude only required characters to reduce file size
Use WOFF2 Format
Medium ImpactModern format with better compression than TTF/OTF
Minimize Font Variations
Medium ImpactLoad only necessary weights and styles to reduce requests
CDN Optimization
Low ImpactServe fonts from CDN for better global performance
Performance Checklist
Unicode Support & Character Sets
Understanding Unicode ranges for Hindi, Devanagari, and Indian language support
Devanagari (Hindi/Marathi)
256 charactersCore Devanagari script for Hindi, Marathi, Sanskrit, and Nepali languages
Devanagari Extended
32 charactersExtended Devanagari characters for additional language support
Latin Basic
128 charactersBasic Latin characters for English text and numbers
Latin Extended-A
128 charactersExtended Latin for European languages with diacritics
General Punctuation
112 charactersCommon punctuation marks and formatting characters
Font Subsetting Example
@font-face {
font-family: 'AMS Hindi Subset';
src: url('/fonts/ams-hindi-subset.woff2') format('woff2');
unicode-range: U+0900-097F, U+0020-007F;
/* Only Devanagari + Basic Latin characters */
font-display: swap;
}
This example creates a subset containing only Devanagari and basic Latin characters, significantly reducing file size for Hindi-specific content.
Developer FAQ
Technical questions and answers for font implementation
What's the difference between self-hosting and using font services?
How do I handle fallback fonts for Hindi text?
Why does my Hindi text look different across browsers?
How can I optimize font loading for mobile users?
What's the best way to handle multiple font weights?
How do I ensure fonts work in older browsers?
Additional Resources
Tools and resources to help you implement fonts effectively in your projects
Font Testing Tools
Browser developer tools, font preview utilities
Performance Testing
PageSpeed Insights, WebPageTest, Lighthouse
Code Validation
CSS validators, font loading libraries