Title: [BUG]: Text extents are not recomputed after web font loading · Issue #8089 · plotly/plotly.js · GitHub
Open Graph Title: [BUG]: Text extents are not recomputed after web font loading · Issue #8089 · plotly/plotly.js
X Title: [BUG]: Text extents are not recomputed after web font loading · Issue #8089 · plotly/plotly.js
Description: Description When using custom web fonts loaded via @font-face or external stylesheets, Plotly computes text extents before the configured font is available and therefore uses fallback font metrics. Once the web font has loaded, the SVG t...
Open Graph Description: Description When using custom web fonts loaded via @font-face or external stylesheets, Plotly computes text extents before the configured font is available and therefore uses fallback font metrics....
X Description: Description When using custom web fonts loaded via @font-face or external stylesheets, Plotly computes text extents before the configured font is available and therefore uses fallback font metrics....
Opengraph URL: https://github.com/plotly/plotly.js/issues/8089
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: Text extents are not recomputed after web font loading","articleBody":"### Description\n\nWhen using custom web fonts loaded via @font-face or external stylesheets, Plotly computes text extents before the configured font is available and therefore uses fallback font metrics.\n\nOnce the web font has loaded, the SVG text elements correctly update to the configured font-family, but the previously computed text extents are not recomputed.\n\nAs a result, text may become clipped or incorrectly positioned when the web font has significantly different metrics from the fallback font, which is particularly noticeable with monospace fonts.\n\nThe issue only occurs on the first page load. A subsequent refresh uses the already-loaded web font, and the text extents are calculated correctly.\n\nExpected behavior: Text extents should either be computed after the configured font has loaded or recomputed once the font becomes available.\n\n### Screenshots/Video\n\nOutput of example below:\n\n\u003cimg width=\"1905\" height=\"917\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/8e538651-e363-4007-b2e0-000543000b43\" />\n\n### Steps to reproduce\n\nMinimal example using a slightly modified version of the [bar chart example](https://plotly.com/python/bar-charts/#bar-charts-with-long-format-data)\n\n`Plotly version: v6.9.0`\n\n```py\nimport plotly.express as px\n\nlong_df = px.data.medals_long()\n\nfig = px.bar(long_df, x=\"nation\", y=\"count\", color=\"medal\", title=\"Long-Form Input\")\n\nfig.update_layout(\n font=dict(\n family=\"JetBrains Mono\",\n ),\n legend=dict(\n borderwidth=1\n )\n)\nfig.add_annotation(\n x=1.05,\n y=0.0,\n xref=\"paper\",\n yref=\"paper\",\n xanchor=\"left\",\n yanchor=\"bottom\",\n text=\"Source: Coyote | \\u00a9 ACME\",\n textangle=-90,\n showarrow=False,\n bgcolor=\"rgba(0,0,0,0.2)\",\n)\n\nfig.write_html(\"plotly_bar_jetbrains_mono.html\", include_plotlyjs=\"cdn\")\n\n# Inject the following stylesheet into the head section of the html\n# \u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@fontsource/jetbrains-mono@5.0.20/index.css\">\n```\n\n### Notes\n\nTested with:\n`Firefox 152.0.5`\n`Edge 150.0.4078.65`\n`Chrome 150.0.7871.115`","author":{"url":"https://github.com/now-daniel-beiter","@type":"Person","name":"now-daniel-beiter"},"datePublished":"2026-07-11T21:23:20Z","url":"https://github.com/plotly/plotly.js/issues/8089"}
| 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:e9c193a5-a832-3aa9-9a87-80a458cc17d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBE4:22DB35:2F49F46:3C5B029:6B01B4EE |
| html-safe-nonce | c6495dad624a33def8db5a3ba3df7887fdca2f153b47ac41a7d1de7a9082c03c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkU0OjIyREIzNToyRjQ5RjQ2OjNDNUIwMjk6NkIwMUI0RUUiLCJ2aXNpdG9yX2lkIjoiMjE1MDY2NDA5NDU1Mjc5ODQ0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ed108bafb5662f9c548e52e0fe665c3c5b34061ae53c34534228a8bb3d72a9ac |
| hovercard-subject-tag | issue:5622797782 |
| 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/plotly/plotly.js/8089/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4283da4d7d01c241a536dbea13a5920e7389fa089c37c613964fa1fda1e2d8d/plotly/plotly.js/issues/8089 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4283da4d7d01c241a536dbea13a5920e7389fa089c37c613964fa1fda1e2d8d/plotly/plotly.js/issues/8089 |
| og:image:alt | Description When using custom web fonts loaded via @font-face or external stylesheets, Plotly computes text extents before the configured font is available and therefore uses fallback font metrics.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | now-daniel-beiter |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width