Skip to main content

sinhala-legacy-fonts

Convert text stored in the FM family of legacy, non-Unicode Sinhala fonts (FMAbhaya, FMAbabld and related) to Unicode — including the visual-order → logical-order reordering of pre-base vowel signs.

Pure Python, standard library only, Python 3.10+.

from sinhala_legacy_fonts import sinhala_fm_to_unicode, encoding_for_font

encoding_for_font("ABCDEF+FMAbhaya")  # "fm"  (PDF subset prefix is stripped)
encoding_for_font("IskoolaPota")  # None  (already-Unicode font)
encoding_for_font("DL-Manel")  # None  (different encoding — not converted)

sinhala_fm_to_unicode("fmda")  # "පෝ"
sinhala_fm_to_unicode("fl")  # "කෙ"

sinhala_fm_to_unicode is a pure function: no file, font, PDF or network access. Glyph codes it does not recognise pass through unchanged.

Supported fonts

Only the FM family is supported. encoding_for_font(name) returns "fm" when the (base) font name starts with FM, None otherwise. FMAbhaya and FMAbabld are verified; other FM* fonts are assumed to share the glyph layout — treat them as probable, not proven. Text in any other legacy encoding (e.g. DL fonts, Kaputa) will convert wrongly, so always check the font name first. See docs/supported-fonts.md.

The encoding, briefly

FM stores each Sinhala letter at a fixed keyboard code point. In particular the pre-base vowel sign f (ෙ) is encoded before its consonant, mirroring visual order, while Unicode orders consonant first, sign after — so conversion must reorder clusters rather than substitute glyph for glyph. See docs/encoding.md.

Limitations

  • Only the FM family (above) is supported.
  • A handful of glyph codes are unverified (marked UNVERIFIED in the table source and listed in docs/supported-fonts.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.

See also Pandukabhaya, Open-SL sinhala-unicode-converter and the UCSC LTRL work they draw on — independent implementations used as cross-references during development, not sources.

Licence

MIT

Metadata

Release files for sinhala-legacy-fonts 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sinhala-legacy-fonts 0.1.0
File Size Uploaded Provenance Actions
sinhala_legacy_fonts-0.1.0.tar.gz 47.1 kB Without provenance Details for sinhala_legacy_fonts-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sinhala-legacy-fonts 0.1.0
File Interpreter ABI Platform Actions
sinhala_legacy_fonts-0.1.0-py3-none-any.whl Python 3 none any Details for sinhala_legacy_fonts-0.1.0-py3-none-any.whl

Total release size: 57.1 kB

Release files / sinhala_legacy_fonts-0.1.0.tar.gz

Download URL sinhala_legacy_fonts-0.1.0.tar.gz
Size 47.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e71d03d2959ba71916494c8ca78a0f1fdf4a7077a38f0f355caa0e28933aa7a8
BLAKE2b-256 checksum
How to use checksums
cb1761934ea07deb7930557daa9f232f957348661a01437acd45e374965e300f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Release files / sinhala_legacy_fonts-0.1.0-py3-none-any.whl

Download URL sinhala_legacy_fonts-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f064f87155b7c0db48a9e7c414418823978cb042767a1a4bd067c9d16b580e68
BLAKE2b-256 checksum
How to use checksums
c982089b125bcc8bbfa96199c6d7a97e862c67e3b0efce4c1ed37c70330a21c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.9

Security for sinhala-legacy-fonts 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page