Metadata-Version: 2.4
Name: nepali-converter
Version: 0.1.0
Summary: Legacy Nepali font to Unicode converter with PDF rescue
Project-URL: Homepage, https://nepalibhasha.github.io/nepali-fonts/
Project-URL: Repository, https://github.com/nepalibhasha/nepali-fonts
Project-URL: Issues, https://github.com/nepalibhasha/nepali-fonts/issues
Author-email: nepalibhasha <nepalibhashaorg@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: converter,devanagari,kantipur,legacy-font,nepali,pdf,preeti,sagarmatha,unicode
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Provides-Extra: pdf
Requires-Dist: pymupdf; extra == 'pdf'
Description-Content-Type: text/markdown

# nepali-converter

Convert legacy Nepali font encodings (Preeti, Kantipur, Sagarmatha, Himalb) to Unicode Devanagari. Also rescues legacy-encoded text from PDFs (non-OCR).

Part of the [nepali-fonts](https://github.com/nepalibhasha/nepali-fonts) project.

## Installation

```bash
pip install nepali-converter
```

For PDF rescue support:

```bash
pip install nepali-converter[pdf]
```

## CLI usage

Convert a legacy-encoded text file:

```bash
nepali-convert input.txt --font preeti --output output.txt
```

Auto-detect the legacy font:

```bash
nepali-convert input.txt --output output.txt
```

Read from stdin:

```bash
echo "g]kfn" | nepali-convert - --font preeti
```

Rescue text from a legacy-font PDF:

```bash
nepali-convert --pdf document.pdf --output rescued.txt
nepali-convert --pdf document.pdf --pages 1-5 --output rescued.txt
```

## Python API

```python
from nepali_converter import convert, detect_font

# Convert with a known font
text = convert("g]kfn", "preeti")  # → "नेपाल"

# Auto-detect the font
font = detect_font(legacy_text)
if font:
    text = convert(legacy_text, font)

# Rescue text from a PDF (requires nepali-converter[pdf])
from nepali_converter import rescue_pdf
rescued = rescue_pdf("document.pdf", pages=(1, 10))
```

## Supported fonts

| Font | Encoding |
|---|---|
| Preeti | Windows-1252 (cp1252) |
| Kantipur | Windows-1252 (cp1252) |
| Sagarmatha | Windows-1252 (cp1252) |
| Himalb (Fontasy Himali TT) | Windows-1252 (cp1252) |

## License

MIT
