Add Custom TTF Font to PowerPoint Presentation Using Aspose.Slides for Python

How to Add custom font (TTF) into PPTX file for Aspose.Slides Python?

@leonard773737,
Thank you for contacting support. I am working on the question and will get back to you as soon as possible.

1 Like

@leonard773737,
Thank you for your patience.

You can use the FontsManager class to embed any TTF font into your PowerPoint presentation like this:

with open("MyFont.ttf", "rb") as font_data:
    presentation.fonts_manager.add_embedded_font(
        font_data.read(), slides.export.EmbedFontCharacters.ALL)

In this case, the font will be displayed correctly in PowerPoint, its presence in the operating system is not required.

See also:

It works.
but pptx file changed “readonly”.
how can I change file for “write” attribute?
Thanks for help :slight_smile:

@leonard773737,
If your presentation has been marked as “Read-Only”, you can remove this protection as follows:

file_name = "MyPresentation.pptx"

with slides.Presentation(file_name) as presentation:
    presentation.protection_manager.read_only_recommended = False
    presentation.save(file_name, slides.export.SaveFormat.PPTX)
1 Like

thanks for reply
but It is not work.
this is powerpoint error message

"Microsoft PowerPoint
This presentation cannot be edited because it contains one or more read-only embedded (restricted) fonts. To edit the presentation you must remove the restricted fonts, or you can open the presentation as read-only.
Read-only embedded fonts included in this presentation:

how can I fix it?

@leonard773737,
Please check your results using the latest version of Aspose.Slides for Python if possible. If the issue persists, please share the following files and information:

  • initial presentation file
  • TTF font you used
  • code example that reproduces the problem
  • resulting presentation file
  • OS version on which the code was executed
  • Aspose.Slides version you used

Here is my test example.
Please check what the problem is.
Thanks :slight_smile:
Aspose.Slides version 23.7.0aspose.zip (1010.1 KB)

@leonard773737,
Thank you for the files. I am working on the question and will get back to you as soon as possible.

@leonard773737,
Fonts have embedding permissions, which are set by the type foundry. In your case, the EBS Hunminjeongeum R font is read-only embedded, so the message appears in PowerPoint. You can use a different font.

https://www.microsoft.com/en-us/microsoft-365/blog/2015/07/06/document-font-embedding-demystified/

1 Like

Hello.
When I inserted a font into pptx created with pptxgenjs, a warning window saying “PowerPoint can attempt to repair the presentation” appeared in ppt. Is there any solution? Attach the problem PPTX file.
Thanks.
pptx_samples.zip (409.6 KB)

@leonard773737,
It looks like you used the font file and code example from here. Could you please confirm?

I tried another example. another font and another pptx.

@leonard773737,

Could you please share the code example and font file you used?

here is example(font, python source)
source_pptx.zip (567.6 KB)

@leonard773737,
Thank you for the additional data. I am working on the issue and will get back to you as soon as possible.

@leonard773737,
I’ve reproduced the problem you described.

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): SLIDESPYNET-143

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.

Thank you for your support. I am planning to purchase the product. Can I receive a product that has the problem resolved when I purchase it?

@leonard773737,
I’ve requested information from our developers for you. We will let you know soon.

@leonard773737,
The problem will be resolved in Aspose.Slides for Python 24.1. This release will be published in the second half of January 2024. We apologize for any inconvenience.

1 Like