Skip to main content

Bangla Text Renderer

Perfect Bangla/Bengali text rendering on images with correct vowel positioning and joint letter handling.

Problem

When using PIL/Pillow to render Bangla text on images, vowel marks (কার) like ি, ে, ৈ often appear in the wrong position - one letter behind where they should be. This package fixes that issue.

Installation

pip install bangla-text-renderer

Quick Start

from bangla_text_renderer import BanglaTextRenderer
from PIL import Image

# Create renderer with your Bangla font
renderer = BanglaTextRenderer(
    font_path='NotoSansBengali-Bold.ttf', # give your font name here /// download your font .ttf file and put on windows\fonts directory
    font_size=48,
    color=(255, 255, 255, 255)  # White
)

# Render text
text = "বাংলা লেখা সঠিকভাবে"
img = renderer.render_text(text, width=800)

# Save image
img.save('output.png')

Features

  • ✅ Perfect vowel positioning - Fixes misplaced vowel marks (ি, ী, ে, ৈ, etc.)
  • ✅ Joint letter support - Handles যুক্তাক্ষর correctly
  • ✅ Text wrapping - Automatic word wrapping
  • ✅ Multiple alignments - Left, center, right
  • ✅ Shadow effects - Built-in text shadow
  • ✅ Unicode normalization - Proper NFC normalization

Advanced Usage

Text with Shadow

img = renderer.render_text_with_shadow(
    text="বাংলা টেক্সট",
    width=800,
    shadow_offset=3,
    shadow_color=(0, 0, 0, 180)
)

Custom Alignment and Line Spacing

img = renderer.render_text(
    text="বাংলা লেখা",
    width=800,
    max_lines=3,
    line_spacing=15,
    align='center',  # 'left', 'center', or 'right'
    background=(255, 255, 255, 255)  # White background
)

Integration with Existing Images

from PIL import Image

# Load base image
base_img = Image.open('background.jpg').convert('RGBA')

# Render Bangla text
text_img = renderer.render_text("বাংলা", width=500)

# Paste text on base image
base_img.paste(text_img, (100, 100), text_img)
base_img.save('result.png')

How It Works

The package implements proper Bangla text shaping by:

  1. Normalizing text to Unicode NFC form
  2. Splitting combined vowel signs (ো, ৌ)
  3. Reordering pre-base vowels to appear before consonants
  4. Processing joint letters (যুক্তাক্ষর) with virama (্)

This ensures text renders exactly as it should appear visually.

Supported Fonts

Works with any Unicode Bangla font:

  • Noto Sans Bengali
  • Noto Serif Bengali
  • Kalpurush
  • SolaimanLipi
  • Vrinda
  • And more...

Requirements

  • Python 3.7+
  • Pillow 8.0.0+

License

MIT License

Contributing

Contributions welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please open an issue on GitHub.

Metadata

Release files for bangla-text-renderer 1.4.1

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

Source distribution (sdist)

Source distribution for bangla-text-renderer 1.4.1
File Size Uploaded Provenance
bangla_text_renderer-1.4.1.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bangla-text-renderer 1.4.1
File Interpreter ABI Platform
bangla_text_renderer-1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / bangla_text_renderer-1.4.1.tar.gz

Download URL bangla_text_renderer-1.4.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d283fd8bb1f8aeb1a37c67bb78c4e4fe96093788f03ce430fea60210bdb75e20
BLAKE2b-256 checksum
How to use checksums
51c821c71eb8c9d7bb7a082a97801fb7ec1705a40b4451868ed670fe73b57086
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.0

Release files / bangla_text_renderer-1.4.1-py3-none-any.whl

Download URL bangla_text_renderer-1.4.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1664f48abcabfa4125d14d538bd964c4345c209f16fff5f6eec13c769183451d
BLAKE2b-256 checksum
How to use checksums
7093cbb626b296b65420c69d4f1ed5604eaea9bda2ce32adf31a39ab8a1e5386
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.14.0

Security for bangla-text-renderer 1.4.1

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

1.4.1 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