Skip to content

generateBrand: resvg loads every system font per render (12s+ on Windows, brand test times out) #120

Closed

Description

@FabioHAraujo

Bug

generateBrand (packages/ui/src/lib/brand.ts, also run by the brand Vite plugin at every build and dev start) creates one new Resvg(svg, …) per PNG. @resvg/resvg-js loads every system font by default (font.loadSystemFonts: true) on each construction. On Windows that costs ~450 ms per render, so one icon set (6 PNGs) takes ~2.7 s and the unit test that renders three sets takes 12–17 s.

As a result packages/ui/tests/brand.test.ts › generateBrand › writes the hashed icon set; inputs, not pixels, decide the hash times out (5 s) on Windows, so bun run validate and the pre-push gate fail there:

(fail) generateBrand > writes the hashed icon set; inputs, not pixels, decide the hash [13229.13ms]
  ^ this test timed out after 5000ms.

Measured on Windows 11 (Bun 1.4.2), 6 renders of a 512px path-only SVG:

{}                                    2724 ms
{"font":{"loadSystemFonts":false}}      30 ms

Fix

A brand mark is paths. Only load system fonts when the SVG actually has <text>: font: { loadSystemFonts: /<text\b/.test(svg) }. Builds get faster on every OS, and the test passes on Windows.

Activity

  1. added
    bugSomething isn't working
    in progressSomeone is working on it (see the linked draft PR)
    on Oct 15, 2026
  2. self-assigned this
    on Oct 15, 2026
  3. FabioHAraujo commented on Oct 15, 2026

    @FabioHAraujo
    CollaboratorAuthor

    Working on this in #121 (draft). Branch fix/120-generatebrand-resvg-loads-every-system-font. Regression test first, then the fix.

  4. removed
    in progressSomeone is working on it (see the linked draft PR)
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions