Skip to main content

pyyudit

Cross-platform Python binding to Yudit's Unicode shaping engine, with per-step trace output.

What is this?

pyyudit extracts the shaping engine from the Yudit Unicode editor into a standalone shared library and wraps it with Python ctypes bindings. It provides:

  • Indic script shaping — Devanagari, Bengali, Gujarati, Gurmukhi, Oriya, Telugu, Kannada, Malayalam, Sinhala
  • Arabic/Syriac joining
  • Thai, Lao, Tibetan text processing
  • Hangul Jamo composition
  • OpenType GSUB/GPOS feature application
  • Full BiDi (bidirectional text) support
  • Per-step trace — see every decompose → reorder → gsub → gpos step

Architecture

pyyudit (Python)
├── YuditFont          — load font from bytes/path
│   ├── shape()        — one-shot shaping
│   └── shape_trace()  — shaping with full trace
├── _binding.py        — ctypes declarations for C API
├── _loader.py         — cross-platform native lib discovery
└── _lib/              — bundled native library (DLL/SO/dylib)

yudit_shaper (C/C++)
├── yudit_shaper.h/cpp — C API wrapper
├── stoolkit/          — Yudit core (BiDi, Unicode, glyphs, paragraphs)
├── swindow/           — Font handling (SFontTTF) + SScriptProcessor
└── CMakeLists.txt     — build system

Installation

From source (with native build)

# Prerequisites: CMake 3.15+, C++ compiler
git clone https://github.com/Kushim-Jiang/pyyudit.git
cd pyyudit

# Download Yudit source (for the shaping engine)
curl -L https://www.yudit.org/download/yudit-3.1.0.tar.gz | tar xz

# Build the native library
python scripts/build_native.py

# Install the Python package
pip install -e ".[dev]"

Cross-platform wheel

# Build wheel (includes the native library)
pip install hatchling build
python -m build
pip install dist/pyyudit-0.1.0-py3-none-any.whl

Usage

import pyyudit

# One-shot shaping
font_bytes = open("NotoSansDevanagari.ttf", "rb").read()
glyphs = pyyudit.shape(font_bytes, "नमस्ते")
for g in glyphs:
    print(f"gid={g.g} cluster={g.cl} adv={g.ax}")

# With full trace
with pyyudit.YuditFont.from_path("NotoSansDevanagari.ttf") as f:
    result = f.shape_trace("नमस्ते")
    for stage in result.stages:
        print(f"{stage.m}: {len(stage.glyphs)} glyphs")
        if stage.effective:
            print("  (buffer changed)")

# Reusable font object
font = pyyudit.YuditFont.from_path("NotoSansArabic.ttf")
result = font.shape("مرحبا")
print(f"Advance: {result.advance_x} units")
font.close()

Trace stages

The trace captures every step of Yudit's shaping pipeline:

Stage Description
input Original codepoints before shaping
decompose Unicode decomposition (vowel splits etc.)
reorder Indic consonant/vowel reordering
gindex Glyph index lookup from cmap
half Half-form substitution (GSUB)
pres Pre-base substitution (GSUB)
abvs Above-base substitution (GSUB)
blws Below-base substitution (GSUB)
psts Post-base substitution (GSUB)
haln Halant/virama substitution (GSUB)
abvm Above-base mark positioning (GPOS)
blwm Below-base mark positioning (GPOS)
clean Post-GSUB cleanup
final Final positioning
shaped Final shaped glyph buffer

Pure-Python helpers

These work without the native library:

from pyyudit import upem_from_ttf, has_table, read_font_bytes

data = read_font_bytes("font.ttf")
upem = upem_from_ttf(data)
has_gsub = has_table(data, "GSUB")

Configuration

# Set explicit library path
pyyudit.configure("/path/to/libyudit_shaper.so")

# Or via environment variable
# export PYYUDIT_LIBRARY_PATH=/path/to/libyudit_shaper.so

# Check availability
print(pyyudit.is_available())
print(pyyudit.library_info())

Supported scripts

Yudit's shaping engine supports these scripts (with OpenType features):

Script Tag GSUB features GPOS features
Devanagari deva nukt akhn rphf blwf half vatu pres abvs blws psts haln abvm blwm dist
Bengali beng init nukt akhn rphf blwf half pstf vatu pres abvs blws psts abvm blwm dist
Gujarati gujr nukt akhn rphf blwf half pstf vatu pres abvs blws psts haln abvm blwm dist
Gurmukhi guru nukt blwf pstf vatu pres abvs blws psts haln abvm blwm dist
Oriya orya nukt akhn rphf blwf half pstf vatu pres blws abvs psts haln abvm blwm dist
Tamil taml akhn half pres abvs blws psts haln abvm blwm dist
Telugu telu akhn blwf abvs blws psts haln abvm blwm dist
Kannada knda nukt akhn rphf blwf half pstf vatu pres blws abvs psts haln abvm blwm dist
Malayalam mlym nukt akhn rphf blwf half pstf vatu pres blws abvs psts haln abvm blwm dist
Sinhala sinh nukt akhn rphf blwf half pstf vatu pres blws abvs psts haln abvm blwm dist
Thai thai ccmp kern mark mkmk
Lao lao ccmp blws abvs kern mark mkmk
Tibetan tibt ccmp blws abvs blwm abvm kern
Jamo jamo ccmp ljmo vjmo tjmo

License

  • pyyudit Python code: MIT
  • Yudit shaping engine: GPL-2.0-or-later (Gaspar Sinai)
  • See COPYING.TXT for details.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pyyudit-0.1.0-py3-none-any.whl (438.3 kB view details)

Uploaded Python 3

pyyudit-0.1.0-0-py3-none-win_amd64.whl (147.1 kB view details)

Uploaded Python 3Windows x86-64

pyyudit-0.1.0-0-py3-none-manylinux_2_17_x86_64.whl (438.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pyyudit-0.1.0-0-py3-none-macosx_11_0_arm64.whl (293.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyyudit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 438.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyyudit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd441ec034fcfd207d7f3cc001cda7ff6e913b9ee8219a8e2a8413f795e45c46
MD5 5a4bed96af0e26a504efa318abddd814
BLAKE2b-256 53d6b7d0e21a4e7922aa1b60f6ff9ac149a8b882184930ef1495cee08285680a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyyudit-0.1.0-py3-none-any.whl:

Publisher: build.yml on Kushim-Jiang/pyyudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyyudit-0.1.0-0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyyudit-0.1.0-0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 147.1 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyyudit-0.1.0-0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3133bbdda96923f86d9af4593930c14bd9589437cca4eaf9c00a85929322f25d
MD5 14b897b958e01cad4187e5d28e53bd22
BLAKE2b-256 6da93f98541a28f9bbc0c74d074386b734046938c575aba45b5f1ca01d6e762a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyyudit-0.1.0-0-py3-none-win_amd64.whl:

Publisher: build.yml on Kushim-Jiang/pyyudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyyudit-0.1.0-0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pyyudit-0.1.0-0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 144c3116c4e1a5be7a5f2252e6a2eb9896bc0eb290d028be9ce723f3bfb0a3f5
MD5 c377dd5fa21e5b799195774bfd6bb9bd
BLAKE2b-256 a9ab5a6460e64cee3455db9feeb0f8e9285d511564f0edba3af914dda01210ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyyudit-0.1.0-0-py3-none-manylinux_2_17_x86_64.whl:

Publisher: build.yml on Kushim-Jiang/pyyudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyyudit-0.1.0-0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyyudit-0.1.0-0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d09d89ac3db620a7216207ae6e194d206d2febcbe1363b90b9bdc4a6964153f4
MD5 187d222ba7edaf208c3723fb0e33ba12
BLAKE2b-256 3ef9805cc5cffdbefc60eb6dc37939c0ec0b970c01c0f9afa48576e7f942bf75

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyyudit-0.1.0-0-py3-none-macosx_11_0_arm64.whl:

Publisher: build.yml on Kushim-Jiang/pyyudit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

3 files

0.2.0

3 files

0.1.1

3 files

This release

0.1.0 This release

4 files

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