dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

Bangla text Rendering issue.

Open helper-bud opened this issue 10 months ago • 4 comments

getting this bangla text. Screenshot 2024-03-30 112609 want this bangla text. Screenshot 2024-03-30 144903

when i am copying from the generated pdf, and pasting some where else the text gets right.

code : final pdf = pw.Document(); var logger = Logger();

final banglaFont =
    await rootBundle.load("assets/fonts/AnekBangla/kalpurush.ttf");
final banglaFontTtf = pw.Font.ttf(banglaFont);

pw.Table( border: pw.TableBorder.all(), children: [ pw.TableRow( pw.Text("${innerLoop.groupid} - ${innerLoop.grpnam}", style: pw.TextStyle( font: banglaFontTtf, fontSize: 6, ), textAlign: pw.TextAlign.center, maxLines: 1), ) ]

)

helper-bud avatar Mar 30 '24 08:03 helper-bud

Kemon acho vai ,it seems same to me :D I don't know the solution i just wanted to say hi !

bksbora avatar May 21 '24 15:05 bksbora

Oh you should look at this. I guess for Bangla ,help needed. #219

bksbora avatar May 21 '24 15:05 bksbora

solved it. using unicode to bijoy. suppose this is the text : innerLoop.grpnam.toString() in this code :

pw.Text( "${innerLoop.groupid} - ${CodeUtil.unicodeToBijoyText(innerLoop.grpnam.toString())}", style: pw.TextStyle( font: banglaFontTtf, fontSize: 6, )

   static String unicodeToBijoyText(String text) {
return unicodeToBijoy(utf8.decode(utf8.encode(text)));

}

Tarikul-Islam-Shykat avatar Jun 15 '24 17:06 Tarikul-Islam-Shykat

i found that solution by on the day when i found it. but posting it hope it helps.

Tarikul-Islam-Shykat avatar Jun 15 '24 17:06 Tarikul-Islam-Shykat

unicodeToBijoy

How to use this? Any example will be helpful.

joy2012bd avatar Sep 04 '24 09:09 joy2012bd

I already showed my approach to solve it. You can check above.

helper-bud avatar Sep 04 '24 10:09 helper-bud

I already showed my approach to solve it. You can check above.

I already fixed it another way. Thanks for your quick response.

joy2012bd avatar Sep 04 '24 10:09 joy2012bd