diff options
| author | eunhhu <[email protected]> | 2026-09-27 08:44:42 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 08:44:42 +0100 |
| commit | 523b810d6a9c60342c7f5d74f36fe66f3f2057e9 (patch) | |
| tree | c716fb00013264fdbfe7a95dc3f4a43c50b01ecc /tests/symbols | |
| parent | 65a208f7a88e0aeea0d9db4666fd171f59b2a1d2 (diff) | |
| download | vega-523b810d6a9c60342c7f5d74f36fe66f3f2057e9.tar.gz vega-523b810d6a9c60342c7f5d74f36fe66f3f2057e9.zip | |
Draw glyphs and icons from one symbol format, by exact pixel area
Symbol files (VEGASYM1) hold glyphs and icons as quadratic curves, verified
once per symbol and then read in place. vega-symbols builds them from fonts
(through FreeType, losslessly: twice the font's units keeps TrueType's
implied points whole) and from solid SVG paths (arcs included), refusing by
name what an icon asks for that symbols cannot hold.
The reference rasterizer computes each pixel's covered area exactly: every
curve's integral of clamp(1 - x) dy inside the pixel, split where it crosses
the pixel's sides. The Slug-style two-ray average first tried missed FreeType
by 15.4 levels on average at 12 px; exact area is within 1.2-3.5 at 8-16 px,
and where it differs most it matches 64x64 supersampling, not FreeType.
Reaching an outline costs 4.6-29x less than through FreeType, but the files
are 2.1-6.6x larger than glyf or CFF: design 002 has the numbers and the next
question (points shared along contours, lines without control points).
Diffstat (limited to 'tests/symbols')
| -rw-r--r-- | tests/symbols/circle.svg | 3 | ||||
| -rw-r--r-- | tests/symbols/frame.svg | 3 | ||||
| -rw-r--r-- | tests/symbols/rounded.svg | 1 | ||||
| -rw-r--r-- | tests/symbols/turned.svg | 3 |
4 files changed, 10 insertions, 0 deletions
diff --git a/tests/symbols/circle.svg b/tests/symbols/circle.svg new file mode 100644 index 0000000..3a6debd --- /dev/null +++ b/tests/symbols/circle.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"> + <path d="M 8 1 A 7 7 0 1 1 8 15 A 7 7 0 1 1 8 1 Z" fill="#2e3436"/> +</svg> diff --git a/tests/symbols/frame.svg b/tests/symbols/frame.svg new file mode 100644 index 0000000..ce1cfb2 --- /dev/null +++ b/tests/symbols/frame.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path d="M1 1 H15 V15 H1 Z M4 4 V12 H12 V4 Z"/> +</svg> diff --git a/tests/symbols/rounded.svg b/tests/symbols/rounded.svg new file mode 100644 index 0000000..880765d --- /dev/null +++ b/tests/symbols/rounded.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M3 1h10a2 2 0 012 2v10a2 2 0 01-2 2H3a2 2 0 01-2-2V3a2 2 0 012-2z"/></svg> diff --git a/tests/symbols/turned.svg b/tests/symbols/turned.svg new file mode 100644 index 0000000..9221891 --- /dev/null +++ b/tests/symbols/turned.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> + <path d="M1 1 H15 V15 H1 Z" transform="rotate(45 8 8)"/> +</svg> |
