Title: Using fonttype 42 will make the produced PDF size considerably larger when the image has Chinese characters · Issue #11303 · matplotlib/matplotlib · GitHub
Open Graph Title: Using fonttype 42 will make the produced PDF size considerably larger when the image has Chinese characters · Issue #11303 · matplotlib/matplotlib
X Title: Using fonttype 42 will make the produced PDF size considerably larger when the image has Chinese characters · Issue #11303 · matplotlib/matplotlib
Description: Description I want to produce a pdf format image to include in my LaTeX document. The image contains some Chinese characters. I have found that using Chinese characters with fonttype 42 will produce pdf files with greater file size. The ...
Open Graph Description: Description I want to produce a pdf format image to include in my LaTeX document. The image contains some Chinese characters. I have found that using Chinese characters with fonttype 42 will produc...
X Description: Description I want to produce a pdf format image to include in my LaTeX document. The image contains some Chinese characters. I have found that using Chinese characters with fonttype 42 will produc...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11303
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using fonttype 42 will make the produced PDF size considerably larger when the image has Chinese characters","articleBody":"# Description\r\nI want to produce a pdf format image to include in my LaTeX document. The image contains some Chinese characters. I have found that using Chinese characters with fonttype 42 will produce pdf files with greater file size.\r\n\r\nThe code to reproduce is \r\n\r\n```python\r\nimport matplotlib.font_manager as mfm\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib as mpl\r\n\r\nfont_path = \"C:/Windows/fonts/simhei.ttf\"\r\nprop = mfm.FontProperties(fname=font_path)\r\nmpl.rcParams['pdf.fonttype'] = 42\r\n\r\nch = False\r\nfig, ax = plt.subplots()\r\n\r\nif ch:\r\n\tax.text(0.5, 0.5, \"你好\", transform=ax.transAxes, fontproperties=prop,\r\n\t\tfontsize=30)\r\nelse:\r\n\tax.text(0.5, 0.5, \"hello\", transform=ax.transAxes, fontsize=30)\r\n\r\nplt.savefig(\"mpl_use_ch.pdf\", bbox_inches='tight')\r\nplt.show()\r\n```\r\nIf I set `ch=True`, the size of produced pdf is **5327k**. Otherwise, the size of produced pdf is **374k**.\r\n\r\nWhen I comment out the line `mpl.rcParams['pdf.fonttype'] = 42`, then the produced pdf size is more or less the same no matter I use `ch=True` or `ch=False`.\r\n\r\nIs this the expected behaviour? Why does using fonttype 42 make the produce pdf size so large?\r\n\r\n# Versions\r\n\r\n * Operating system: Windows 10\r\n * Matplotlib version: 2.1.2\r\n * Python version: 3.6.4\r\n\r\nThe matplotlib package is installed using conda.\r\n\r\n","author":{"url":"https://github.com/jdhao","@type":"Person","name":"jdhao"},"datePublished":"2018-05-24T10:29:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/11303/matplotlib/issues/11303"}
| 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:883cb89c-fd40-feb7-a438-04455dc666f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95E6:171A20:10339EE:15D268C:6A53360C |
| html-safe-nonce | a4f3875f0c909acda37fe6ed95c9909b4d60574eda1b7be1eb4253b8617d508c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUU2OjE3MUEyMDoxMDMzOUVFOjE1RDI2OEM6NkE1MzM2MEMiLCJ2aXNpdG9yX2lkIjoiNTYzNzEyNDM2NTY2Nzc0MzI0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7565dff6b611b35767eecc5a842a8a4b94bc77cb2ba38933af0ea6447fb99c4a |
| hovercard-subject-tag | issue:326060085 |
| 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/matplotlib/matplotlib/11303/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1396999327efa8f41a63ad48b50b158fc3635c7426a0e4edd96c75309b637003/matplotlib/matplotlib/issues/11303 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1396999327efa8f41a63ad48b50b158fc3635c7426a0e4edd96c75309b637003/matplotlib/matplotlib/issues/11303 |
| og:image:alt | Description I want to produce a pdf format image to include in my LaTeX document. The image contains some Chinese characters. I have found that using Chinese characters with fonttype 42 will produc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jdhao |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width