3
votes

[text element].font.size returns None if the element has inherited its size from a parent text style.

The documentation refers to a style hierarchy but doesn't appear to include documentation about it. Does anyone know how you traverse this hierarchy to determine the actual size of a font element if it has inherited its size from somewhere else?

1

1 Answers

0
votes

The hierarchy governing the inheritance of font style is knowledge that belongs to the ill-documented black arts of PowerPoint. I don't know of a place where it's clearly described.

If I needed to learn it, I would start with a Google search on "powerpoint style hierarchy" to gather candidate participants and then settle in for a long period of experimentation.

The candidates I can think of are, roughly in order of precedence:

  • formatting directly applied at the run level
  • default run formatting applied at the paragraph level (this doesn't always take effect)
  • formatting inherited from a placeholder, if the shape was originally a placeholder.
  • A theme related to the slide, its slide layout, or its slide master.
  • A table style
  • Presentation-default formatting.

I would devote a generous period to getting anything I could from Google, form a set of hypotheses, then set up experiments to prove or disprove those hypotheses.

Note the challenge is made more complex by the conditions involved, such as "is in a table" and "is a placeholder", etc.