Skip to content

Expose resolved font faces for downstream modules (og-image, pdfmake, ...) #902

Description

@maximepvrt

Modules like https://github.com/nuxt-modules/og-image (poke @harlan-zw) and https://github.com/BayBreezy/nuxt-pdfmake (poke @BayBreezy) need to reuse the fonts @nuxt/fonts already resolved for a project (to feed a renderer like Satori or pdfmake), instead of re-resolving/re-downloading the same families themselves.

Today there's no public API for this. The only way is to reverse-engineer internal build machinery: hook fonts:public-asset-context to recover the original source URL, then parse the generated nuxt-fonts-global.css template by hand to find the resolved @font-face declarations. Each module ends up re-implementing the same CSS-parsing/font-lookup logic against an undocumented internal contract that can break on any refactor.

Would it be possible to expose a small official utility/hook that returns the resolved font faces (family, weight, style, format, source) directly, so downstream modules don't each need to build this themselves?

Activity

  1. maximepvrt commented on Sep 2, 2026

    @maximepvrt
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions