Fix embedded SVG @font-face import on Windows

Summary

This MR improves SVG import for embedded @font-face fonts on Windows.

It adds support for embedded data: font sources during SVG import and unpacks embedded WOFF / WOFF2 fonts into sfnt data on Windows before registering them through the existing font-loading path.

Problem

Imported SVGs with embedded fonts were not loading correctly on Windows.

Before this change:

  • embedded TTF/OTF support was incomplete in import flow
  • embedded WOFF/WOFF2 fonts failed because the Win32 private font loader does not accept raw .woff / .woff2 files
  • SVGs that rendered correctly in browsers did not render correctly after import in Inkscape

Approach

  • parse embedded font data: URIs from SVG @font-face rules during import
  • decode the embedded font bytes
  • on Windows:
    • detect embedded WOFF / WOFF2
    • use DirectWrite to unpack them into sfnt font data
    • continue through the existing temp-file + AddFontFile() path
  • keep the current path for already-supported font formats

Validation

Tested manually on Windows / MSYS2 UCRT64 with ninja install. This is a test file that would not open correctly in normal inkscape

image.png

Un-modified version:

image.png

file:

tester.svg

Verified:

  • embedded TTF import works
  • embedded WOFF2 import now works on Windows
  • the resulting SVG import behaves correctly for the tested Latin text cases

Merge request reports

Loading