Title: Default template theme forces East-Asian text to fall back to MS Mincho (MS 明朝) · Issue #1601 · python-openxml/python-docx · GitHub
Open Graph Title: Default template theme forces East-Asian text to fall back to MS Mincho (MS 明朝) · Issue #1601 · python-openxml/python-docx
X Title: Default template theme forces East-Asian text to fall back to MS Mincho (MS 明朝) · Issue #1601 · python-openxml/python-docx
Description: Default template's theme forces East-Asian text to fall back to MS Mincho (MS 明朝) Summary Document() (a fresh document created from the bundled default.docx template) configures the theme and document settings so that East-Asian text res...
Open Graph Description: Default template's theme forces East-Asian text to fall back to MS Mincho (MS 明朝) Summary Document() (a fresh document created from the bundled default.docx template) configures the theme and docum...
X Description: Default template's theme forces East-Asian text to fall back to MS Mincho (MS 明朝) Summary Document() (a fresh document created from the bundled default.docx template) configures the theme and d...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/1601
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Default template theme forces East-Asian text to fall back to MS Mincho (MS 明朝)","articleBody":"# Default template's theme forces East-Asian text to fall back to MS Mincho (MS 明朝)\n\n## Summary\n\n`Document()` (a fresh document created from the bundled `default.docx` template) configures the\ntheme and document settings so that East-Asian text resolves to the Japanese font **MS 明朝 (MS Mincho)**,\n**even when the user never asked for a Japanese font and even after setting an explicit East-Asian\nfont with `run.font.name`.** On systems that don't have MS Mincho installed (a standard Chinese/English\nWindows), the CJK glyphs are then substituted / rendered in the wrong typeface.\n\nThis is distinct from the long-standing *API* gaps in #346 / #154 / #1396 (which are about\n`Font.name` not writing the `w:eastAsia` attribute). Those reports are about the *user-side* setter.\nThis issue is about the **default template itself shipping a mis-configured theme** that make the\nfallback land on a Japanese font.\n\n## Environment\n\n- python-docx: 1.2.0 (verified against `master`, byte-identical template)\n- Word / WPS on a Chinese-locale Windows without the MS Mincho / MS Gothic fonts installed\n\n## Reproduction\n\n```python\nfrom docx import Document\n\ndoc = Document() # fresh document from bundled default.docx\np = doc.add_paragraph()\nrun = p.add_run(\"中文字体回退测试 Chinese 123\")\n# Default behavior - we never set any font.\ndoc.save(\"repro.docx\")\n```\n\n### The run python-docx emits\n\n```xml\n\u003cw:r>\u003cw:t>中文字体回退测试 Chinese 123\u003c/w:t>\u003c/w:r>\n```\n\nThere is **no `\u003cw:rPr>`/`\u003cw:rFonts>`** on the run at all. So the CJK glyphs must inherit from the theme.\n\n## Root cause chain (all confirmed from the shipped template)\n\nThe inherited East-Asian font resolves through this chain, and every link is wrong:\n\n1. **`word/settings.xml`** — `themeFontLang` declares the document's East-Asian language as **Japanese**:\n\n ```xml\n \u003cw:themeFontLang w:val=\"en-US\" w:eastAsia=\"ja-JP\"/>\n ```\n\n2. **`word/theme/theme1.xml`** — the `minorFont` (used by Normal text via `docDefaults`) has an **empty**\n East-Asian and complex-script typeface, and its `Jpan` script font is a Japanese face:\n\n ```xml\n \u003ca:minorFont>\n \u003ca:latin typeface=\"Cambria\"/>\n \u003ca:ea typeface=\"\"/>\n \u003ca:cs typeface=\"\"/>\n \u003ca:font script=\"Jpan\" typeface=\"MS 明朝\"/>\n ...\n \u003c/a:minorFont>\n ```\n (`majorFont` has the same empty `ea`/`cs` with `Jpan` = `MS ゴシック`.)\n\n3. **`word/styles.xml`** — `docDefaults` references the theme East-Asian font instead of a concrete font:\n\n ```xml\n \u003cw:rFonts w:asciiTheme=\"minorHAnsi\" w:eastAsiaTheme=\"minorEastAsia\" w:hAnsiTheme=\"minorHAnsi\" w:cstheme=\"minorBidi\"/>\n ```\n\n4. **`word/fontTable.xml`** — the theme declares the Japanese faces `MS 明朝` and `MS ゴシック` as\n real fonts (charset `0x80`), so they are treated as available.\n\n**Resolution:** run has no font → `docDefaults` gives `eastAsiaTheme=\"minorEastAsia\"` → theme `minorFont`\nEast-Asian typeface is empty → because `themeFontLang eastAsia` is `ja-JP`, the document's East-Asian\nlanguage is Japanese → the `Jpan` script font (**MS 明朝**) is selected.\n\nEven setting `run.font.name = '宋体'` does NOT fix the CJK glyphs, because python-docx only writes\n`w:ascii`/`w:hAnsi` (see #346 / #154) and the East-Asian characters still fall through to the theme's\nJapanese font.\n\n## Expected behavior\n\n- A freshly created `Document()` should not, by default, resolve CJK text to a Japanese typeface.\n- The default template should either declare a neutral/Chinese East-Asian language\n (`w:eastAsia=\"zh-CN\"`), or specify a concrete, localizable East-Asian font in the theme's\n `a:ea`/`a:cs` slots, so CJK glyphs don't silently fall back to MS Mincho.\n\n## Possible fix (in the bundled template)\n\n- `settings.xml`: `w:themeFontLang ... w:eastAsia=\"zh-CN\"` (or drop the Japanese default).\n- `theme1.xml`: give `a:ea`/`a:cs` a non-empty, meaningful typeface (e.g. `宋体`/`SimSun`), or point\n `Jpan` at a font that shippers commonly have; or set these to a neutral theme-resolvable value.\n\n## Related, non-duplicate issues\n\n- #154 — feature request for `Font.name_far_east` (API does not expose East-Asian font setter)\n- #346 — `run.font.name` does not apply to Chinese characters (same API limitation)\n- #1396 — confirms `run.font.name` writes only `ascii`/`hAnsi`, never `eastAsia`\n\nThese describe the **missing `eastAsia` API**; none of them reports that the **default template itself**\nships a Japanese-language theme that makes the fallback land on MS Mincho.\n","author":{"url":"https://github.com/sebastEXlabe","@type":"Person","name":"sebastEXlabe"},"datePublished":"2026-08-27T23:48:38Z","url":"https://github.com/python-openxml/python-docx/issues/1601"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d87bd615-1a1f-5cf5-9b70-560aa472b5d0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC82:38E099:21B107:2D4FC6:6AFF638E |
| html-safe-nonce | 469d29d9bb05df200787954a484a5794600c1ef404e855523ff4a9454cad25d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzgyOjM4RTA5OToyMUIxMDc6MkQ0RkM2OjZBRkY2MzhFIiwidmlzaXRvcl9pZCI6IjU2ODg5Njc4MjkyODIzMTcxOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 543098f39402f28ba715a270acc834fb2f8fa7e729ae0b4ab8108a97910c14dd |
| hovercard-subject-tag | issue:5273154263 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openxml/python-docx/1601/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fd70bd02da4b85e1cd8f0a8820675a8735b715b81317609631ee4aa13c0cf3df/python-openxml/python-docx/issues/1601 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fd70bd02da4b85e1cd8f0a8820675a8735b715b81317609631ee4aa13c0cf3df/python-openxml/python-docx/issues/1601 |
| og:image:alt | Default template's theme forces East-Asian text to fall back to MS Mincho (MS 明朝) Summary Document() (a fresh document created from the bundled default.docx template) configures the theme and docum... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sebastEXlabe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b58589a1c4eda1e3c8904144a412b88ca4455f63ca2ad3629f2e9f3c3a1d12 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openxml/python-docx git https://github.com/python-openxml/python-docx.git |
| octolytics-dimension-user_id | 3403760 |
| octolytics-dimension-user_login | python-openxml |
| octolytics-dimension-repository_id | 13592924 |
| octolytics-dimension-repository_nwo | python-openxml/python-docx |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13592924 |
| octolytics-dimension-repository_network_root_nwo | python-openxml/python-docx |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8968d6d6acc65d74e4df332d23932dd3fd0502a4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width