Skip to main content

Python implementation of Glaemscribe transcription engine

Project description

Glaemscribe-py

A Python implementation of Glaemscribe for transcribing Tolkien's Elvish languages (Quenya and Sindarin) to Tengwar script using Unicode.

Glaemscribe-py is a Python port of the original Glaemscribe. It focuses on Elvish → Tengwar transcription and outputs Unicode Private Use Area (PUA) characters instead of font-specific codes, so you can use modern Unicode Tengwar fonts.

Key features

  • Quenya transcription – Classical Quenya → Tengwar
  • Sindarin transcription – General Sindarin → Tengwar
  • Font flexibility – Works with any Unicode Tengwar TTF or OTF font
  • PNG rendering helpers – Example scripts for image output

Installation

# Clone the repository
git clone https://github.com/JonnoB/glaemscribe-py.git
cd glaemscribe-py

# Install library (runtime only)
pip install -e .

# For development (tests, formatting, etc.)
pip install -e .[dev]

Fonts

This library outputs Unicode Tengwar (PUA) and can be used with any Unicode Tengwar font. The repository includes a small, curated set of Unicode Tengwar fonts, all under the SIL Open Font License (OFL):

These fonts live under src/glaemscribe/fonts/ and are suitable for most uses. See the respective licence files alongside the fonts for details. There are many Tengwar fonts available online, an example of how to use a custom font is shown in the Quick start section.

Quick start

Simple API (recommended)

The easiest way to use Glaemscribe is with the high-level transcribe() function:

from glaemscribe import transcribe, list_modes

# Simple Quenya transcription
quenya_text = transcribe("Elen síla lúmenn' omentielvo", mode="quenya")
renderer = TengwarRenderer()
renderer.render_to_file(quenya_text, "quenya_text.png")
print(quenya_text)

# Sindarin transcription
sindarin_text = transcribe("Ai na vedui Dúnadan !", mode="sindarin")
# For other tengwar fonts simply pass in the path to the ttf or otf file
renderer_alcarin = TengwarRenderer(font_name='alcarin-bold', font_size=36)
renderer_alcarin.render_to_file(sindarin_text, "sindarin_text.png")

# List available modes
modes = list_modes()
print(modes)  # ['quenya', 'sindarin', 'english', ...]

Mode aliases for convenience:

  • "quenya" → Quenya Classical Tengwar
  • "sindarin" → Sindarin General Use
  • "sindarin-beleriand" → Sindarin Beleriand mode
  • "english" → English Tengwar (experimental)

See scripts/simple_usage.py for more examples.

Advanced usage (custom modes/options)

For advanced use cases, you can use the lower-level API:

from glaemscribe.parsers.mode_parser import ModeParser
from glaemscribe.resources import get_mode_path

parser = ModeParser()
mode = parser.parse(str(get_mode_path('quenya-tengwar-classical')))
mode.processor.finalize({})

success, result, debug = mode.transcribe("Elen síla lúmenn' omentielvo")
if success:
    print(result)

Example Scripts

The scripts/ directory contains several useful examples:

  • simple_usage.py - Simple API examples for common use cases
  • render_text.py - Render Tengwar text to PNG images, also accepts custom fonts
  • validate_unicode.py - Validate Unicode transcriptions
  • render_poem.py - Render the Namárië poem with multiple fonts

Example:

uv run scripts/simple_usage.py
uv run scripts/render_text.py "Elen síla" --mode quenya --output output.png

Contributing

Contributions are welcome! When contributing:

  1. Maintain compatibility with original Glaemscribe behavior
  2. Add tests for new features
  3. Follow existing code style and patterns
  4. Update documentation as needed

TO DO

The core architecture supports all transcription modes from the original Glaemscribe.

Examples of modes that can be added this way:

  • English Tengwar (phonemic, via eSpeak NG)
  • Other Tengwar modes from the original Glaemscribe
  • Cirth (runes), Sarati, and other scripts

License

This port follows the same license as the original Glaemscribe project (GNU Affero General Public License v3.0).

Acknowledgments

  • Benjamin Babut (Talagan) - Original creator of Glaemscribe
  • The Tengwar and Quenya community - For supporting the creation of the original Glaemscribe

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glaemscribe-0.1.0.tar.gz (225.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glaemscribe-0.1.0-py3-none-any.whl (231.8 kB view details)

Uploaded Python 3

File details

Details for the file glaemscribe-0.1.0.tar.gz.

File metadata

  • Download URL: glaemscribe-0.1.0.tar.gz
  • Upload date:
  • Size: 225.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for glaemscribe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a053b5b4b43aedf78e93da964281d643e6fc70f7d28f6d2ab3c8fa62ad6aef98
MD5 d099c8e3121b3f75339df41d4b3f5e42
BLAKE2b-256 355f03112e6f8d9d1aee27242f813c890cf2b05e180bc4c03f8f40ec4be43c66

See more details on using hashes here.

File details

Details for the file glaemscribe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glaemscribe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 231.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for glaemscribe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3d488240513f863898e3581a14bafd27b4fb91a2ea2117a79cfd1fa84a3867
MD5 22ae3bb7ebd86155a77d7e1351007b75
BLAKE2b-256 cc9fa16be8172003ed3cbc471ae88919a1055bde47255592d1e0a60c62afb936

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page