Git Product home page Git Product logo

Comments (10)

anthrotype avatar anthrotype commented on May 7, 2024 2

the WOFF2Params struct has an allow_transforms option that is True by default. The caller can set it to False to prevent glyf and loca to be transformed:

allow_transforms(true) {}

however, the woff2_compress command-line utility doesn't expose an option to disable that.

from woff2.

anthrotype avatar anthrotype commented on May 7, 2024

I believe this is a limitation of the current WOFF2 format, in that the "tripled encoding" of point coordinates in TrueType glyf table only retains whether each point is an on- or off-curve point (the most significant bit of the flagStream's bytes); the rest of the bits are used for the variable length encoding of point coordinates.
https://www.w3.org/TR/WOFF2/#triplet_decoding
Basically there is no room to store those OVERLAP_SIMPLE flags in WOFF2.
In fontTools' encoder, I think I am going to add an option so that the user can turn those bits on when generating the WOFF2 font.

from woff2.

anthrotype avatar anthrotype commented on May 7, 2024

In fontTools' encoder, I think I am going to add an option so that the user can turn those bits on when generating the WOFF2 font.

sorry, I contradicted myself. As I said, the flags can't be stored in current WOFF2. An option could be added to the decoder to set the flags when extracting the compresed WOFF2 font, but not to the encoder itself. The spec needs to be changed if we want to allow storing these OVERLAP flags in the transformed woff2 glyf table.

Another option is to leave the glyt table untransformed. I have to check again the spec to confirm whether this is allowed.

from woff2.

anthrotype avatar anthrotype commented on May 7, 2024

Yes -- according to the WOFF2 spec one can pass-through the glyf and loca tables without any transformation applied by setting their version to "3" (in the bit 6-7 of TableDirectoryEntry.flags):

For 'glyf' and 'loca' tables, transformation version 3 indicates the null transform where the original table data was passed directly to the Brotli compressor without applying any pre-processing

from woff2.

Lorp avatar Lorp commented on May 7, 2024

Thanks for this. Do you mean that the flag means: treat glyf data just like an arbitrary unstructured binary table? This wil be more than editing a flag in one of the woff2_compress sources, right?

from woff2.

anthrotype avatar anthrotype commented on May 7, 2024

yes -- it means the glyf and loca (always go together) tables are stored intact, without transformations applied. The whole font data stream is then compressed with brotli.
You can't just flip a flag.

from woff2.

christopherhb92 avatar christopherhb92 commented on May 7, 2024

Hi @anthrotype I ended up running into the same issue and set allow_transforms to false in source but that didn't seem to fix the issue. Is there more that needs to be done on top of doing that?

from woff2.

anthrotype avatar anthrotype commented on May 7, 2024

i'm not sure actually. Maybe @rsheeter knows?

from woff2.

zvuc avatar zvuc commented on May 7, 2024

I bumped onto this issue just today, when trying to use the Inter font hosted by Google Fonts.
Seeing that the original font has no issues (rsms/inter#302), I think this is somethin that needs to be addressd from Google's end... Any updates on this?

from woff2.

zvuc avatar zvuc commented on May 7, 2024

Relevant filed issue in Google Fonts repo issues: google/fonts#2602

from woff2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.