Metadata-Version: 2.5
Name: tamil-legacy-fonts
Version: 0.1.0
Summary: Convert Bamini and Shree-Lipi legacy (non-Unicode) Tamil font text to Unicode
Project-URL: Repository, https://github.com/e4c5/tamil-legacy-fonts
Project-URL: Issues, https://github.com/e4c5/tamil-legacy-fonts/issues
Author: Raditha Dissanayake
License-Expression: MIT
License-File: LICENSE
Keywords: bamini,converter,font,legacy,shreelipi,tamil,unicode
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# tamil-legacy-fonts

Convert text stored in **Bamini** and **Shree-Lipi** legacy, non-Unicode
Tamil fonts to Unicode — including the visual-order → logical-order
reordering of pre-base vowel signs, and repairs for the common PDF
text-layer extraction artefacts (stranded vowel signs, letter-spacing
inside aksharas, the `+` long-u tail).

Pure Python, standard library only, Python 3.10+.

```python
from tamil_legacy_fonts import (
    tamil_bamini_to_unicode,
    tamil_shree_to_unicode,
    encoding_for_font,
)

encoding_for_font("ABCDEF+Kalaham")  # "bamini"
encoding_for_font("SHREE-TAM7-0800")  # "shreelipi"
encoding_for_font("SHREE-TAM-0800")  # None  (older variant — unverified)
encoding_for_font("FMAbhaya")  # None  (Sinhala, not Tamil)

tamil_bamini_to_unicode("md;G")  # "அன்பு"
tamil_bamini_to_unicode("jkpo;")  # "தமிழ்"
tamil_shree_to_unicode("uªÌ")  # "தமிழ்"
```

Both converters are pure functions: no file, font, PDF or network
access. Glyph codes they do not recognise pass through unchanged.

## Supported fonts

`encoding_for_font(name)` strips a PDF subset prefix (`ABCDEF+`) and
returns:

| Result | Fonts |
|---|---|
| `"bamini"` | verified: `NCTsunami`, `Kalaham`, `Geethapria`, `Baamini`; unverified: `NCEdisan`, `Bamini`, `Tharmini`, `Baami` (name prefixes) |
| `"shreelipi"` | `SHREE-TAM7-0800`, `-0803`, `-0805`, `-1316`, each optionally suffixed `-SC<n>` — **verified variants only** |
| `None` | anything else, including unverified `SHREE-TAM*` variants |

The Bamini family all share one keyboard layout; only the verified
prefixes have been checked against rendered output. For Shree-Lipi only
the listed variants have been checked — other `SHREE-TAM*` names return
`None` rather than risk wrong conversion.
See [docs/supported-fonts.md](docs/supported-fonts.md).

## The encodings, briefly

Both fonts store glyph codes, not characters, and encode pre-base vowel
signs *before* their consonant (visual order). Bamini follows the font's
typewriter keyboard (`n`/`N`/`i` markers + consonant + suffix glyphs);
Shree-Lipi lays consonants out in sequential 6-7 slot blocks with
`ö`/`÷`/`ø` markers. See [docs/encoding.md](docs/encoding.md).

## Limitations

- Only the fonts above are supported; other legacy encodings convert
  wrongly.
- A handful of legacy-decoder quirks are deliberately reproduced for
  compatibility (e.g. `\+` → `10`, `xs` → `ஒள`); see
  [docs/encoding.md](docs/encoding.md) — they may change in a future
  release.
- Conversion can leave residual Latin glyphs or produce incorrect output
  on malformed input; it is not a validator.

## Acknowledgements

Originally written for [MurphyLearn](https://murphylearn.com).

## Licence

[MIT](LICENSE)
