How does aspose support google noto font?

Figured out. After I copied font files from mac, it works now.

Thanks.

Just realized that legally we can’t use Windows fonts in linux environment.

Is it possible to use google noto fonts when we convert word document to PDF? Seems currently it will fail back to “Times New Roman”, unless we remove “Times New Roman” fonts from the fonts folder, which is not what we want.

For example, let’s say the Font name in word doc is something chinese ChineseSong, is it possible to let Aspose to use NotoCJKsc ?

Thanks a lot for your help. I know this is very tricky question.

// Jack

*santi3santi3santi3:
Just realized that legally we can’t use Windows fonts in linux environment.

Is it possible to use google noto fonts when we convert word document to PDF? Seems currently it will fail back to “Times New Roman”, unless we remove “Times New Roman” fonts from the fonts folder, which is not what we want.

For example, let’s say the Font name in word doc is something chinese ChineseSong, is it possible to let Aspose to use NotoCJKsc ?

Thanks a lot for your help. I know this is very tricky question.*

Hi Jack,

Thanks for your feedback.

Your above stated query appears to be related to Aspose.Words, so I am moving this thread to respective forum, where my fellow workers from respective team will answer this query.

Would you please post the new discussion URL here? I am not able to find the post in aspose word forum.

Kind Regards.

Hi,

Thanks for your inquiry. When installed, Aspose.Words can correctly render Google Noto Fonts to PDF files.

Secondly, if the font used in source Word document is not installed on the machine you’re performing rendering to PDF, Aspose.Words will use some substitute font e.g. ‘Times New Roman’. But, you can change default font name using FontSettings.DefaultFontName property.

I hope, this helps.

Best regards,

Hi Awais,

I need more explanation on this statement:

“When installed, Aspose.Words can correctly render Google Noto Fonts to PDF files.”

We are trying to convert word documents to PDF. The word document could contain various fonts, including east asian characters. Since we are on Linux, we are not allowed to use MS office fonts other than some very old ones. We have Noto fonts setup in fonts folder, which is referenced by font settings. But it appears Aspose will not be able to pick correct font groups, for example, if there is “Song Ti” in words, I would expect Aspose to choose Noto CJK sc font, but it does not, unless I remove all the other fonts in the font directory.

About default font settings, it does not work for us too, because there are a lot of possible fonts in the document, I am not able to find one single default font.

I have attached the sample project in this discussion.

Would you mind to have a phone conversation?

Thanks.

Hi,

Thanks for the details.

Please note that Aspose.Words requires fonts when rendering documents to fixed-page formats such as PDF, XPS or SWF. So, you need to install all possible fonts that your customers might use in their Word documents on the Linux machine you’re performing conversion to PDF. Please check following article:
https://docs.aspose.com/words/java/using-truetype-fonts/

In addition to default font locations, if you’re keeping some fonts in custom location, the following article describes how you should instruct Aspose.Words to look for fonts in system folders as well as a custom defined folder.
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

Regarding installing fonts on Linux machine, please check the following article:
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/

I am afraid, I don’t see any sample project attached in your last post to be able to reproduce your issue on our end. Please provide complete details and resources (source code, Word document and PDF file showing the undesired output) to investigate this scenario further on our end.

Unfortunately, Aspose does not provide technical support over the phone. Phone support is only available for sales and purchase questions.

Best regards,

Hi Awais,

Thanks for the detail information.

I am sorry for missing the attachment, let me attach again.

Since noto fonts too big, I didn’t include them in the zip file. They could be downloaded from

https://fonts.google.com/noto

I installed several fonts under fonts folder, including Noto Sans CJK TC, SC, JP, KR, as well as some free English fonts.

It appears sample application will not be able to map Chinese font from word to Noto CJK SC/TC. The only way I could do is to have words fonts be added to “./fonts” font, but that’s not allowed in linux environment.

I’d like to confirm I didn’t misunderstand the usage.

Thank you very much again!

Hi,

Thanks for your inquiry. Please make sure that your custom fonts folder contain the following fonts:

  • Calibri
  • Cambria
  • Times New Roman
  • Adobe Devanagari
  • Bangla Sangam MN
  • Microsoft Sans Serif
  • Microsoft Himalaya
  • 黑体
  • MS 明朝
  • Webdings
  • Desdemona

Please also use the code from last example here:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

Best regards,

Thanks for the information.

Unfortunately, at least some of those fonts are from Microsoft words, it is only free in windows/mac platform, but they are legally not allowed to be deployed to Unix/Linux environment, which is our production environment.

That’s why I opened this question.

Thanks

Hi,

Thanks for your inquiry. Please try Liberation Fonts which are licensed under OFL and are an alternative to standard Windows fonts such as Arial, Times New Roman, and Courier New. It is by design that Aspose.Words has to use fonts during rendering and if required fonts are not present on the machine, I am afraid, there is no workaround except to install them.

Best regards,

Thanks for the information. I tried the liberation fonts, they do not support asian fonts.

Hi,

Thanks for your inquiry. Please search on web and find some free alternates to those fonts. If we can help you with anything else, please feel free to ask.

Best regards,

Is there anyway to map microsoft fonts to some other equivalent fonts, such as Google Noto fonts? We are on Linux machine, do not have license to use Microsoft fonts.

I see both font sets are in “.ttf” format, I hope they are compatible.

Thanks a lot.

Hi,

Thanks for your inquiry. We are in coordination with our product team to get answer pertaining to your queries. Soon you will be updated with the required information.

Best regards,

Hi,

I think, the FontSubstitutes API (see FontSettings.AddFontSubstitutes and FontSettings.SetFontSubstitutes methods) should work for you. By default it already contains mapping from windows fonts to some of commonly used Linux fonts. However, you are free to add your own mappings. Or as an alternative you could change the fonts in the document model i.e. loop through the Run nodes collection and assign an appropriate Font to it.

Best regards,

Thanks a lot for the information.

I tried to use *FontSettings.AddFontSubstitutes and FontSettings.SetFontSubstitutes, but I am still seeing font not found warning.

Do I miss anything?

Here is my sample code:

static void test1(String name) throws Exception {
    System.out.println("Processing " + name);
    FontSettings.setFontsFolder(
            "fonts/",
            false);
    FontSettings.addFontSubstitutes("Cambria", new String[]{"Noto Sans CJK SC"});
    FontSettings.setFontSubstitutes("Cambria", new String[]{"Noto Sans CJK SC"});
    Document doc = new Document(name);
    PdfSaveOptions saveOptions = new PdfSaveOptions();
    HandleDocumentWarnings callback = new HandleDocumentWarnings();
    doc.setWarningCallback(callback);

    doc.save("/tmp/asianFonts.pdf", saveOptions);
}

static class HandleDocumentWarnings implements IWarningCallback
{
    public void warning(WarningInfo info)
    {
        System.out.println(info.getDescription());
        // We are only interested in fonts being substituted.
    }
}

I am still seeing warning:

Font ‘Cambria’ has not been found. Using ‘Times New Roman’ font instead.*

Hi,

Thanks for your inquiry. I tested the scenario with Aspose.Words 15.8.0 and was unable to reproduce this issue on my side. Both AddFontSubstitutes and SetFontSubstitutes methods are working fine on my end. Please make sure that 1) path you mentioned in setFontsFolder is correct and 2) substitute font name you specified in SetFontSubstitutes method is correct (right click on font file, select properties, go to details tab and their you’ll find “Title”).

Best regards,

Thanks for the information.

I am afraid that it worked for you because you are running in Microsoft/Mac environment where Microsoft fonts are installed.

Would you mind to run it in some Linux environment where there is no Microsoft fonts installed?

Thanks

I tried with Aspose.Words 15.8.0. I am still seeing the same warning message.

Then I tried to use FontForge to change font name to “Cambria” and created a new font file, for some reason, it is still not found. I am wondering which naming field Aspose is looking at.

About the font folder, I tested, it is correct folder. If I copied Microsoft fonts in that folder, program runs without problem; If I removed Microsoft fonts from that folder, warning message is showing up.

Thanks for the helping.