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
Python 3.8+ is required.
pip install glaemscribe
Quenya and Sindarin transcription work out of the box. English phonetic transcription additionally requires the phonetic extra and the espeak-ng system binary:
pip install glaemscribe[phonetic]
# Ubuntu / Debian
sudo apt install espeak-ng
# macOS
brew install espeak-ng
Without these, calling transcribe(..., mode="english") or text_to_ipa() will raise a clear ImportError with install instructions.
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):
- FreeMonoTengwar – baseline font used during development
- AlcarinTengwar-Regular – Unicode Tengwar font by Toshi Omagari
- AlcarinTengwar-Bold – Bold companion font by Toshi Omagari
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
from glaemscribe.render import TengwarRenderer
# 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', ...]
Rendered outputs using the default fonts look like this:
Quenya example text rendered to Tengwar using FreeMonoTengwar font
Sindarin example text rendered to Tengwar using AlcarinTengwar-Bold font
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 casesrender_text.py- Render Tengwar text to PNG images, also accepts custom fontsvalidate_unicode.py- Validate Unicode transcriptionsrender_poem.py- Render the Namárië poem with multiple fonts
Example:
python scripts/simple_usage.py
python scripts/render_text.py "Elen síla" --mode quenya --output output.png
Marimo notebooks (interactive examples)
The notebooks/ directory contains interactive marimo apps that show end-to-end usage patterns:
notebooks/marimo_getting_started.py- Intro walkthrough for modes, transcription, and renderingnotebooks/marimo_namarie_poem.py- Interactive rendering of Namárië with font controlsnotebooks/marimo_tengwar_espeak.py- IPA + Tengwar workflow usingespeak-ng(phonetic pipeline)
Install marimo:
pip install marimo
Launch any notebook app with:
marimo edit notebooks/marimo_getting_started.py
marimo edit notebooks/marimo_namarie_poem.py
marimo edit notebooks/marimo_tengwar_espeak.py
You can also run them directly as Python scripts:
python notebooks/marimo_getting_started.py
Contributing
Contributions are welcome! When contributing:
- Maintain compatibility with original Glaemscribe behavior
- Add tests for new features
- Follow existing code style and patterns
- Update documentation as needed
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glaemscribe-0.2.0.tar.gz.
File metadata
- Download URL: glaemscribe-0.2.0.tar.gz
- Upload date:
- Size: 231.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0cbbec42ef6b38254c4912cfd1b31d592a452f8a182424be0c107fadd3d20c
|
|
| MD5 |
0709a0e13608a9d96099bafe92861814
|
|
| BLAKE2b-256 |
dc4113d1fcafdfec9eaf29af941f71dac30919d061c3d85e546f4b152f6aca91
|
File details
Details for the file glaemscribe-0.2.0-py3-none-any.whl.
File metadata
- Download URL: glaemscribe-0.2.0-py3-none-any.whl
- Upload date:
- Size: 234.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b05b27dceeb0082681168acae53e0ebba12910cd61ca956426f23a17457302f5
|
|
| MD5 |
aa7a8495a442cec7a44049f569995784
|
|
| BLAKE2b-256 |
1a86209fe6331ee9de3166ce9e292e26bdb888101c47abbbeb3f6e0713716d02
|