Why Installed Pacifico Font Is Being Substituted to Fallback Fonts in Aspose.Slides?

The PowerPoint presentation uses font “Brush Script MT”. The presentation shall be saved as a PDF. Using a FontSubstRule it shall be replaced with “Pacifico”, which is installed on the Windows machine. But using a WarningCallback the following warning is emitted:

Aspose-Warning type 1: Font will be substituted from Pacifico to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}

Why is Pacifico substituted even it is installed?
Addionally: In the example provided there are two different substiturions for Pacifico. What is the reason for the different substitutions?
‘aspose-slides’, version: ‘25.5’ is used.

@Tim49

Cause

The warning you are encountering indicates that the font “Pacifico” is being substituted with a fallback font, despite it being installed on your system. This can happen if the font is not correctly recognized or if there are issues with the font itself, such as unsupported styles or characteristics.

Solution

To resolve this issue, ensure that the font “Pacifico” is properly installed and accessible to the Aspose.Slides library. You can also check the following:

  1. Font Installation: Verify that “Pacifico” is installed correctly on your Windows machine. You can do this by checking in the Fonts settings of your operating system.

  2. Font Substitution Rules: Ensure that your FontSubstRule is set up correctly to replace “Brush Script MT” with “Pacifico”. Here’s a sample code snippet to set up the substitution:

    FontSubstRule rule = new FontSubstRule("Brush Script MT", "Pacifico");
    FontSubstRuleCollection rules = new FontSubstRuleCollection();
    rules.add(rule);
    presentation.getFontsManager().setFontSubstRules(rules);
    
  3. Warning Callback: Implement a warning callback to capture and log any warnings that occur during the PDF generation process. This can help you identify specific issues related to font substitution.

Code

Here’s an example of how to set up the FontSubstRule and handle warnings:

Presentation presentation = new Presentation("your_presentation.pptx");
presentation.getFontsManager().setFontSubstRules(new FontSubstRuleCollection() {{
    add(new FontSubstRule("Brush Script MT", "Pacifico"));
}});

presentation.save("output.pdf", SaveFormat.Pdf, new PdfOptions() {
    @Override
    public void setWarningCallback(IWarningCallback callback) {
        super.setWarningCallback(callback);
    }
});

Next Steps

  1. Test the above code to see if the warning persists.
  2. If the issue continues, consider checking for any updates or patches for Aspose.Slides that might address font handling.
  3. If you still face issues, please provide additional details about your environment and any specific configurations you are using.

Please implement these steps and let me know the outcome!

I verified that the font “Pacifico” is installed. My example code has implemented the font substitution and WarningCallback as suggested. Running the example the output is

Loading licence …Aspose.Total.Product.Family- 2024.lic
Aspose-Warning type 1: Font will be substituted from Pacifico to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}
Aspose-Warning type 1: Font will be substituted from Aptos to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}

I attached the example java program, the “Pacifico” font I installed and the presentation that is used by the example.
Why is Pacifico substituted even it is installed and why are there different substitutions?
FontsSubstitution.zip (163,5 KB)

@Tim49,

Thanks for the sample PowerPoint PPTX document, font file and sample code snippet.

After initial testing, I am able to reproduce the issue as you mentioned by using your template PowerPoint presentation file and sample code snippet. I found the installed font was substituted unnecessarily.

We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39688

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Tim49,

We evaluated your issue in details. Actually we partially reproduced the problem:

Aspose-Warning type 1: Font will be substituted from Aptos to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}
Aspose-Warning type 1: Font will be substituted from Pacifico to {Courier New}

We don’t have Aptos and Pacifico fonts installed. But if I add FontsLoader with the provided Pacifico font, the output changes to this:

Aspose-Warning type 1: Font will be substituted from Aptos to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}

Example:

FontsLoader.loadExternalFonts(new String[] { pathToFolderWithFont });

After testing, we suspect there is a problem with the Palico font installed on your computer.

1). Can you please check if the font is available in java?

    public static void main(String[] args) {
        String fontName = "Pacifico";

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Font[] allFonts = ge.getAllFonts();

        boolean fontFound = false;

        for (Font font : allFonts) {
            if (font.getFontName().equalsIgnoreCase(fontName) ||
                    font.getFamily().equalsIgnoreCase(fontName)) {

                fontFound = true;
                printFontInfo(font);
                break;
            }
        }

        if (!fontFound) {
            System.out.println("Font '" + fontName + "' is not available.");
            System.out.println("Available fonts:");
            for (Font font : allFonts) {
                System.out.println("- " + font.getFontName());
            }
        }
    }

    private static void printFontInfo(Font font) {
        System.out.println("=== Font characteristics ===");
        System.out.println("Font Name: " + font.getFontName());
        System.out.println("Font Family: " + font.getFamily());
        System.out.println("PostScript Name: " + font.getPSName());
        System.out.println("Size: " + font.getSize());
        System.out.println("Style: " + getStyleName(font.getStyle()));
        System.out.println("Bold: " + font.isBold());
        System.out.println("Italic: " + font.isItalic());
        System.out.println("Plain: " + font.isPlain());
    }

    private static String getStyleName(int style) {
        switch (style) {
            case Font.PLAIN: return "Plain";
            case Font.BOLD: return "Bold";
            case Font.ITALIC: return "Italic";
            case Font.BOLD + Font.ITALIC: return "Bold Italic";
            default: return "Unknown";
        }
    }

2). Can you also provide us with additional information:

OS version
JDK version
additional fonts (if installed)

3). If possible, can you provide a docker file that allows this issue to be reproduced? (This will allow us to say with 100% certainty that the cause has been found and corrected.).

Sorry I am not able to provide the requested docker file.

Executing the exmple you provided (using import java.awt.Font;) the output is:

=== Font characteristics ===
Font Name: Pacifico Regular
Font Family: Pacifico
PostScript Name: Pacifico-Regular
Size: 1
Style: Plain
Bold: false
Italic: false
Plain: true

- OS version: Windows 10 Enterprise, Version 22H2
- JDK version: jdk-17.0.10_7

- additional fonts (if installed) 
As it is a Windows laptop lots of fonts are installed. Here is a screenshot from the explorer where you can see the "Pacifico Regular" font:
<a class="attachment" href="/uploads/default/109847">Screenshot Fonts.png</a> (65,9 KB)

Examine the registry key "Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" I can see that "Pacifico Regular (TrueType)" is installed at "C:\Users\MYUSER\AppData\Local\Microsoft\Windows\Fonts\Pacifico-Regular_0.ttf"

**And**  "dir C:\Users\tsteen\AppData\Local\Microsoft\Windows\Fonts" shows
 Directory of C:\Users\tsteen\AppData\Local\Microsoft\Windows\Fonts
23.06.2025  16:37    <DIR>          .
23.06.2025  16:37    <DIR>          ..
30.05.2025  09:51           315.408 Pacifico-Regular.ttf
23.06.2025  16:37           315.408 Pacifico-Regular_0.ttf
               2 File(s)        630.816 bytes

@Tim49,

Thank you for sharing the details.

We have recorded this information under your ticket “SLIDESJAVA-39688” in our database. We will review it promptly and follow up with you soon.

Based on the registry entry I realized that the font was just installed for me and not for all users. After installing the Pacifico font for all users the output of the example program is

Loading licence …Aspose.Total.Product.Family- 2024.lic
Aspose-Warning type 1: Font will be substituted from Aptos to {Arial,Cambria Math,MS Gothic,Gulim,Arial Unicode,SimSun,Segoe UI Symbol,DejaVu Sans,Liberation Serif,FreeSans}
saved C:\ws\NcAspose\Fonts\Brush Skript MT.pdf

So I think the issue is resolved now.
Thank you very much for your help!
Tim

@Tim49,

Thank you for confirming that your issue has been resolved after installing the Pacifico font for all users. We will proceed to close the ticket. If you have any further questions or comments, please don’t hesitate to reach out to us.