Metadata-Version: 2.4
Name: bangla-text-renderer
Version: 1.4.0
Summary: Perfect Bangla/Bengali text rendering on images/video with correct vowel positioning and joint letter
Home-page: https://github.com/Mahfazzalin/bangla-text-renderer
Author: Mahfazzalin Shawon Reza
Author-email: mahfazzalin1@gmail.com
Keywords: bangla bengali text rendering image video vowel positioning perfect joint letter unicode typography
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Text Processing :: Linguistic
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: Pillow>=8.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


# 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

```bash
pip install bangla-text-renderer
```

## Quick Start

```python
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

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

### Custom Alignment and Line Spacing

```python
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

```python
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.



