matplotlib / matplotlib/matplotlib

[ENH]: Add woff font embedding support to svg backend

Open
#25,791 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend: svg keep New feature topic: text/fonts
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Problem

See #10063:

> A possibility to still allow embedding the font file into the svg file would be to use the apparently more popular WOFF(2) format, see https://developer.mozilla.org/en-US/docs/Web/Guide/WOFF https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face for the format, http://www.sameratiani.com/2011/10/16/embed-inline-webfonts-in-css.html for embedding the font into the svg file itself, and https://caniuse.com/#search=woff for support. A quick test suggests that this is supported but chrome/firefox, but not by inkscape, but at least inkscape emits a warning and replaces the embedded font by another one, whereas it appears to freeze with the current implementation of svg fonts.

### Proposed solution

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the discussion in #10063 and the linked WOFF, @font-face, and browser-support references, then locate Matplotlib's SVG backend implementation. Compare the current SVG font embedding behavior with the proposed WOFF approach; done means the backend can embed WOFF fonts in SVG output without the current SVG-font failure mode.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.