Link to home
Start Free TrialLog in
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on

How to remove references to a font that cannot be embedded in PowerPoint, programmatically?

I received a presentation recently that was saved with embedded fonts but wouldn't save due to one un-embeddable font:
User generated imageI used the Replace Fonts tool in PowerPoint to try to get rid of this font reference but it didn't work:
User generated imageInterestingly, VBA reports that there are just 3 fonts in use in the file, none of which are the troublesome font, as per this Immediate pane entry
?ActivePresentation.Fonts.Count
 3 
?ActivePresentation.Fonts(1).Name
Titillium Web
?ActivePresentation.Fonts(2).Name
Titillium WebLight
?ActivePresentation.Fonts(3).Name
Calibri

Open in new window


Having narrowed down a single textbox object that was causing this issue, I then looked at the 5 x font name properties of the shape using VBA:

.Name = "Titillium Web"
.NameAscii = "Titillium Web"
.NameComplexScript = "Titillium WebRegular"
.NameFarEast = "+mn-ea"
.NameOther = "Titillium Web"

Ah ha. So, according to MSDN, the NameComplexScript property is Read/Write so all I need to do is change it from "Titillium WebRegular" to "Titillium Web" and the problem should be fixed?

No! This doesn't change the property and no error is raised:

.NameComplexScript = "Titillium Web"

Open in new window


So my questions are:

1. Why does PowerPoint report more fonts are in use than the API does (I know Arial is used by template bullets)
2. Why can't I write to the NameComplexScript property?
3. Is there any other way to eradicate the referencing of the troublesome font?
Avatar of DansDadUK
DansDadUK
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't know the answer (I rarely use PowerPoint) - I'd just guess that Titillium WebRegular is perhaps just referring to the Regular variant (as opposed to the Bold, Italic or Bold-italic variants) of the Titillium Web font family?
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

hi Jamie,

Font.NameComplexScript  should be read/write.
https://msdn.microsoft.com/en-us/VBA/powerpoint-vba/articles/font-namecomplexscript-property-powerpoint

Try
PowerPoint Options > Save > UNcheck: Embed fonts in the file

If that doesn't work, try this:
copy the text to NotePad or somewhere else temporarily. Delete the textbox. Maybe even save and close ppt. Then open and create a replacement textbox.

If that still doesn't work ... create a new presentation. Apply the 'theme' from the presentation that is misbehaving. Open it too. Size windows so you can see both presentations. Drag the slides from one presentation to the other. You can drag from the navigation pane or the slide sorter view.

Perhaps the issue is network permissions ... what happens if you copy the file to your local drive and try to change it there?

have an awesome day,
crystal
Avatar of Jamie Garroch (MVP)

ASKER

Thanks Crystal. I'm unable to use the suggested method to disable saving of fonts as it's a requirement in this template. What isn;t a requirement is the use of the erroneous font which I'm trying to replace programmatically. It occurs in multiple objects across multiple presentations hence the need for a programmatic solution. I discovered that I can write to the NameComplexScript property but only certain fonts are accepted e.g "Arial" and oddly, once I have changed that property to Arial, I can;t change it back to what it was before. So there is something happening behind the scenes to validate the attempt to write to the property, without and error raised for an invalid choice.
hi Jamie,

hmmm. how about this:

backup the file
edit the file and DON'T embed fonts
make sure all references to the bad font are gone
save
close
close ppt  too -- just to be on the safe side; this shouldn't be necessary
open file again, edit fonts as desired, and choose to embed fonts
save
close

Is the bad font gone?

have an awesome day,
crystal
The save option to embed fonts in the file or not doesn't affect the properties of the shape in question. I tried the suggestion and the font name properties remain the same as below:

.Name = Titillium Web
.NameAscii = Titillium Web
.NameComplexScript = Titillium WebRegular
.NameFarEast = +mn-ea
.NameOther = Titillium Web

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's not a technical workaround I really want to deal with as it leads to many more complications but without any other solution, I've closed the question.