PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Arabic support Right to left
http://forum.pdfsharp.com/viewtopic.php?f=2&t=3698
Page 1 of 1

Author:  devan [ Sun Nov 26, 2017 4:19 pm ]
Post subject:  Arabic support Right to left

HI.
I am developing a C# winforms application.
In PDFsharp how i can print arabic text and how to print right to left.

I used below to code to print Arabic. It print Arabic characters but not in right to left order.

XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
const string familyName1 = "Arial Unicode MS";
XFont fontB = new XFont(familyName1, 16, XFontStyle.Regular, options);

gfx.DrawString("فاتورة", fontB, XBrushes.MidnightBlue, new XRect(260, 90, 80, 15), XStringFormats.TopCenter)

Author:  TH-Soft [ Sun Nov 26, 2017 6:20 pm ]
Post subject:  Re: Arabic support Right to left

Hi!

For some languages you can fake "right to left" by simply reversing the string.
With Arabic you also must make sure you use the correct glyph for beginnings, ends, and middle positions. Support for that is not (yet) included with PDFsharp.

Author:  devan [ Sun Nov 26, 2017 6:50 pm ]
Post subject:  Re: Arabic support Right to left

HI,
Which is correct glyph for Arabic?
When I reverse the string some characters looks get changes.

Author:  TH-Soft [ Sun Nov 26, 2017 8:13 pm ]
Post subject:  Re: Arabic support Right to left

devan wrote:
Which is correct glyph for Arabic?
Not my area of expertise. I cannot read Arabic.
There are four variants of "letter Beeh": isolated, initial, medial, final. PDFsharp does not (yet) select the correct variant based on the context.
I assume that your code must translate "Letter Beeh" found in the text with one of the for special variants, depending on the context.

Author:  stefanolsen [ Mon Apr 08, 2019 7:28 pm ]
Post subject:  Re: Arabic support Right to left

I did a workaround for Arabic texts, recently.
It works by converting the Arabic letters to correct glyphs, depending on letter positions. And then reversing those new characters.

I wrote this blog post about it: Rendering correct Arabic glyphs in PDF (using PdfSharp)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/