Issue in Render Arabic font (Cairo)

try convert word file to pdf , convert done but there are issues in render font
image.png (31.5 KB)

9dbac7f6-ece5-4c48-b37e-302686580443.pdf (40.6 KB)
اليوم.docx (15.9 KB)

Hi @FutureFaceSupport ,

I definitely see the problem with rendering arabic fonts in your output PDF file and on the screenshot, but undfortunately I was not able to reproduce the issue on my side. Output PDF, rendered on my PC, is absolutely correct, I’m attaching it here - “اليوم-VIEWERNET_5530-trial.pdf”.

اليوم-VIEWERNET_5530-trial.pdf (44.2 KB)

Here is a source code I’ve used to render this DOCX to the PDF:

PdfViewOptions pdfViewOpt = new PdfViewOptions(outputPdfPath);
using (Viewer viewer = new Viewer(inputWordsPath))
{
     viewer.View(pdfViewOpt);
}

It seems like the real reason of the issue is a lack of some fonts installed on your machine. Please perform the next piece of source code on your machine to analyze which original and substituted fonts the GroupDocs.Viewer is using while rendering DOCX to PDF:

const string filename = "اليوم.docx";
using (Viewer viewer = new Viewer(filename))
{
    Fonts.IFontInfo[] allFonts = viewer.GetAllFonts();
    Console.WriteLine("{0} fonts found in the '{1}' document", allFonts.Length, filename);
    foreach (Fonts.IFontInfo font in allFonts)
    {
        if (font is Fonts.WordProcessingFontInfo)
        {
            Fonts.WordProcessingFontInfo realFont = (Fonts.WordProcessingFontInfo)font;
            Console.WriteLine("{0} - style {1} - {2} format - charset {3} - {4}",
                realFont.FamilyName,
                realFont.Style,
                realFont.Format,
                realFont.Charset,
                realFont.IsEmbedded ? "embedded" : "system");
        }
        else if (font is Fonts.WordProcessingSubstitutedFontInfo)
        {
            Fonts.WordProcessingSubstitutedFontInfo substitutedFont = (Fonts.WordProcessingSubstitutedFontInfo)font;
            Console.WriteLine("Substituted family name: {0}; Original family name: {1}; Style: {2}; Format: {3}.",
                substitutedFont.FamilyName,
                substitutedFont.OriginalFamilyName,
                substitutedFont.Style,
                substitutedFont.Format);
        }
        else
        {
            throw new InvalidOperationException();
        }
    }
}

And share the result.

With best regards and waiting for the reply,
Denis Gvardionov

the font already installed by some characters do not render correctly
see the below image height characters in yellow are different font other characters

document which you sent font in not Cairo you have to install it on your machine to produce the issue
you can download it from [https://fonts.google.com/specimen/Cairo]
(https://fonts.google.com/specimen/Cairo)
image.png (22.6 KB)

Thanks

Hi @FutureFaceSupport

Thanks for the advice. After installing a full pack of static “Cairo” fonts I was able to reproduce the exact situation as on your screenshot. Logged as a bug, developers are informed. We will inform you when there will be any feedback from them.

With best regards,
Denis Gvardionov

ok thanks a lot

Hi @FutureFaceSupport

I’ve obtained a respnse from our developers and re-checked it on my side and here are the results.

  1. It is correct that installing the Cairo font changes the appearances of the Arabic glyphs. This is because if Cairo is not installed, the font “Arial” is used as a substitution.
  2. By default the GroupDocs.Viewer tries to mimic the MS Word as much as possible, but there are some specific options, that should be explicitly enabled to improve the fidelity.
  3. If you want to obtain the exactly the same document view, as it can be seen in MS Word, with per-pixel fidelity, and in your scenario the Cairo font is installed, you need to set the true value for the WordProcessingOptions.EnableOpenTypeFeatures instance property. If you’re saving a document to PDF, set the PdfViewOptions.WordProcessingOptions.EnableOpenTypeFeatures = true, if to PNG — PngViewOptions.WordProcessingOptions.EnableOpenTypeFeatures = true, and so on.

With best regards,
Denis Gvardionov