bangla_pdf_fixer 3.0.0 copy "bangla_pdf_fixer: ^3.0.0" to clipboard
bangla_pdf_fixer: ^3.0.0 copied to clipboard

Unicode-first Bangla PDF text rendering for Flutter, powered by any_pdf_fixer and HarfBuzz.

Correct Bangla/Bengali Unicode rendering in PDFs generated with Flutter's pdf package. #

Bangla PDF Fixer Version 3 is a full architectural reset. It uses pdf_text_shaper + HarfBuzz for proper OpenType shaping instead of translating Bangla Unicode into legacy ANSI font codes.

What changed in 3.0 #

Before #

Bangla Unicode
→ handwritten rearrangement rules
→ ANSI/legacy character mapping
→ bundled legacy font
→ PDF

Now #

Bangla Unicode
→ HarfBuzz GSUB/GPOS shaping
→ positioned glyph IDs
→ vector glyph rendering
→ invisible Unicode extraction layer
→ PDF

Benefits:

  • conjuncts and vowel signs are driven by the font's real OpenType rules;
  • original Unicode is never destroyed;
  • multiline input stays multiline;
  • no giant replacement map;
  • no package-bundled third-party fonts;
  • PDFs can retain useful copy/search text;
  • the same shaping engine is reusable for Hindi, Tamil, Arabic, etc.

Supported platforms #

Android, iOS, Linux, macOS and Windows.

Web is not supported in 3.0 because the current shaping backend uses native HarfBuzz FFI.

Installation #

dependencies:
  bangla_pdf_fixer: ^3.0.0
  pdf: ^3.13.0

Add a Unicode Bengali font to your app, for example:

flutter:
  assets:
    - assets/fonts/your_unicode_bangla_font.ttf

The font is intentionally not bundled by this package. Choose a font whose license permits your use.

Initialize lazily #

final banglaFont = await BanglaFontManager.instance.loadAsset(
  'assets/fonts/your_unicode_bangla_font.ttf',
);

Only fonts you actually request are loaded.

Text #

BanglaText(
  'আমি বাংলায় লিখছি।',
  style: ShapedTextStyle(
    font: banglaFont,
    fontSize: 16,
  ),
)

Header and paragraph #

BanglaHeader(
  'ফলাফল প্রতিবেদন',
  font: banglaFont,
  fontSize: 24,
),

BanglaParagraph(
  'বাংলা অনুচ্ছেদ এখন আসল Unicode হিসেবেই থাকে।',
  font: banglaFont,
  fontSize: 12,
)

Bullet list #

BanglaBulletList(
  font: banglaFont,
  items: const [
    'প্রথম বিষয়',
    'দ্বিতীয় বিষয়',
    'তৃতীয় বিষয়',
  ],
)

Table #

BanglaTable(
  font: banglaFont,
  headers: const ['নাম', 'শ্রেণি', 'ফলাফল'],
  rows: const [
    ['আরিফ', 'দশম', 'A+'],
    ['নাবিলা', 'নবম', 'A'],
  ],
)

Mixed Bangla + English #

Use the universal style's fallback support:

BanglaText(
  'Invoice ১২৩ — মোট ৳৫০০',
  style: ShapedTextStyle(
    font: banglaFont,
    fallbackFonts: [latinFont],
    fontSize: 14,
  ),
)

Migration from 2.x #

.fix #

You no longer need:

'বাংলা'.fix

The extension remains temporarily for source compatibility, is deprecated, and returns the original string unchanged.

BanglaFontType #

The old bundled-font enum has been removed. Version 3 does not redistribute fonts.

Replace:

BanglaFontManager().getFont(BanglaFontType.kalpurush)

with:

final font = await BanglaFontManager.instance.loadAsset(
  'assets/fonts/your_unicode_bangla_font.ttf',
);

Legacy ANSI fonts #

Do not use a legacy Bijoy/ANSI font with the Unicode shaper. Use a proper Unicode OpenType Bengali font.

Cleanup #

When your PDF generation session is finished:

await document.save();
await BanglaFontManager.instance.dispose();

In a long-running app, keep commonly used fonts cached and dispose them only when the PDF/font service itself is being torn down.

Repository #

https://github.com/ardevcraft/bangla_pdf_fixer

License #

Apache-2.0. User-supplied fonts remain under their own licenses.

Stand With Palestine

10
likes
0
points
294
downloads

Documentation

Documentation

Publisher

verified publisherflutterwiki.com

Weekly Downloads

Unicode-first Bangla PDF text rendering for Flutter, powered by any_pdf_fixer and HarfBuzz.

Repository (GitHub)
View/report issues

Topics

#bangla #bengali #pdf #unicode #typography

License

unknown (license)

Dependencies

flutter, pdf, pdf_text_shaper

More

Packages that depend on bangla_pdf_fixer