Default Font
Set Default Font
Using Aspose.Slides for C++ you can set the default font in PowerPoint presentations. A new method set_DefaultRegularFont() has been added to SaveOptions class. It allows to set the default font used instead of all missing fonts during saving presentations to different formats without reloading the presentations .
The code snippet below demonstrates saving presentation to HTML and PDF with different default regular font.
Use Default Fonts for Rendering Presentation
Aspose.Slides lets you set the default font fore rendering the presentation to PDF, XPS or thumbnails. This article shows how to define DefaultRegular Font and DefaultAsian Font for use as default fonts. Please follow the steps below to loading fonts from external directories by using Aspose.Slides for C++ API:
- Create an instance of LoadOptions.
- Set the DefaultRegularFont to your desired font. In the following example, I have used Wingdings.
- Set the DefaultAsianFont to your desired font. I have used Wingdings in following sample.
- Load the presentation using Presentation and setting the load options.
- Now, generate the slide thumbnail, PDF and XPS to verify the results.
The implementation of the above is given below.
// Use the load options to specify default regular and Asian fonts
auto loadOptions = MakeObject<LoadOptions>(LoadFormat::Auto);
loadOptions->set_DefaultRegularFont(u"Wingdings");
loadOptions->set_DefaultAsianFont(u"Wingdings");
auto pptx = MakeObject<Presentation>(u"DefaultFonts.pptx", loadOptions);
auto image = pptx->get_Slide(0)->GetImage(1, 1);
image->Save(u"DefaultFonts_out.png", ImageFormat::Png);
image->Dispose();
pptx->Save(u"DefaultFonts_out.pdf", SaveFormat::Pdf);
pptx->Save(u"DefaultFonts_out.xps", SaveFormat::Xps);
pptx->Dispose();