In theme1.xml of unzipped pptx, there are global font settings like below.
<a:font script="Jpan" typeface="XXX" />
<a:font script="Hang" typeface="XXX" />
<a:font script="Hans" typeface="XXX" />
I checked presentation.master_theme.font_scheme.major
, there is no methods to get global font settings.
How can we change the typeface value with Aspose.Slides?
thanks
@s.nakagaki
To change the typeface of the fonts in the major and minor font schemes of a master theme using Aspose.Slides, you can utilize the font_scheme
property of the master_theme
. Here’s how you can set the typeface for both major and minor fonts:
from aspose.slides import Presentation, FontData
# Load your presentation
presentation = Presentation("your_presentation.pptx")
# Access the master theme
master_theme = presentation.master_theme
# Set the typeface for the major font scheme
master_theme.font_scheme.major.latin_font = FontData("Your Major Font")
# Set the typeface for the minor font scheme
master_theme.font_scheme.minor.latin_font = FontData("Your Minor Font")
# Save the presentation
presentation.save("updated_presentation.pptx")
In this code snippet:
- Replace
"Your Major Font"
and "Your Minor Font"
with the desired font names.
- The
latin_font
property is used to specify the font for the Latin script. You can also set fonts for other scripts if needed.
Keep in mind that the font set for the master theme will only apply if no specific font is set for the text in the slides. If you have set a different font for a text element, the master theme font will not override it.
For more detailed information, you can refer to the documentation on Presentation Theme and Text Formatting.
If you encounter any issues or need further assistance, feel free to ask!
That code does not change special language fonts but change following three items.
<a:fontScheme name="Century Schoolbook">
<a:majorFont>
<a:latin typeface="XXX" />
<a:ea typeface="XXX" />
<a:cs typeface="XXX" />
I want to change special language font names.
<a:fontScheme name="Century Schoolbook">
<a:majorFont>
<!-- I know we can change these three fonts -->
<a:latin typeface="XXX" />
<a:ea typeface="XXX" />
<a:cs typeface="XXX" />
<!-- I want to change special language font names -->
<a:font script="Jpan" typeface="XXX" />
<a:font script="Hang" typeface="XXX" />
<a:font script="Hans" typeface="XXX" />
. . .
thanks
@s.nakagaki,
Thank you for contacting free support. Could you please share a sample presentation file so we can investigate the issue and assist you?
Here you are.
Only you need to do changes the extension ( .zip
→ .pptx
) .
font_test.zip (35.7 KB)
The specification in Open XML SDK for Office is here.
thanks
@s.nakagaki,
Thank you for the sample presentation file. Unfortunately, I was also unable to change the font settings you described using Aspose.Slides.
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-277
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.
Hi, Thank you for opening new ticket.
We are considering to buy the Site OEM license.
If we buy it, how much priority will it be?
thanks
@s.nakagaki,
In this case, the ticket will be marked as “Paid Customer,” and the issue will be prioritized.
@s.nakagaki,
The issues you found earlier (filed as SLIDESPYNET-277) have been resolved in Aspose.Slides for Python 25.8 (Windows x64, Windows x86, Linux, macOS x86-x64, macOS ARM64).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page or PyPI.