Title: Bonsai: embed bundled fonts in exported drawing SVGs by petruconduraru · Pull Request #8637 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Bonsai: embed bundled fonts in exported drawing SVGs by petruconduraru · Pull Request #8637 · IfcOpenShell/IfcOpenShell
X Title: Bonsai: embed bundled fonts in exported drawing SVGs by petruconduraru · Pull Request #8637 · IfcOpenShell/IfcOpenShell
Description: Problem Exported drawing SVGs only render with the intended typeface (e.g. OpenGost Type B TT) if that font happens to also be installed at the OS level of whoever opens the file, silently falling back to a generic font otherwise. Root cause Drawing stylesheets reference the bundled font by family name only. The SVG writer inlined the stylesheet text into the SVG's style tag but never embedded the actual font data. Fix Embed each bundled font (and any user-installed custom fonts in the same data directory) as a base64 encoded @font-face rule, so drawing SVGs are self contained and render consistently regardless of the viewer's installed fonts. Testing Verified: generated SVG before the fix has no @font-face rule (5611 bytes). After the fix, the SVG includes a valid @font-face rule with a base64-encoded payload that decodes to a valid TTF (confirmed via the sfnt magic header), and grows to reflect the embedded font data. Note: this embeds every font found in Bonsai's fonts data directory (bundled plus any user-added custom fonts), not just ones referenced by a given drawing's stylesheet. For the default case this is a single ~70KB font, but a user with several custom fonts installed would see a larger per-drawing overhead. Flagging as a known tradeoff, not a correctness issue. Fixes #5433. Generated with the assistance of an AI coding tool.
Open Graph Description: Problem Exported drawing SVGs only render with the intended typeface (e.g. OpenGost Type B TT) if that font happens to also be installed at the OS level of whoever opens the file, silently falling ...
X Description: Problem Exported drawing SVGs only render with the intended typeface (e.g. OpenGost Type B TT) if that font happens to also be installed at the OS level of whoever opens the file, silently falling ...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8637
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:61901eeb-a7ee-5d02-ec78-186ee179e382 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8CD6:2ACC63:10E5AB8:1612A5C:6B04F4C9 |
| html-safe-nonce | c0f0cad40eaddaffdf2221f5cd22729739a7566408c7e71e9daf0573c40823c8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0Q2OjJBQ0M2MzoxMEU1QUI4OjE2MTJBNUM6NkIwNEY0QzkiLCJ2aXNpdG9yX2lkIjoiNDk2NDU4NjgwNTU3NzE4NDQ1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b96a77423fc757ef1138d24c8e2b1d46092130447174341e7a8380556e2c8389 |
| hovercard-subject-tag | pull_request:4069037404 |
| 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/IfcOpenShell/IfcOpenShell/pull/8637/files |
| twitter:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| og:image:alt | Problem Exported drawing SVGs only render with the intended typeface (e.g. OpenGost Type B TT) if that font happens to also be installed at the OS level of whoever opens the file, silently falling ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2c3971d6ab4be607cf9a26ac26ef0a7bfce380ec2ba14642e64028ad07a492b9 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3f1d45dee14b3f87c64e9017a9c08d011561786 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width