intellifont-engine 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,173 +1,355 @@
1
- # intelliFont Engine
2
-
3
- **The Ultimate Professional Font Recognition & Suggestion Toolkit.**
4
-
5
- `intellifont-engine` is a high-performance, Rust-powered engine designed for mission-critical design applications. Whether you are building a PDF editor, a web builder, or a design tool, this engine ensures that no font ever goes missing and every layout remains pixel-perfect.
6
-
7
- ---
8
-
9
- ## Why intelliFont?
10
-
11
- Traditional font matching relies on exact string comparisons, which fail if the user's system names a font slightly differently (e.g., "HelveticaNeue" vs "Helvetica Neue").
12
-
13
- **intelliFont** uses **Biometric Metric Matching**—analyzing the physical architecture of the font itself (ascenders, descenders, x-height, and cap-height)—to find the perfect match or the best possible substitute.
14
-
15
- ### Key Capabilities:
16
- - **Blazing Speed**: Rust-core execution means sub-1ms response times for local lookups.
17
- - **Pre-Seeded Database**: Comes with **2,000+ popular font signatures** (Google Fonts, System Standards) embedded in a highly compressed 4.5MB binary asset.
18
- - **Layout Authority**: Exports precise physical metrics to ensure PDF and Canvas layouts never shift during font substitution.
19
- - **Hybrid Intelligence**: Scans local OS fonts and queries global CDNs (Google, Fontsource) in parallel.
20
- - **Legal Guardrails**: Real-time license detection for OFL, Apache, and commercial fonts, protecting users from legal risks.
21
-
22
- ---
23
-
24
- ## Architecture Overview
25
-
26
- The engine is built on a "Service-Core" architecture:
27
- 1. **The Rust Core**: Handles heavy-duty binary parsing, Brotli decompression of the signature database, and parallel network queries using Tokio.
28
- 2. **The NAPI-RS Bridge**: Provides a zero-copy memory bridge between Rust and Node.js, ensuring that huge font lists don't cause garbage collection lag.
29
- 3. **The Metadata Cache**: A dual-layer cache (Memory + Persistent Disk) that learns from every search, making web results instant and offline-ready on the next launch.
30
-
31
- ---
32
-
33
- ## Installation
34
-
35
- ### As a Library (Recommended)
36
- Add it to your React, Vue, or Node.js project:
37
- ```bash
38
- npm install intellifont-engine
39
- ```
40
-
41
- ### As a Global CLI Tool
42
- Powerful font management directly from your terminal:
43
- ```bash
44
- npm install -g intellifont-engine
45
- ```
46
-
47
- ---
48
-
49
- ## 🛠️ CLI Usage (The 'intellifont' command)
50
-
51
- Once installed globally, `intellifont` provides a robust set of tools for developers and system administrators.
52
-
53
- ### Core Commands
54
-
55
- | Command | Description |
56
- | :--- | :--- |
57
- | `intellifont stats` | Display exhaustive engine metrics: font counts, database compression ratio, and cache health. |
58
- | `intellifont resolve "Font"` | Performs a high-speed resolution using local assets and the metadata cache. |
59
- | `intellifont tiered "Font"` | Advanced similarity analysis. Returns results in 90% (Exact) and 80% (Similar) tiers. |
60
- | `intellifont tiered "Font" --internet` | Activate global CDN lookup (Google Fonts, Fontsource) if local matches are insufficient. |
61
- | `intellifont find-similar "Font"` | Identify fonts that are visually or metrically similar to a target baseline font. |
62
- | `intellifont check-license "Font"` | Analyze licensing metadata for commercial safety and provide free equivalents. |
63
- | `intellifont scan [--detailed]` | Deep recursive scan of system font directories to index new assets. |
64
- | `intellifont update` | Synchronize local signatures with the global repository and regenerate binary indexes. |
65
- | `intellifont setup` | Guided 3-step configuration for memory limits and provider priorities. |
66
- | `intellifont version` | Display engine version, build architecture, and capability flags. |
67
-
68
- ### Cache Management (`intellifont cache <command>`)
69
-
70
- | Subcommand | Description |
71
- | :--- | :--- |
72
- | `cache stats` | View hit rates, memory footprint, and disk usage of the local cache. |
73
- | `cache cleanup` | Remove stale entries. Use `--aggressive` to clear single-use fonts. |
74
- | `cache pin "Font"` | Lock a font permanently in the cache so it is never evicted. |
75
- | `cache unpin "Font"` | Release a font from the permanent cache lock. |
76
- | `cache list` | List all manually and automatically pinned (highly used) fonts. |
77
- | `cache suggest` | Analyze usage patterns and suggest non-pinned entries for manual removal. |
78
-
79
- ### Configuration (`intellifont config <command>`)
80
-
81
- | Subcommand | Description |
82
- | :--- | :--- |
83
- | `config show` | View current engine limits (Memory, Disk, Web Access). |
84
- | `config set <key> <val>` | Directly modify configuration (e.g., `intellifont config set memory_limit 16`). |
85
- | `config reset` | Restore all engine settings to factory defaults. |
86
- | `config export <path>` | Export your current setup to a `.toml` file for team sharing. |
87
- | `config import <path>` | Load a shared configuration file to synchronize settings across environments. |
88
-
89
- ---
90
-
91
- ## JavaScript API
92
-
93
- `intellifont-engine` provides a simple, Promise-based API for Node.js environments.
94
-
95
- ### `getEnhancedSuggestions(name, useWebFonts)`
96
- The primary entry point for building "Suggested Fonts" dropdowns.
97
-
98
- ```javascript
99
- const { getEnhancedSuggestions } = require('intellifont-engine');
100
-
101
- async function resolveFont(inputName) {
102
- // Parallel search: Local System + Global Fontsource/Google
103
- const results = await getEnhancedSuggestions(inputName, true);
104
-
105
- results.forEach(res => {
106
- console.log(`Match Found: ${res.family}`);
107
- console.log(`Similarity: ${(res.score * 100).toFixed(1)}%`);
108
-
109
- // License Guardrail
110
- if (res.isCriticalLicenseWarning) {
111
- console.warn("🚫 Commercial License Required - Consider a free alternative.");
112
- }
113
- });
114
- }
115
- ```
116
-
117
- ### `exportMetrics(fontName)`
118
- Returns the physical "DNA" of a font. Essential for layout-stable PDF generators.
119
-
120
- ```javascript
121
- const { exportMetrics } = require('intellifont-engine');
122
-
123
- const metrics = exportMetrics("Inter");
124
- // Returns:
125
- // {
126
- // family: "Inter",
127
- // ascender: 0.72,
128
- // descender: -0.21,
129
- // capHeight: 0.68,
130
- // widthFactor: 1.05
131
- // }
132
- ```
133
-
134
- ---
135
-
136
- ## Advanced Features
137
-
138
- ### Triple-Layer Safety Net
139
- If a font is missing, intelliFont executes its survival strategy:
140
- 1. **Direct Local Match**: Scans the user's OS fonts instantly.
141
- 2. **CDN Deep Search**: Queries Google Fonts and Fontsource in parallel (2-second timeout).
142
- 3. **Metric Substitution**: If nowhere to be found, it analyzes the missing font's metrics and finds a "Twin" on the local system to prevent layout breaking.
143
-
144
- ### Learning Mode (Dynamic Caching)
145
- The engine learns your project's typography. Any font resolved from the web is automatically "fingerprinted" and stored in the **Persistent Disk Cache**. Next time you search for that font, it will be found instantly—even without an internet connection.
146
-
147
- ---
148
-
149
- ## 💰 Licensing & Support
150
-
151
- `intellifont-engine` is dual-licensed:
152
- - **Software**: The engine code is licensed under **Apache-2.0**.
153
- - **Data**: The included **Core Font Database** (~2,000 signatures) is free for use. Access to the **Extended Intelligence Database** (20,000+ signatures) requires a Pro license.
154
-
155
- For **Enterprise-grade** requirements:
156
- - 🚀 **20,000+ Certified Font Signatures**
157
- - 🔒 **Air-gapped Offline Databases** (for secure environments)
158
- - 🎧 **Premium Support & Custom Provider Integration**
159
-
160
- Visit [intellifont.pro](https://intellifont.pro) or contact our enterprise team.
161
-
162
- ---
163
-
164
- ## Security
165
-
166
- Your privacy is paramount. intelliFont's local scanner:
167
- - Is restricted to common system font directories.
168
- - Never transmits actual font files; only anonymous biometric signatures (metrics).
169
- - Uses Rust's memory safety to prevent overflow exploits common in font parsing.
170
-
171
- ---
172
-
173
- © 2026 intelliFont Engine
1
+ # Intellifont — AI-Powered Font Recognition Engine
2
+
3
+ **Identify any font in seconds.** Intellifont uses AI-driven visual matching to recognize fonts from images, documents, websites, and web pages. Completely offline, private, and runs in your browser or Node.js. No internet required, no data sent to servers.
4
+
5
+ Works on screenshots, PDFs, Word documents, PowerPoint presentations, and images. Returns the top matching fonts with confidence scores.
6
+
7
+ ---
8
+
9
+ ## Where to Get Intellifont
10
+
11
+ **Choose your platform:**
12
+
13
+ | Platform | Installation | Use Case |
14
+ |---|---|---|
15
+ | **Chrome Extension** | [Download v2.0.0](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-chrome-2.0.0.zip) \| [Load unpacked](#browser-extension-setup) | Right-click on any image in Chrome |
16
+ | **Firefox Extension** | [Download v2.0.0](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-firefox-2.0.0.zip) \| [Load unpacked](#browser-extension-setup) | Right-click on any image in Firefox |
17
+ | **NPM Package** | `npm install intellifont-engine` | Identify fonts in Node.js apps |
18
+ | **WASM** | `npm install intellifont-wasm` | Identify fonts in browsers / serverless |
19
+ | **Server API** | `git clone && npm start` | REST API on localhost:3001 |
20
+
21
+ ---
22
+
23
+ ## What It Can Do
24
+
25
+ | Input | Method | Accuracy |
26
+ |---|---|---|
27
+ | **Font file** (TTF/OTF/WOFF) | Direct file analysis | ~95% |
28
+ | **Website font** | URL inspection | ~95% |
29
+ | **PDF / Document** | Embedded font extraction | ~95% |
30
+ | **Text in image** | Visual analysis | 92% top-1 \* |
31
+
32
+ \* *Accuracy varies by image quality. We actively improve this with every release.*
33
+
34
+ ---
35
+
36
+ ## Quick Start
37
+
38
+ ### For Users — Browser Extension
39
+ **Chrome & Firefox** — load unpacked (coming to stores):
40
+
41
+ 1. Clone: `git clone https://github.com/magic-emperor/Intellifont.git`
42
+ 2. **Chrome**: `chrome://extensions` Developer Mode Load unpacked select `extension/`
43
+ 3. **Firefox**: `about:debugging` Load Temporary Add-on select `extension-firefox/manifest.json`
44
+ 4. Right-click any image **"Identify font in image"**
45
+
46
+ ### For Developers — NPM Package
47
+
48
+ ```bash
49
+ npm install intellifont-engine
50
+ ```
51
+
52
+ ```javascript
53
+ const intellifont = require('intellifont-engine');
54
+
55
+ // Identify font from a file
56
+ const matches = intellifont.identifyVisualFont('./sample.ttf', 'Hello');
57
+ console.log(matches);
58
+ // Output:
59
+ // [
60
+ // { family: 'Roboto', confidence: 0.98 },
61
+ // { family: 'Open Sans', confidence: 0.94 },
62
+ // ...
63
+ // ]
64
+ ```
65
+
66
+ ### WASM (Browser / Serverless)
67
+
68
+ ```bash
69
+ npm install intellifont-wasm
70
+ ```
71
+
72
+ ```javascript
73
+ import init from 'intellifont-wasm';
74
+
75
+ const engine = await init();
76
+ const results = engine.identifyFont(glyphMetrics, 8);
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Browser Extension Setup
82
+
83
+ ### Installing the Chrome Extension
84
+
85
+ 1. **Download** the extension: [intellifont-chrome-2.0.0.zip](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-chrome-2.0.0.zip)
86
+ 2. **Extract** the ZIP file to a folder (e.g., `Downloads/intellifont-chrome`)
87
+ 3. Open **Chrome** and go to `chrome://extensions`
88
+ 4. Enable **Developer Mode** (toggle in top-right corner)
89
+ 5. Click **Load unpacked**
90
+ 6. Select the extracted `intellifont-chrome` folder
91
+ 7. Extension appears in your toolbar
92
+ 8. **Use it**: Right-click any image "Identify font in image"
93
+
94
+ ### Installing the Firefox Extension
95
+
96
+ 1. **Download** the extension: [intellifont-firefox-2.0.0.zip](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-firefox-2.0.0.zip)
97
+ 2. **Extract** the ZIP file to a folder (e.g., `Downloads/intellifont-firefox`)
98
+ 3. Open **Firefox** and go to `about:debugging`
99
+ 4. Click **This Firefox** (left sidebar)
100
+ 5. Click **Load Temporary Add-on**
101
+ 6. Select any file from the extracted `intellifont-firefox` folder (e.g., `manifest.json`)
102
+ 7. Extension appears in your toolbar
103
+ 8. **Use it**: Right-click any image "Identify font"
104
+
105
+ ### How to Use the Extension
106
+
107
+ 1. **Right-click on any image** on any webpage
108
+ 2. Select **"Identify font in image"** (or "Identify font in image region..." for partial image)
109
+ 3. Wait for analysis (usually 1-2 seconds)
110
+ 4. A popup appears with:
111
+ - **Top matching fonts** (confidence % shown)
112
+ - **Font family, weight, style** for each match
113
+ - Copy button for easy access
114
+
115
+ ### Known Extension Limitations
116
+
117
+ - Only works on images you can right-click (no cross-origin restrictions thanks to local processing)
118
+ - Image must contain **readable text** (8px+ font size)
119
+ - Accuracy varies by image quality (see [Accuracy](#accuracy-by-condition))
120
+ - **Rotation**: Deskew images first if heavily tilted
121
+
122
+ ---
123
+
124
+ ## Delivery Channels
125
+
126
+ ### **Browser Extension** (Chrome & Firefox)
127
+ Right-click on images identify fonts. Offline first, 100% private.
128
+
129
+ **Download:**
130
+ - **Chrome**: [Download v2.0.0 ZIP](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-chrome-2.0.0.zip)
131
+ - **Firefox**: [Download v2.0.0 ZIP](https://github.com/magic-emperor/Intellifont/releases/download/v2.0.0/intellifont-firefox-2.0.0.zip)
132
+
133
+ **Installation** (see [Browser Extension Setup](#browser-extension-setup) below):
134
+ 1. Extract the ZIP file
135
+ 2. Load unpacked in Chrome/Firefox Developer Mode
136
+ 3. Right-click any image "Identify font"
137
+
138
+ **Coming soon**: Chrome Web Store & Firefox Add-ons (submit after testing)
139
+
140
+ ### **NPM Package** (`intellifont-engine`)
141
+ ```bash
142
+ npm install intellifont-engine
143
+ ```
144
+
145
+ 20+ functions for font identification, analysis, and caching:
146
+ - `identifyVisualFont()` — Identify from TTF/OTF file
147
+ - `identifyVisualFontBuffer()` — Identify from buffer
148
+ - `aiSuggestSimilar()` — Find similar fonts (ML)
149
+ - `getFontSuggestions()` Name-based search
150
+ - `analyzeImage()` — Full image processing
151
+
152
+ **TypeScript types included.**
153
+
154
+ ### **WASM Module**
155
+ Pure JavaScript, zero native dependencies. Perfect for browsers, serverless, Deno.
156
+
157
+ ```bash
158
+ npm install intellifont-wasm
159
+ ```
160
+
161
+ ### **API Server**
162
+ ```bash
163
+ cd server && npm start
164
+ # POST /api/identify — upload image
165
+ # GET /api/identify-url?url=... — scan web page
166
+ # POST /api/identify-document analyze PDF/DOCX
167
+ # GET /api/similar?font=Roboto find alternatives
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Accuracy by Condition
173
+
174
+ | Scenario | Accuracy |
175
+ |---|---|
176
+ | Font file (TTF/OTF) | ~95% |
177
+ | Web font (downloaded) | ~95% |
178
+ | PDF/Document embedded font | ~95% |
179
+ | Image: clean text | 92% top-1 |
180
+ | Image: mixed conditions | 57% top-5 |
181
+
182
+ *Image accuracy depends on text quality, size, contrast, and clarity. Rotation is a known limitation (improving).*
183
+
184
+ ---
185
+
186
+ ## How It Works
187
+
188
+ ```
189
+ Input (Image / Document / Font / URL)
190
+
191
+ [Preprocessing] Binarize, deskew, extract text regions
192
+
193
+ [Glyph Analysis] Compute pixel metrics (density, symmetry, strokes, serif)
194
+
195
+ [Visual Matching] Compare 64—64 thumbnails against 2,042 fonts
196
+
197
+ [ML Enhancement] Optional: CosFace embeddings for better ranking
198
+
199
+ [Return Top 8] Sorted by confidence score
200
+
201
+ Output: Font family, weight, confidence %
202
+ ```
203
+
204
+ **Key points:**
205
+ - **Visual matching**: Character-agnostic (label-independent)
206
+ - **ML-powered**: Trained on 2,042 real fonts
207
+ - **Offline**: All data bundled, no network calls
208
+ - **Private**: Images never leave your device
209
+
210
+ ---
211
+
212
+ ## Full API Reference
213
+
214
+ ### Node.js Exports
215
+
216
+ **Core Identification**
217
+ ```javascript
218
+ identifyVisualFont(fontPath: string, characters: string, limit?: number): VisualMatch[]
219
+ identifyVisualFontBuffer(buffer: Buffer, characters: string, limit?: number): VisualMatch[]
220
+ aiSuggestSimilar(fontPath: string, limit?: number): AiSuggestion[]
221
+ getFontSuggestions(fontName: string, includeInternet?: boolean): Promise<Suggestion[]>
222
+ ```
223
+
224
+ **Image Processing**
225
+ ```javascript
226
+ analyzeImage(imageSource: string | Buffer): Promise<ImageAnalysisResult>
227
+ extractGlyphSignature(fontPath: string, character: string): GlyphSignature
228
+ compareGlyphSignatures(fontPathA: string, fontPathB: string, character: string): number
229
+ ```
230
+
231
+ **Utilities**
232
+ ```javascript
233
+ normalizeFontName(fontName: string): string
234
+ ```
235
+
236
+ **Cache Management**
237
+ ```javascript
238
+ pinFont(fontName: string): void
239
+ unpinFont(fontName: string): void
240
+ listPinnedFonts(): string[]
241
+ cleanupCache(aggressive?: boolean): number
242
+ getCacheStats(): CacheStats
243
+ getEngineStats(): EngineStats
244
+ ```
245
+
246
+ Full TypeScript types in `index.d.ts`.
247
+
248
+ ---
249
+
250
+ ## Browser Support
251
+
252
+ | Browser | Version | Status |
253
+ |---|---|---|
254
+ | Chrome | 80+ | Full |
255
+ | Firefox | 109+ | Full |
256
+ | Edge | 80+ | Full |
257
+ | Safari | 14+ | Planned |
258
+
259
+ WASM module works on 99%+ of users' devices.
260
+
261
+ ---
262
+
263
+ ## Database
264
+
265
+ **2,042 fonts** covering:
266
+ - Google Fonts (complete)
267
+ - System fonts (Windows, macOS, Linux)
268
+ - Popular design fonts
269
+ - Open-source typefaces
270
+
271
+ **Included in extension and NPM:**
272
+ - Glyph signatures: 2 MB
273
+ - Pixel signatures: 1.7 MB
274
+ - Visual thumbnails: 15 MB
275
+
276
+ ---
277
+
278
+ ## Performance
279
+
280
+ | Task | Time | Notes |
281
+ |---|---|---|
282
+ | Identify 1 glyph | 5-50ms | CPU-bound |
283
+ | Full image analysis | 100-500ms | Includes preprocessing |
284
+ | ML similarity ranking | 10-100ms | Optional |
285
+
286
+ No initialization delay. Ready immediately.
287
+
288
+ ---
289
+
290
+ ## Privacy & Security
291
+
292
+ **100% Offline** — All processing on your device
293
+ **No Tracking** — Zero telemetry
294
+ **No Uploads** — Images never leave your computer
295
+ **Open Source** — Inspect the code
296
+ **Apache 2.0** — Free for commercial use
297
+
298
+ ---
299
+
300
+ ## Installation
301
+
302
+ ### From NPM
303
+ ```bash
304
+ npm install intellifont-engine
305
+ ```
306
+
307
+ ### From Source (Development)
308
+ ```bash
309
+ git clone https://github.com/magic-emperor/Intellifont.git
310
+ cd Intellifont
311
+
312
+ # Build Rust bindings
313
+ cd Rust/font-resolver
314
+ cargo build --release
315
+ cd bindings/node
316
+ npm install
317
+ npm run build
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Known Limitations
323
+
324
+ - **Rotation**: Tilted text is difficult (deskew first)
325
+ - **Rare fonts**: Only covers 2,042 fonts (expand DB for your use case)
326
+ - **Stylized text**: Heavily styled/outlined text has lower accuracy
327
+ - **Small text**: < 8px is hard to analyze
328
+
329
+ ---
330
+
331
+ ## Contributing
332
+
333
+ Found a bug? Want to help? Open an issue or PR on [GitHub](https://github.com/magic-emperor/Intellifont).
334
+
335
+ ---
336
+
337
+ ## License
338
+
339
+ **Apache License 2.0.** See [LICENSE](LICENSE).
340
+
341
+ ---
342
+
343
+ ## Credits
344
+
345
+ - **Rust** engine with NAPI-RS bindings
346
+ - **WebAssembly** for browser support
347
+ - **CosFace** ML embeddings
348
+ - **2,042 test fonts** for training
349
+
350
+ ---
351
+
352
+ ** 2026 Intellifont Engine. Built by the Intellifont Team.**
353
+
354
+ Questions? Email [faizan77603@gmail.com](mailto:faizan77603@gmail.com) or open an issue on [GitHub](https://github.com/magic-emperor/Intellifont).
355
+