googlefonts / googlefonts/picosvg

absolute coordinates add 10~20% to size, consider optimizing path strings

Open
#94 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
220
Forks
17
PR merge metrics
No merged PRs in 30d

Description

After I rebuild our test color-fonts using latest nanoemoji and picosvg in https://github.com/googlefonts/color-fonts/pull/11, I noticed that the OT-SVG fonts that embed SVGs converted through picosvg (--color_format=picosvg/picosvgz) are now between 10 to 20 % bigger. I think this is a result of picosvg now always converting coordinates to absolute, for all paths, not just those that need to be simplified for various reasons (e.g. processing with other tools like skia-pathops).

Maybe as an optional optimization picosvg could make path d strings more compact by using relative coordinates, as well as reducing whitespace between path commands to the mimimum, and similar other size optimizations.

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 tracing picosvg's path conversion used by --color_format=picosvg and picosvgz, focusing on how absolute coordinates and path-string whitespace are emitted. Compare equivalent output sizes before and after the optimization, and define done as producing smaller valid SVG paths without changing rendering or conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.