Skip to content

Web font substitution for SVG export - #2547

Merged
JanKallman merged 5 commits into
develop9from
feature/replace-fonts
Sep 29, 2026
Merged

JanKallman merged 5 commits into
develop9from
feature/replace-fonts

Conversation

@swmal

@swmal swmal commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Web font substitution for SVG export

SVG text was measured server-side with one font but rendered by the browser with another. Office cloud fonts such as Aptos Narrow are never visible to browsers, which fell back to wider fonts, so text overflowed and axis labels were miscalculated, especially on Linux.

Changes

  • New FontRenderTarget (Document/Web) and OpenTypeFontEngine.GetFamilyForTarget. Configurable WebFontSubstitutions with defaults for Office cloud fonts.
  • RenderContext.ForTarget and GetMeasurementShaper. SvgRenderOptions.FontTarget defaults to Web, and PDF is unaffected.
  • The substituted font is used for measurement and output alike. Text runs take the font from the measured fragment.
  • Drawing rendering no longer uses ITextMeasurer, only ITextShaper. Axes are measured with the axis font instead of the theme heading font.
  • Fixed (TextShaper) casts that crashed when metrics-only shapers were used.

Tests

Substitution policy, RenderContext, SVG output, and measurement consistency. All independent of installed fonts.

@swmal swmal added this to the EPPlus 9.0 or later milestone Sep 28, 2026
@swmal swmal self-assigned this Sep 28, 2026
@swmal swmal added the enhancement New feature or request label Sep 28, 2026
@swmal swmal changed the title Feature/replace fonts Web font substitution for SVG export Sep 28, 2026
@JanKallman
JanKallman merged commit e4f12f5 into develop9 Sep 29, 2026
3 checks passed
@JanKallman
JanKallman deleted the feature/replace-fonts branch September 29, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Pending Release

Development

Successfully merging this pull request may close these issues.

2 participants