Title: gh-143990: Preserve the size when creating a Font from a named font by serhiy-storchaka · Pull Request #153267 · python/cpython · GitHub
Open Graph Title: gh-143990: Preserve the size when creating a Font from a named font by serhiy-storchaka · Pull Request #153267 · python/cpython
X Title: gh-143990: Preserve the size when creating a Font from a named font by serhiy-storchaka · Pull Request #153267 · python/cpython
Description: When a tkinter.font.Font is created from another font, Font.__init__ expanded it into concrete options with Tcl's font actual. For a named font this resolves the configured size, so a size specified in pixels (a negative size) was silently converted to a size in points (gh-143990). font configure returns the configured options and preserves such a size, but it only accepts a font name, not a font description. So the font is now expanded with font configure when it is a named font, falling back to font actual when it is a font description: try: font = tk.splitlist(tk.call("font", "configure", font)) except tkinter.TclError: font = tk.splitlist(tk.call("font", "actual", font)) Trying font configure first delegates the "is this a named font?" decision to Tcl, which is robust even for font names containing spaces. A font description (a tuple or a string) is still resolved via font actual, since there is no way to parse it into options otherwise; wrapping it with exists=True (gh-143990, #152025) remains the way to use it without loss of precision. Font.copy() has always been equivalent to constructing a Font from the original font (both went through font actual), so it is updated to match and now preserves the size too. This is the general form of #143992, which restored the size only for a size given in a tuple. Issue: gh-143990
Open Graph Description: When a tkinter.font.Font is created from another font, Font.__init__ expanded it into concrete options with Tcl's font actual. For a named font this resolves the configured size, so a size spe...
X Description: When a tkinter.font.Font is created from another font, Font.__init__ expanded it into concrete options with Tcl's font actual. For a named font this resolves the configured size, so a size...
Opengraph URL: https://github.com/python/cpython/pull/153267
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:db1f11b8-f58d-8919-1900-f8f7cf1dcc0e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B454:23903E:1C48C71:26B1BC0:6A540108 |
| html-safe-nonce | e9a5b7abc87bf1d7cabeb7d6a61db1b201464999d338cd1f945c6e82df0cc7d2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDU0OjIzOTAzRToxQzQ4QzcxOjI2QjFCQzA6NkE1NDAxMDgiLCJ2aXNpdG9yX2lkIjoiNTIxMTgzNjk3MDMwNTg0NzU2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a1ab6892cf4c37db5e2a825610749a6a6a36bba51df0dcb3231aaf9846fd58c |
| hovercard-subject-tag | pull_request:4007782787 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/153267/files |
| twitter:image | https://avatars.githubusercontent.com/u/3659035?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3659035?s=400&v=4 |
| og:image:alt | When a tkinter.font.Font is created from another font, Font.__init__ expanded it into concrete options with Tcl's font actual. For a named font this resolves the configured size, so a size spe... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| 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