python-pptx2 2.15.0__py3-none-any.whl → 2.16.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pptx2/__init__.py CHANGED
@@ -57,7 +57,7 @@ from pptx2.parts.slide import (
57
57
  if TYPE_CHECKING:
58
58
  from pptx2.opc.package import Part
59
59
 
60
- __version__ = "2.15.0"
60
+ __version__ = "2.16.0"
61
61
 
62
62
  sys.modules["pptx2.exceptions"] = exceptions
63
63
  del sys
pptx2/audit.py CHANGED
@@ -30,7 +30,7 @@ The audit is read-only — it never mutates the deck.
30
30
  from __future__ import annotations
31
31
 
32
32
  from dataclasses import dataclass, field
33
- from typing import TYPE_CHECKING, Any
33
+ from typing import TYPE_CHECKING, Any, Iterable
34
34
 
35
35
  if TYPE_CHECKING:
36
36
  from pptx2.api import Presentation
@@ -174,15 +174,27 @@ def audit(
174
174
  *,
175
175
  size_warn_bytes: int = 2_000_000,
176
176
  check_fonts: bool = True,
177
+ extra_safe_fonts: "Iterable[str] | None" = None,
177
178
  ) -> AuditReport:
178
179
  """Walk the deck and return an :class:`AuditReport` summary.
179
180
 
180
181
  Read-only — never mutates the presentation. Each slide is linted
181
182
  in passing-defaults mode; per-slide overrides should be supplied
182
183
  via the slide-level ``slide.lint(...)`` API directly.
184
+
185
+ *extra_safe_fonts* names additional fonts to treat as safe for the
186
+ font-warning probe, on top of the common Windows/macOS/Office set
187
+ (matching is case-insensitive). Use it where the rendering
188
+ environment genuinely ships the font — e.g. ``DejaVu Sans`` in a
189
+ sandbox whose font policy standardizes on it, or a corporate font
190
+ you embed in every deck.
183
191
  """
184
192
  from pptx2.shapes.picture import Picture
185
193
 
194
+ safe_fonts = _COMMON_FONTS
195
+ if extra_safe_fonts is not None:
196
+ safe_fonts = _COMMON_FONTS | frozenset(f.lower() for f in extra_safe_fonts)
197
+
186
198
  report = AuditReport()
187
199
  slides = list(prs.slides)
188
200
  report.total_slides = len(slides)
@@ -249,7 +261,7 @@ def audit(
249
261
  for para in tf.paragraphs:
250
262
  for run in para.runs:
251
263
  name = run.font.name
252
- if name and name.lower() not in _COMMON_FONTS:
264
+ if name and name.lower() not in safe_fonts:
253
265
  report.font_warnings.append((idx, name))
254
266
 
255
267
  if content_shapes == 0:
@@ -178,6 +178,15 @@ if data["has_errors"]:
178
178
  ... # hand `data` straight to the model to fix
179
179
  ```
180
180
 
181
+ `audit()` also warns on fonts outside the common Windows/macOS/Office
182
+ safe-list. When the rendering environment genuinely ships a font (e.g.
183
+ DejaVu Sans in a Linux sandbox), pass it instead of letting the deck
184
+ drown in noise:
185
+
186
+ ```python
187
+ report = audit(prs, extra_safe_fonts=["DejaVu Sans", "Noto Sans CJK JP"])
188
+ ```
189
+
181
190
  ## Save-time hooks (via `from_spec`)
182
191
 
183
192
  If you build the deck through `pptx2.compose.from_spec`, the spec dict
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-pptx2
3
- Version: 2.15.0
3
+ Version: 2.16.0
4
4
  Summary: Create, read, and update PowerPoint 2007+ (.pptx) files. Fork of power-pptx / python-pptx, published as python-pptx2.
5
5
  Author: Matěj Štágl
6
6
  Author-email: stagl@wattlescript.org
@@ -1,4 +1,4 @@
1
- pptx2/__init__.py,sha256=VSin7-1qNwMQ1TfRoJm9U4JNfojEQFiq-7arKW6JxJk,4076
1
+ pptx2/__init__.py,sha256=oll9FR8kNjyIlQOq779hfSOGTze8MSlZKQCJypny4zk,4076
2
2
  pptx2/_color.py,sha256=Ureg4dSEdHbwpVZ5eJIyt0kLx_W3mGftmznejth_oLQ,2889
3
3
  pptx2/_slide_importer.py,sha256=Ot3lW20eS7fMKsaGaeqPyeS9zVzt5D1WkovwozWwbYY,27033
4
4
  pptx2/_svg.py,sha256=pMURsUQaJ9-dqRl4nEZKt1VECNpA8Ghp4EwNRWcBG-c,5973
@@ -8,7 +8,7 @@ pptx2/accessibility.py,sha256=SDVPX6FK77B3OXBMvr65qowzJFVzcRsnMybjVMQ0oi4,11981
8
8
  pptx2/action.py,sha256=BiDtM80P6oFsNOtLIT1nX82LXEvaGOg4Usaf5CA7kNY,9648
9
9
  pptx2/animation.py,sha256=g0OxAkCoGu0QEx3QB9Yu4BOnGLjD3tcLpKoYBAtUW6s,83756
10
10
  pptx2/api.py,sha256=n98a5qUhVxSwZ_yG_aXxtDCxtnEp37LPsSIsYsbwsfA,1841
11
- pptx2/audit.py,sha256=ndd18663s7AY09Jiyj0fkFTqe-Lan67Bx6sa0cbTA_Q,9743
11
+ pptx2/audit.py,sha256=jXNZgHTY8B1zrDPFigvr2QVFvzXMEJOL-vk5UyeJoIk,10332
12
12
  pptx2/diagrams.py,sha256=5NqGg-CMj6ZYoEsI9pBD1UHmwQhSAK8oAFYD89NPsVg,24654
13
13
  pptx2/exc.py,sha256=k6p-e9h5cKal09-sAv3E1QTXmVDuF8FqewW1CKFQmfw,1276
14
14
  pptx2/formats.py,sha256=w0b8YXBjBbPhDu1UV9-1iUJdL62d9_gcQSp9sHKVr_s,5081
@@ -148,7 +148,7 @@ pptx2/skill/references/design.md,sha256=ne3xVyIwqpkhEkd8XK74QEija040eHve5zBHBx9L
148
148
  pptx2/skill/references/effects.md,sha256=B4Z_rbxm5CjVeLt8rJZ-UydLPq62FgcDP32CZ1KUrvY,7668
149
149
  pptx2/skill/references/end-to-end-deck.md,sha256=6ApwoK1wJ--Oeadyjy4Iq3E0czyPBME6RYAAWQijhNU,8021
150
150
  pptx2/skill/references/geometry-and-arrows.md,sha256=kiy2KIpzcrWbfUH0tWgfdaHRH4k0QPNu0SEkk7JAKNE,10163
151
- pptx2/skill/references/lint.md,sha256=3f2_5yUUigymtxTNvBEUPtytFDv16ll-pm8D5557jx8,9844
151
+ pptx2/skill/references/lint.md,sha256=AbSkRYNrqqurpWs1BDAjzEZd8y4TsyLU3xfc4ifuhe8,10160
152
152
  pptx2/skill/references/math.md,sha256=C8j5FcjpJgBacKwetL6HfdM2d3zRaTAcLrkyYVP-9H8,2572
153
153
  pptx2/skill/references/picture-effects.md,sha256=NCGIqICQOd7DfEif8m_OY5teS75NVQU_micGysgsi1w,3735
154
154
  pptx2/skill/references/render.md,sha256=4mUI5sYbkY5sT_oCA5YEcuQG2ddzvs_gPe4XEiSL3WQ,4671
@@ -170,9 +170,9 @@ pptx2/text/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
170
170
  pptx2/text/fonts.py,sha256=ECa9HuBfeTqOi-uJTz_bu7eurC7e1_64RTwDatxmkpk,16498
171
171
  pptx2/text/layout.py,sha256=k8bqod6GyshHJtfoqFtH9W-eHTI43IB0e6SLT1ibSUU,12815
172
172
  pptx2/text/text.py,sha256=LPqF1B4GSQNSnSlVMm1v7pgtHCymOJPTUG_Kdt5_ou4,55039
173
- python_pptx2-2.15.0.dist-info/licenses/LICENSE,sha256=hLdud18ZPS9iSG3kBCBLiGYzj4A6zedCHiDejIDBXNg,1230
174
- python_pptx2-2.15.0.dist-info/METADATA,sha256=246opa6h7PCzBQdQ3zDrnGye2DP1vmciv9VYZ5qUsHo,14374
175
- python_pptx2-2.15.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
176
- python_pptx2-2.15.0.dist-info/entry_points.txt,sha256=UpD1_pA-2BPeN0iDeD-u4NZ_yC78TvBdWu3V1xLsSRE,105
177
- python_pptx2-2.15.0.dist-info/top_level.txt,sha256=NDdhJ4rOySlDU-cw4g-bQMoZCiy41WszlRXmIiReSRs,6
178
- python_pptx2-2.15.0.dist-info/RECORD,,
173
+ python_pptx2-2.16.0.dist-info/licenses/LICENSE,sha256=hLdud18ZPS9iSG3kBCBLiGYzj4A6zedCHiDejIDBXNg,1230
174
+ python_pptx2-2.16.0.dist-info/METADATA,sha256=mu4Raf9xAgpmy7-ZoBz_Vw0-jWSV7b2yTHJzb2Vn4xQ,14374
175
+ python_pptx2-2.16.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
176
+ python_pptx2-2.16.0.dist-info/entry_points.txt,sha256=UpD1_pA-2BPeN0iDeD-u4NZ_yC78TvBdWu3V1xLsSRE,105
177
+ python_pptx2-2.16.0.dist-info/top_level.txt,sha256=NDdhJ4rOySlDU-cw4g-bQMoZCiy41WszlRXmIiReSRs,6
178
+ python_pptx2-2.16.0.dist-info/RECORD,,