Unplanned
Last Updated: 25 May 2023 10:51 by Ali
Ali
Created on: 25 May 2023 10:51
Category: PdfProcessing
Type: Bug Report
1
PdfProcessing: Provide support for ligatures

When inserting ligature languages text into a block, the text doesn't appear on the generated PDF file.

With the following sample code, the issue can be reproduced:

private static string fileName = "Hello.pdf";
        static void Main(string[] args)
        {
            byte[] fontData = File.ReadAllBytes("calibri.ttf");
            FontFamily fontFamily = new FontFamily("Calibri");
            FontsRepository.RegisterFont(fontFamily, FontStyles.Normal, FontWeights.Normal, fontData);

            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage page = new RadFixedPage();

            string text = "مرحبا";
            var reversedText = text.ToCharArray();
            Array.Reverse(reversedText);
            Block block = new Block();
            block.InsertText(new FontFamily("Calibri"), new string(reversedText));

            FixedContentEditor editor = new FixedContentEditor(page);
            editor.DrawBlock(block);
            document.Pages.Add(page);

            PdfFormatProvider provider = new PdfFormatProvider();
            using (Stream output = File.OpenWrite(fileName))
            {
                provider.Export(document, output);
            }

            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = fileName;
            Process.Start(fileName);
        }

0 comments