added the linux font directories #469
Conversation
…s font directories
|
@hoopes can you say a little about what Linux distros this is likely to work for? The documentation should probably mention. |
|
From: I added the |
|
Could we please get this merged into master? |
|
I too would like to see this merged to master! Follow up question: how does python-pptx currently load fonts on Linux systems? Does it just bundle some default fonts, or is it more nuanced than that? |
|
I need this as well for the MInt distro! |
|
Hey guys, |
|
I would also appreciate if this was merged. Needed for Ubuntu. |
|
Did fork according @hoopes solution, thanks! |
|
One simple way to make this work currently is to pass the desired font file instead. A nice improvement for this solution would be to be able to configure/pass possible paths containing font files. Look for the default locations is possible and raise exception if no folder/file is found. |
Code improvement suggestion: # text/fonts.py:53
def _font_directories(cls):
"""
Return a sequence of directory paths likely to contain fonts on the
current platform.
"""
CUSTOM_DIRS_VAR_NAME = 'PYTHON_PPTX_FONT_DIRECTORY'
custom_dir = os.environ.get(CUSTOM_DIRS_VAR_NAME)
if custom_dir is not None:
return [custom_dir]
if sys.platform.startswith("darwin"):
return cls._os_x_font_directories()
if sys.platform.startswith("win32"):
return cls._windows_font_directories()
raise OSError(f"No font directories are configured for your OS. Configure the path manually using {CUSTOM_DIRS_VAR_NAME} environment variable.") |
Single-call go/no-go fit check per slide. Returns True when every shape passes a battery of geometry-only fit measurements: off_canvas, overflow, collision, hidden, invisible. Designed for CI / pre-commit / autobuild gates. Convenience wrapper that runs five built-in measurement rules on a slide and returns either a Boolean (`fit_check`) or a structured `FitCheckReport` (`fit_check_report`) carrying per-issue diagnostics. Wired onto Slide as `Slide.fit_check()` and `Slide.fit_check_report()`. Five rule families ship out of the box; tolerances configurable per call. Pure measurement, no rendering. Closes scanny#469 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Single-call go/no-go fit check per slide. Returns True when every shape passes a battery of geometry-only fit measurements: off_canvas, overflow, collision, hidden, invisible. Designed for CI / pre-commit / autobuild gates. Convenience wrapper that runs five built-in measurement rules on a slide and returns either a Boolean (`fit_check`) or a structured `FitCheckReport` (`fit_check_report`) carrying per-issue diagnostics. Wired onto Slide as `Slide.fit_check()` and `Slide.fit_check_report()`. Five rule families ship out of the box; tolerances configurable per call. Pure measurement, no rendering. Closes scanny#469 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
by copying the pattern of mac/windowss font directories