dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

Hindi font issues please help

Open Myepick opened this issue 1 year ago • 4 comments
trafficstars

Bro, i have designed almost 10 pdfs, in my project, and waiting your hindi support but you not adding the hindi / indian unicode languages. please do something i am very tied, and disappointed :(

Myepick avatar Nov 10 '24 14:11 Myepick

you can load fallback fonts and use hindi font from PdfGoogleFonts, it worked for me.

jeffysmak avatar Dec 24 '24 11:12 jeffysmak

@jeffysmak Hi can you share example code ? because I used the same PdfGoogleFonts but still characters are not loaded properly

PranavMasekar avatar Jan 08 '25 05:01 PranavMasekar

@jeffysmak Hi can you share example code ? because I used the same PdfGoogleFonts but still characters are not loaded properly

Hi, This is how i did that workaround, using some fonts from Assets and also from PdfGoogleFonts

List<Font> fallbackFonts = List.empty(growable: true); // a list of fallback fonts

fallbackFonts.add(await PdfGoogleFonts.tiroDevanagariHindiRegular());
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/dejavu/DejaVuSans.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/ipag.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/noto/NotoSans-Regular.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/thai/thai.ttf")));

and this is how i used fallback fonts.
Text('नमस्ते',style: TextStyle(fontFallback: fallbackFonts));

jeffysmak avatar Jan 08 '25 08:01 jeffysmak

@jeffysmak Hi can you share example code ? because I used the same PdfGoogleFonts but still characters are not loaded properly

Hi, This is how i did that workaround, using some fonts from Assets and also from PdfGoogleFonts

List<Font> fallbackFonts = List.empty(growable: true); // a list of fallback fonts

fallbackFonts.add(await PdfGoogleFonts.tiroDevanagariHindiRegular());
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/dejavu/DejaVuSans.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/ipag.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/noto/NotoSans-Regular.ttf")));
fallbackFonts.add(Font.ttf(await rootBundle.load("assets/fonts/thai/thai.ttf")));

and this is how i used fallback fonts.
Text('नमस्ते',style: TextStyle(fontFallback: fallbackFonts));

I tried your way. But it seems some character break related in Bengali language.

ShafiMunshi avatar Jan 25 '25 12:01 ShafiMunshi

Does anyone got any solution to fix this issue? because when I try to render Indian regional language text with joint letters and half letters, it does not display those text properly.

Topiya avatar Jul 02 '25 07:07 Topiya

we have the solution, but our team invested 4 months of time for the solution. all indian languages are working perfectly. connect me on [email protected]

Myepick avatar Sep 07 '25 03:09 Myepick