Add a supported host-font configuration for bundled LibreOffice and Poppler runtimes
What is the type of issue?
Feature request / bug
What is the issue?
The bundled primary runtime on macOS does not provide a supported way to expose the host system font directories to bundled fontconfig-based tools such as LibreOffice and Poppler.
In a macOS Codex Desktop runtime, the bundled LibreOffice can convert a PPTX to PDF, but Simplified Chinese text may disappear when soffice is launched without an explicit FONTCONFIG_FILE environment variable.
The runtime contains its own Fontconfig configuration and fonts, but the bundled Fontconfig library is compiled with an internal install-time path similar to:
/@.__________________________________________________OOO/etc/fonts
The runtime sandbox does not expose a normal /etc/fonts directory, and LibreOffice does not automatically load the configuration shipped under its application resources:
LibreOfficeDev.app/Contents/Resources/fontconfig/fonts.conf
As a result, editing that bundled fonts.conf alone is insufficient for a bare soffice invocation.
Reproduction
Environment:
OS: macOS arm64
Codex Desktop primary runtime bundle: 26.709.11516
LibreOfficeDev: 26.8.0.0.alpha0
The runtime provides a bundled soffice and Poppler. With the host system font directories not explicitly configured:
unset FONTCONFIG_FILE FONTCONFIG_PATH
soffice --headless --convert-to pdf input.pptx --outdir /tmp/output
Fontconfig emits warnings such as:
Fontconfig warning: no <cachedir> elements found
Fontconfig warning: adding <cachedir>/@.__________________________________________________OOO/var/cache/fontconfig
A PPTX containing Simplified Chinese text converts to PDF, but the Chinese glyphs are missing or blank. pdffonts shows only the bundled Latin fonts, for example LinuxLibertineG.
By contrast, explicitly pointing Fontconfig at a configuration that includes the host directories makes the same conversion work:
export FONTCONFIG_FILE=/path/to/runtime/config/fontconfig/fonts.conf
export FONTCONFIG_PATH=/path/to/runtime/config/fontconfig
soffice --headless --convert-to pdf input.pptx --outdir /tmp/output
The working configuration references:
/System/Library/Fonts
/System/Library/Assets
/System/Library/AssetsV2
/Library/Fonts
~/Library/Fonts
The resulting PDF embeds PingFangSC-Regular, and the rendered Chinese text is visible.
Expected behavior
The primary runtime should provide a supported runtime-level font configuration mechanism so all bundled renderers can read host fonts without per-command workarounds.
Possible designs:
- A runtime configuration option for read-only host font directories.
- A documented
FONTCONFIG_FILE/FONTCONFIG_PATHenvironment hook applied to all runtime child processes. - A runtime launcher that mounts or exposes host font directories read-only and points Fontconfig at a runtime-owned configuration.
- A documented setting for selecting a curated system font root without copying fonts into the runtime.
The configuration should cover at least:
- LibreOffice /
soffice - Poppler tools such as
pdftoppmandpdftocairo - Other bundled renderers that use Fontconfig
Why this matters
Users should not need to:
- Copy PingFang or other system fonts into the runtime.
- Modify cached runtime files after every Codex upgrade.
- Create command-specific wrappers.
- Guess or patch the internal
/@.../etc/fontsinstall path. - Accept missing CJK text in generated PDFs.
A read-only host font directory exposure would avoid duplicated font files and would be low risk compared with exposing broader host filesystem paths.
Related issue
This is related to #28889, which discusses Fontconfig cache handling for Poppler in sandboxed workspaces, but this report is specifically about the missing supported host-font configuration and the resulting CJK rendering failure in bundled LibreOffice/Poppler.
Additional information
A local workaround is to set FONTCONFIG_FILE and FONTCONFIG_PATH in the runtime launch environment and use a configuration that points to the macOS system font directories. This works, but the runtime currently has no documented global hook for doing so, and modifying files under ~/.cache/codex-runtimes is vulnerable to runtime replacement during upgrades.
2 Comments
Additional evidence from the bundled Documents/DOCX workflow on macOS (primary runtime and Documents plugin
26.715.12143):I reproduced the same root cause with three generated, non-embedded DOCX probes:
| Requested family | Existing source on the host | Packaged
render_docx.py||---|---|---|
| Noto Sans JP | user font directory | requested family absent from
pdffonts|| MS Mincho | Microsoft Word
DFonts| requested family absent || Aptos Display | Office
FontCache/CloudFonts| requested family absent |The packaged renderer produced PDFs in all three cases, so output-file existence was a false-positive success signal. All three PDFs instead contained only runtime/fallback families such as Linux Libertine G, DejaVu Sans, and Noto Sans.
Using an external
FONTCONFIG_FILEwith absolute, read-only font directory paths made the same three probes resolve exactly by family.pdffontsthen reported NotoSansJP-Regular, MS-Mincho, and AptosDisplay respectively; Japanese text was visible in the rendered PNG and recoverable withpdftotext.This confirms the issue affects the Documents plugin's DOCX→PDF→PNG review path, not only PPTX conversion. Embedded fonts are a separate package path and do not solve ordinary non-embedded documents.
Suggested acceptance coverage for an upstream fix:
HOME.pdffonts; do not treat PDF/PNG existence alone as success.A local cache reconciler can mitigate runtime refreshes, but it is not a good upstream substitute. The public repository also does not currently contain the primary-runtime Documents source, and external PRs are invitation-only, so I am adding the reproducible evidence here rather than opening a speculative PR.
I reproduced this issue on macOS and confirmed that explicitly configuring Fontconfig fixes DOCX/PDF rendering with CJK fonts.
Environment:
26.826.1235326.8.0.0.alpha026.2.5.2The
sofficefound in the Codex runtime is a wrapper around:Without an explicit Fontconfig configuration, a DOCX containing PingFang SC, Songti SC, SimSun, SimHei, KaiTi, Microsoft YaHei, and DengXian rendered every Chinese character as a missing-glyph box.
pdffontsshowed only bundled Latin fonts such asLinuxLibertineG.Minimal fix
The bundled LibreOffice resources already contain a usable Fontconfig configuration. Explicitly exporting these variables before running the Codex renderer fixes system-font discovery:
After this change, PingFang and Songti rendered correctly.
Additional issue with user-installed fonts
The Codex
render_docx.pyhelper creates an isolated LibreOffice profile and temporarily changesHOMEto that profile. Consequently, this entry in the bundledfonts.conf:no longer refers to the real macOS user font directory.
To support fonts installed under the actual user account, I created a persistent Fontconfig file at:
The relevant configuration is:
Replace
USERNAMEwith the actual macOS account name.Persistent rendering wrapper
I installed a wrapper at:
It exports the Fontconfig variables before invoking the current Codex document renderer:
Making Codex use the workaround automatically
The wrapper alone does not guarantee that future Codex tasks will use it. An agent may still invoke
render_docx.pyor baresofficedirectly, or try to automate Microsoft Word.To make the behavior persistent across projects, I also added global instructions to:
The relevant instructions are:
Codex reads
~/.codex/AGENTS.mdas global guidance at the start of future tasks. This turns the environment-variable workaround into the default document-rendering behavior instead of relying on the user to remind each agent.Verification
Using the persistent configuration and wrapper, the generated PDF contained these embedded fonts:
The rendered PNG contained complete Chinese text, with visible differences between the requested font families and no missing-glyph boxes.
This workaround:
AGENTS.mdguidance;The ideal upstream fix would be for the bundled
sofficelauncher orrender_docx.pyto setFONTCONFIG_FILEandFONTCONFIG_PATHautomatically. On macOS, the configuration should include/System/Library/AssetsV2and preserve access to the real user font directory even whenHOMEis replaced with an isolated LibreOffice profile.