Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving variable font results in static font #788

Open
Materuilist opened this issue Jan 28, 2025 · 2 comments
Open

Saving variable font results in static font #788

Materuilist opened this issue Jan 28, 2025 · 2 comments
Labels
enhancement writing support Anything related to writing support as opposed to parsing or rendering

Comments

@Materuilist
Copy link

Hello! Enjoying your package in multiple projects, but there is 1 blocking issue for me here.
It can be demonstrated with this simple code block in browser environment (similar flow doesnt work in Node.js as well):

async function downloadFont() {
    if (variableFontFile) {
      const url = URL.createObjectURL(variableFontFile)

      const font = await opentype.load(url)

      font.download()

      URL.revokeObjectURL(url)
    }
  }

If url points to any variable font (Open Sans .ttf in this case), then the downloaded result will only contain one variation. So variable font file narrows down to just static font file.
Is there a way to fix that, or it is just not supported yet?

Fonts issue.zip

@herrstrietzel
Copy link

const font = await opentype.load(url) would return a opentype.js font object but not a recompiled font file you could use for downloads.

Besides, opentype.js font creation/compiling capabilities are limited.
Afaik, there is only support for CFF(1) so truetypes using glyph command structure (using quadratic béziers) would be converted. Also I'm not sure if variable font compiling is yet supported by version 2.

In other words: you shouldn't expect a simple "pass-through" export – the same applies to pretty much any parsing library because we always have a quite complex parsing process (which may not cover 100% of the input font data) and a complex compiling process as well.

I have the suspicion, you're trying to deploy opentype.js for some subsetting application (removing glyphs or design axes) – if so you may rather use other tools like python based fonttools.

@Connum
Copy link
Contributor

Connum commented Feb 13, 2025

CFF2/variable font writing is still in progress: #701

Unfortunately, not only do I currently lack the time, but also the motivation, being the only one actively working on the project. 😕

@Connum Connum added enhancement writing support Anything related to writing support as opposed to parsing or rendering labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement writing support Anything related to writing support as opposed to parsing or rendering
Projects
None yet
Development

No branches or pull requests

3 participants