Fonts Are Getting Distorted and Overwritten in Slides after Importing PPT in Java

Hi Team,
The original ppt looks all good but when we are trying to import it to our tool using aspose slides in java we are seeing the fonts are getting smashed.
the original slides:
image.jpg (56.0 KB)
image.jpg (93.3 KB)
the imported slides are attached below:
image.png (80.9 KB)

image.png (29.0 KB)

Can anyone please look into this issue?

@bpradhan,
Thank you for contacting support.

We need more details to investigate the case and help you. Please share the following files and information:

  • original presentation file
  • code example that creates the presentation with the distorted fonts
  • output presentation file
  • OS version on which the code was executed
  • JDK target version in your app
  • Aspose.Slides version you used

Before that, please check if the fonts used in the presentation are installed in the OS on which the code was executed. You can also load them in runtime.
Custom PowerPoint Font in Java|Aspose.Slides Documentation

Hi Andrey,
Thanks for reaching out. I have attached the PPT file and provided the info as below which you needed

code example that creates the presentation with the distorted fonts -

FontsLoader.loadExternalFonts(new String[]{"pathToCustomFontsLocations"});
LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto);
loadOptions.setDefaultRegularFont("Arial");
loadOptions.setDefaultAsianFont("Arial");
Presentation presentation = new Presentation("FilePath", loadOptions);
int i = 0;
for (ISlide iSlide: presentation.getSlides()) {
    Dimension2D slideSize = presentation.getSlideSize().getSize();
    Dimension dimension = new Dimension();
    dimension.setSize(slideSize.getWidth(), slideSize.getHeight());
    BufferedImage thumbnail = iSlide.getThumbnail(dimension);
    String outputFileName = "output" + i++ + ".png";
    File outputFile = new File(outputFileName);
    try {
        ImageIO.write(thumbnail, "png", outputFile);
    } catch (IOException e) {
        System.out.println("Failed to write image to file: " + e.getMessage());
    }
}
  1. output presentation file - Issue in thumbnail generated not ppt file

  2. OS version on which the code was executed: Linux ip-172-18-24-66.eu-central-1.compute.internal 5.10.210-201.852.amzn2.x86_64 #1 SMP Tue Feb 27 17:09:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

  3. JDK target version in your app: openjdk version “1.8.0_402”
    OpenJDK Runtime Environment (build 1.8.0_402-b06)
    OpenJDK 64-Bit Server VM (build 25.402-b06, mixed mode)

  4. Aspose.Slides version you used - 23.11

image.png (451.3 KB)

SamplePPT.pptx.zip (2.2 MB)

Not able to upload the full ppt despite having only 14 MB because of some error so i have attached only few slides of the PPT.

If you need any further details please reach out to us. Thank you!!

@bpradhan,
Thank you for the details. Could you kindly also share the external fonts you loaded using the FontsLoader.loadExternalFonts method and your output images?

You can share a link to the files saved in a file storage (Google Drive, Dropbox, etc).

Hi @andrey,
Uploading the zip file which contains the fonts zip file which are used in that slide and also uploaded the sample PPT file for which we are seeing the issue.

Added the slide thumbnails also after they got generated using the code.
https://drive.google.com/drive/folders/10zbtx_tmRrPcWyg92_43cMyTddeLd1sL?usp=drive_link

@bpradhan,
Thank you for the files.

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-39452

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.

@bpradhan,
We were unable to reproduce the problem you encountered. It looks like there is a problem with accessing fonts. Could you kindly check what fonts are available for the process?

Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for ( int i = 0; i < fonts.length; i++ )
{
    System.out.println(fonts[i].toString());
}

Also, could you please provide the output of the ‘fc-list’ command?

The issue happened in a prod instance so won’t be able to execute this process there but please have a look at the ouput of the ‘fc-list’ command
output:

Fontconfig warning: ignoring UTF-8: not a valid region tag
/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/liberation/LiberationSerif-Italic.ttf: Liberation Serif:style=Italic
/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf: DejaVu Serif:style=Italic
/usr/share/fonts/liberation/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/liberation/LiberationMono-Bold.ttf: Liberation Mono:style=Bold
/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique
/usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
/usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
/usr/share/fonts/liberation/LiberationSansNarrow-Bold.ttf: Liberation Sans Narrow:style=Bold
/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf: Liberation Serif:style=Bold Italic
/usr/share/fonts/liberation/LiberationSansNarrow-Regular.ttf: Liberation Sans Narrow:style=Regular
/usr/share/X11/fonts/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic
/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/ipa-gothic/ipag.ttf: IPAGothic:style=Regular
/usr/share/X11/fonts/Type1/UTBI____.pfa: Utopia:style=Bold Italic
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf: Liberation Serif:style=Regular
/usr/share/fonts/liberation/LiberationSerif-Bold.ttf: Liberation Serif:style=Bold
/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf: VL Gothic:style=regular
/usr/share/fonts/liberation/LiberationMono-Italic.ttf: Liberation Mono:style=Italic
/usr/share/X11/fonts/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular
/usr/share/fonts/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf: Liberation Sans:style=Bold Italic
/usr/share/fonts/ipa-mincho/ipam.ttf: IPAMincho:style=Regular
/usr/share/fonts/dejavu/DejaVuSerifCondensed-BoldItalic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic
/usr/share/fonts/liberation/LiberationSansNarrow-Italic.ttf: Liberation Sans Narrow:style=Italic
/usr/share/X11/fonts/Type1/c0648bt_.pfb: Bitstream Charter:style=Regular
/usr/share/fonts/dejavu/DejaVuSerifCondensed-Bold.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold,Bold
/usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf: VL PGothic:style=regular
/usr/share/fonts/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique
/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/ipa-pmincho/ipamp.ttf: IPAPMincho:style=Regular
/usr/share/fonts/liberation/LiberationSansNarrow-BoldItalic.ttf: Liberation Sans Narrow:style=Bold Italic
/usr/share/X11/fonts/Type1/cursor.pfa: Cursor:style=Regular
/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
/usr/share/X11/fonts/Type1/UTB_____.pfa: Utopia:style=Bold
/usr/share/fonts/liberation/LiberationMono-Regular.ttf: Liberation Mono:style=Regular
/usr/share/fonts/ipa-pgothic/ipagp.ttf: IPAPGothic:style=Regular
/usr/share/X11/fonts/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold
/usr/share/fonts/dejavu/DejaVuSerifCondensed-Italic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Italic,Italic
/usr/share/X11/fonts/Type1/UTI_____.pfa: Utopia:style=Italic
/usr/share/fonts/liberation/LiberationSans-Italic.ttf: Liberation Sans:style=Italic
/usr/share/X11/fonts/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic
/usr/share/fonts/dejavu/DejaVuSansCondensed.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
/usr/share/fonts/dejavu/DejaVuSerif-BoldItalic.ttf: DejaVu Serif:style=Bold Italic
/usr/share/fonts/dejavu/DejaVuSans-ExtraLight.ttf: DejaVu Sans,DejaVu Sans Light:style=ExtraLight
/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf: Liberation Mono:style=Bold Italic
/usr/share/fonts/dejavu/DejaVuSansCondensed-BoldOblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
/usr/share/X11/fonts/Type1/c0633bt_.pfb: Bitstream Charter:style=Bold Italic
/usr/share/fonts/liberation/LiberationSans-Regular.ttf: Liberation Sans:style=Regular
/usr/share/X11/fonts/Type1/c0649bt_.pfb: Bitstream Charter:style=Italic
/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf: DejaVu Sans:style=Oblique
/usr/share/X11/fonts/Type1/c0632bt_.pfb: Bitstream Charter:style=Bold
/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf: DejaVu Sans:style=Bold Oblique
/usr/share/X11/fonts/Type1/UTRG____.pfa: Utopia:style=Regular

@bpradhan,
Thank you for the additional information. I’ve forwarded it to our developers.

@bpradhan,
You have quite a few fonts installed. Could you kindly archive them and send them to us for further investigation?

Hi @andrey.potapov uploaded the google drive link having a zip file containing the list of used fonts.
https://drive.google.com/drive/folders/1mt-B7Z7xBGAIbF4swkY5YFbZD8MgoN7H?usp=sharing

I was not able to upload the file as it was giving error of max 48 MB supported for upload , however my zip file is 32 MB but still not able to upload, Hence attached the sharable link. Please let me know if you need any further details.

Thank you!!

@bpradhan,
Thank you for the font files. I’ve forwarded them to our developers.

@bpradhan,
We are still unable to reproduce the issue. We used this VM - Index of /os-images/2.0.20231218.0/vmware (and 2 other versions) with different versions of JDK and slides. Unfortunately, we couldn’t find the exact JDK (OpenJDK 1.8.0_402) you are using. We used Amazon Corretto 1.8.0_402.

We suggest updating OpenJDK to the latest version (or using the Amazon-Corretto version of OpenJDK) or removing all fonts except dejavu, and checking the generation after that. Perhaps this will solve the problem.

If it is not possible to remove fonts, could you please create another folder with fonts and duplicate the fonts used in the operating system in it, and use FontsLoader for this folder?