Simsun-Bold font

Here is the background of the issue :

  • We have two sample pdf
  • The first PDF, let’s called it ‘existing.pdf’ is produced by using old Aspose version. The application produces the *.doc document and later using distiller to produce the *.pdf
  • You can refer to the attachment for the properties of ‘existing.pdf’
  • The second PDF is called ‘new.pdf’ is produced by current Aspose version. The application directly produces *.pdf by instantiating the *.doc document using Aspose

Here is the issue :

  • The chinese character in the ‘existing.pdf’ is using Simsun font and it has been applied with ‘bold’ attribute.
  • The same chinese character in the ‘new.pdf’ is also rendered using Simsun font. But the problem is Aspose renders this too dark. This is why i checked through the properties of the pdf and discovered that Simsun,Bold font may be applied.

Here is the question :

  • Is it possible not to use ‘Simsun,Bold’ font and instead using the normal ‘Simsun’ font ?
  • Is there any alternative for this ?

Regards,
hadi teo

Hi Hadi,

Thanks for your inquiry. In your case, I suggest you please use the DocumentVisitor to change the font properties as shown in following code snippet. If the problem still remains, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.

Document doc = new Document(MyDir + "in.docx");
FontChanger changer = new FontChanger();
doc.Accept(changer);
doc.Save(MyDir + "Out.pdf");
//
/// Class inherited from DocumentVisitor, that chnges font.
///
class FontChanger: DocumentVisitor
{
    ///
    /// Called when a FieldEnd node is encountered in the document.
    ///
    public override VisitorAction VisitFieldEnd(FieldEnd fieldEnd)
    {
        // Simply change font name
        ResetFont(fieldEnd.Font);
        return VisitorAction.SkipThisNode;
    }
    ///
    /// Called when a FieldSeparator node is encountered in the document.
    ///
    public override VisitorAction VisitFieldSeparator(FieldSeparator fieldSeparator)
    {
        ResetFont(fieldSeparator.Font);
        return VisitorAction.SkipThisNode;
    }
    ///
    /// Called when a FieldStart node is encountered in the document.
    ///
    public override VisitorAction VisitFieldStart(FieldStart fieldStart)
    {
        ResetFont(fieldStart.Font);
        return VisitorAction.SkipThisNode;
    }
    ///
    /// Called when a Footnote end is encountered in the document.
    ///
    public override VisitorAction VisitFootnoteEnd(Footnote footnote)
    {
        ResetFont(footnote.Font);
        return VisitorAction.Continue;
    }
    ///
    /// Called when a FormField node is encountered in the document.
    ///
    public override VisitorAction VisitFormField(FormField formField)
    {
        ResetFont(formField.Font);
        return VisitorAction.Continue;
    }
    ///
    /// Called when a Paragraph end is encountered in the document.
    ///
    public override VisitorAction VisitParagraphEnd(Paragraph paragraph)
    {
        ResetFont(paragraph.ParagraphBreakFont);
        return VisitorAction.Continue;
    }
    ///
    /// Called when a Run node is encountered in the document.
    ///
    public override VisitorAction VisitRun(Run run)
    {
        ResetFont(run.Font);
        return VisitorAction.Continue;
    }
    ///
    /// Called when a SpecialChar is encountered in the document.
    ///
    public override VisitorAction VisitSpecialChar(SpecialChar specialChar)
    {
        ResetFont(specialChar.Font);
        return VisitorAction.Continue;
    }
    private void ResetFont(Aspose.Words.Font font)
    {
        if (font.Name == "SimSun")
        {
            // Change the font name if required
            // font.Name = mNewFont;
            font.Bold = false;
        }
    }
    // Font by default
    private string mNewFont = "Tahoma";
}

Hi Tahir Manzoor,
Please find attached the doc generated for chinese characters with simsun bold font.This doc is generated before applying your above sample fontchanger class.
In the attached doc you will be able to observe the chinese characters being bold and thicker.
Will send you the doc generated after applying your above sample fontchanger class in next post.
-Hadi

Hi Tahir Manzoor,
Please find attached the docs attached.
Test.doc->before applying fontchanger sample above.
Test_afterFontchanger.doc->after applying fontchanger sample above.
I could not find any difference after and before applying change.
The chinese characters much thicker and are not visible clearly.
-Hadi

Hi Hadi,

Thanks for your inquiry. I have worked with your document and have found that the Chinese character have font name ‘Times New Roman’. However, MS Word detect it as ‘Simsun’. If you change the font of Chinese characters in MS Word e.g ('投资组合对帐单) to ‘Times New Roman’, MS Word detect it as ‘Simsun’.

Unfortunately, Aspose.Words does not detect Chinese character e.g ('投资组合对帐单) . I have logged this feature request as WORDSNET-8492 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Hi Tahir manzoor,
Confused with your above reply. Can you make it simpler and clear please.Thanks
-Teo Hadi

Hi Hadi,

Thanks for your inquiry. Please accept my apologies for your inconvenience.

Please note that Aspose.Words tries to mimic the same behaviour as MS Word do. Open your Test.doc in MS Word and try to change the font of Chinese character e.g ('投资组合对帐单). Please change the font of Chinese characters to ‘Times New Roman’.

MS Word detects the Chinese character and set its font back to ‘SimSun’.

Aspose.Words returns the font of Chinese character as ‘Times New Roman’. Unfortunately, Aspose.Words does not detect fonts like ‘SimSun’ for Chinese character in this scenario. Hope this answers your query. Please let us know if you have any more queries.

The issues you have found earlier (filed as WORDSNET-8492) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(15)

A post was split to a new topic: Simsun-Bold font problem