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

fixed the woff2 parsing? #116

Merged
merged 4 commits into from
May 20, 2021
Merged

fixed the woff2 parsing? #116

merged 4 commits into from
May 20, 2021

Conversation

Pomax
Copy link
Owner

@Pomax Pomax commented Apr 23, 2021

closes #115 by updating the woff2 table data parsing code, as well as using Node's native brotli decoding (via the zlib module) rather than trying to import the lib/unbrotli.js file, which isn't a module.\

@RoelN if you create a dir called fonts/broken and put the fonts from #114 in there, the new npm run test:manual should allow you to verify things work in the browser, with the following test.js file that you can run with node test.js to verify things work on the node side, too:

import { Font } from "./lib-font.js";

const font = new Font("woff2 testing");
font.src = `./fonts/broken/BrushPosterGrotesk.woff2`;
font.onerror = (evt) => console.error(evt);
font.onload = (evt) => {
  let font = evt.detail.font;

  const { GSUB } = font.opentype.tables;
  let scripts = GSUB.getSupportedScripts();

  scripts.forEach((script) => {
    let langsys = GSUB.getSupportedLangSys(script);

    langsys.forEach((lang) => {
      let langSysTable = GSUB.getLangSysTable(script, lang);
      let features = GSUB.getFeatures(langSysTable);

      features.forEach((feature) => {
        const lookupIDs = feature.lookupListIndices;

        lookupIDs.forEach((id) => {
          const lookup = GSUB.getLookup(id);

          const cnt = lookup.subTableCount;
          const s = cnt !== 1 ? "s" : "";
          console.log(
            `lookup type ${lookup.lookupType} in ${lang}, lookup ${id}, ${cnt} subtable${s}`
          );
        });
      });
    });
  });
};

@Pomax Pomax requested a review from RoelN April 23, 2021 17:47
Comment on lines -18 to +19
constructor(name, dict, dataview) {
const { p, tableStart } = super(name, dict, dataview);
constructor(dict, dataview, name) {
const { p, tableStart } = super(dict, dataview, name);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how the hell did this work before? O_o

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯

@Pomax
Copy link
Owner Author

Pomax commented Apr 23, 2021

Browser on the left, Node on the right:

lookup type 1 in dflt, lookup 0, 1 subtable		lookup type 1 in dflt, lookup 0, 1 subtable
lookup type 3 in dflt, lookup 1, 1 subtable		lookup type 3 in dflt, lookup 1, 1 subtable
lookup type 1 in dflt, lookup 22, 1 subtable		lookup type 1 in dflt, lookup 22, 1 subtable
lookup type 6 in dflt, lookup 42, 9 subtables		lookup type 6 in dflt, lookup 42, 9 subtables
lookup type 1 in dflt, lookup 23, 1 subtable		lookup type 1 in dflt, lookup 23, 1 subtable
lookup type 6 in dflt, lookup 2, 2 subtables		lookup type 6 in dflt, lookup 2, 2 subtables
lookup type 4 in dflt, lookup 24, 1 subtable		lookup type 4 in dflt, lookup 24, 1 subtable
lookup type 1 in dflt, lookup 12, 1 subtable		lookup type 1 in dflt, lookup 12, 1 subtable
lookup type 1 in dflt, lookup 13, 1 subtable		lookup type 1 in dflt, lookup 13, 1 subtable
lookup type 1 in dflt, lookup 14, 1 subtable		lookup type 1 in dflt, lookup 14, 1 subtable
lookup type 6 in dflt, lookup 15, 2 subtables		lookup type 6 in dflt, lookup 15, 2 subtables
lookup type 1 in dflt, lookup 40, 1 subtable		lookup type 1 in dflt, lookup 40, 1 subtable
lookup type 1 in dflt, lookup 41, 1 subtable		lookup type 1 in dflt, lookup 41, 1 subtable
lookup type 4 in dflt, lookup 25, 1 subtable		lookup type 4 in dflt, lookup 25, 1 subtable
lookup type 1 in dflt, lookup 18, 1 subtable		lookup type 1 in dflt, lookup 18, 1 subtable
lookup type 1 in dflt, lookup 11, 1 subtable		lookup type 1 in dflt, lookup 11, 1 subtable
lookup type 1 in dflt, lookup 21, 1 subtable		lookup type 1 in dflt, lookup 21, 1 subtable
lookup type 6 in dflt, lookup 16, 2 subtables		lookup type 6 in dflt, lookup 16, 2 subtables
lookup type 4 in dflt, lookup 17, 1 subtable		lookup type 4 in dflt, lookup 17, 1 subtable
lookup type 3 in dflt, lookup 38, 1 subtable		lookup type 3 in dflt, lookup 38, 1 subtable
lookup type 1 in dflt, lookup 39, 1 subtable		lookup type 1 in dflt, lookup 39, 1 subtable
lookup type 1 in dflt, lookup 19, 1 subtable		lookup type 1 in dflt, lookup 19, 1 subtable
lookup type 1 in dflt, lookup 27, 1 subtable		lookup type 1 in dflt, lookup 27, 1 subtable
lookup type 1 in dflt, lookup 28, 1 subtable		lookup type 1 in dflt, lookup 28, 1 subtable
lookup type 1 in dflt, lookup 29, 1 subtable		lookup type 1 in dflt, lookup 29, 1 subtable
lookup type 1 in dflt, lookup 30, 1 subtable		lookup type 1 in dflt, lookup 30, 1 subtable
lookup type 1 in dflt, lookup 31, 1 subtable		lookup type 1 in dflt, lookup 31, 1 subtable
lookup type 1 in dflt, lookup 32, 1 subtable		lookup type 1 in dflt, lookup 32, 1 subtable
lookup type 1 in dflt, lookup 33, 1 subtable		lookup type 1 in dflt, lookup 33, 1 subtable
lookup type 1 in dflt, lookup 34, 1 subtable		lookup type 1 in dflt, lookup 34, 1 subtable
lookup type 1 in dflt, lookup 35, 1 subtable		lookup type 1 in dflt, lookup 35, 1 subtable
lookup type 1 in dflt, lookup 36, 1 subtable		lookup type 1 in dflt, lookup 36, 1 subtable
lookup type 1 in dflt, lookup 37, 1 subtable		lookup type 1 in dflt, lookup 37, 1 subtable
lookup type 1 in dflt, lookup 10, 1 subtable		lookup type 1 in dflt, lookup 10, 1 subtable
lookup type 1 in dflt, lookup 20, 1 subtable		lookup type 1 in dflt, lookup 20, 1 subtable
lookup type 1 in dflt, lookup 26, 1 subtable		lookup type 1 in dflt, lookup 26, 1 subtable
lookup type 1 in dflt, lookup 0, 1 subtable		lookup type 1 in dflt, lookup 0, 1 subtable
lookup type 3 in dflt, lookup 1, 1 subtable		lookup type 3 in dflt, lookup 1, 1 subtable
lookup type 1 in dflt, lookup 22, 1 subtable		lookup type 1 in dflt, lookup 22, 1 subtable
lookup type 6 in dflt, lookup 42, 9 subtables		lookup type 6 in dflt, lookup 42, 9 subtables
lookup type 1 in dflt, lookup 23, 1 subtable		lookup type 1 in dflt, lookup 23, 1 subtable
lookup type 6 in dflt, lookup 2, 2 subtables		lookup type 6 in dflt, lookup 2, 2 subtables
lookup type 4 in dflt, lookup 24, 1 subtable		lookup type 4 in dflt, lookup 24, 1 subtable
lookup type 1 in dflt, lookup 12, 1 subtable		lookup type 1 in dflt, lookup 12, 1 subtable
lookup type 1 in dflt, lookup 13, 1 subtable		lookup type 1 in dflt, lookup 13, 1 subtable
lookup type 1 in dflt, lookup 14, 1 subtable		lookup type 1 in dflt, lookup 14, 1 subtable
lookup type 6 in dflt, lookup 15, 2 subtables		lookup type 6 in dflt, lookup 15, 2 subtables
lookup type 1 in dflt, lookup 40, 1 subtable		lookup type 1 in dflt, lookup 40, 1 subtable
lookup type 1 in dflt, lookup 41, 1 subtable		lookup type 1 in dflt, lookup 41, 1 subtable
lookup type 4 in dflt, lookup 25, 1 subtable		lookup type 4 in dflt, lookup 25, 1 subtable
lookup type 1 in dflt, lookup 18, 1 subtable		lookup type 1 in dflt, lookup 18, 1 subtable
lookup type 1 in dflt, lookup 11, 1 subtable		lookup type 1 in dflt, lookup 11, 1 subtable
lookup type 1 in dflt, lookup 21, 1 subtable		lookup type 1 in dflt, lookup 21, 1 subtable
lookup type 6 in dflt, lookup 16, 2 subtables		lookup type 6 in dflt, lookup 16, 2 subtables
lookup type 4 in dflt, lookup 17, 1 subtable		lookup type 4 in dflt, lookup 17, 1 subtable
lookup type 3 in dflt, lookup 38, 1 subtable		lookup type 3 in dflt, lookup 38, 1 subtable
lookup type 1 in dflt, lookup 39, 1 subtable		lookup type 1 in dflt, lookup 39, 1 subtable
lookup type 1 in dflt, lookup 19, 1 subtable		lookup type 1 in dflt, lookup 19, 1 subtable
lookup type 1 in dflt, lookup 27, 1 subtable		lookup type 1 in dflt, lookup 27, 1 subtable
lookup type 1 in dflt, lookup 28, 1 subtable		lookup type 1 in dflt, lookup 28, 1 subtable
lookup type 1 in dflt, lookup 29, 1 subtable		lookup type 1 in dflt, lookup 29, 1 subtable
lookup type 1 in dflt, lookup 30, 1 subtable		lookup type 1 in dflt, lookup 30, 1 subtable
lookup type 1 in dflt, lookup 31, 1 subtable		lookup type 1 in dflt, lookup 31, 1 subtable
lookup type 1 in dflt, lookup 32, 1 subtable		lookup type 1 in dflt, lookup 32, 1 subtable
lookup type 1 in dflt, lookup 33, 1 subtable		lookup type 1 in dflt, lookup 33, 1 subtable
lookup type 1 in dflt, lookup 34, 1 subtable		lookup type 1 in dflt, lookup 34, 1 subtable
lookup type 1 in dflt, lookup 35, 1 subtable		lookup type 1 in dflt, lookup 35, 1 subtable
lookup type 1 in dflt, lookup 36, 1 subtable		lookup type 1 in dflt, lookup 36, 1 subtable
lookup type 1 in dflt, lookup 37, 1 subtable		lookup type 1 in dflt, lookup 37, 1 subtable
lookup type 1 in dflt, lookup 10, 1 subtable		lookup type 1 in dflt, lookup 10, 1 subtable
lookup type 1 in dflt, lookup 20, 1 subtable		lookup type 1 in dflt, lookup 20, 1 subtable
lookup type 1 in dflt, lookup 26, 1 subtable		lookup type 1 in dflt, lookup 26, 1 subtable
lookup type 1 in AZE , lookup 0, 1 subtable		lookup type 1 in AZE , lookup 0, 1 subtable
lookup type 3 in AZE , lookup 1, 1 subtable		lookup type 3 in AZE , lookup 1, 1 subtable
lookup type 1 in AZE , lookup 22, 1 subtable		lookup type 1 in AZE , lookup 22, 1 subtable
lookup type 6 in AZE , lookup 42, 9 subtables		lookup type 6 in AZE , lookup 42, 9 subtables
lookup type 1 in AZE , lookup 23, 1 subtable		lookup type 1 in AZE , lookup 23, 1 subtable
lookup type 6 in AZE , lookup 2, 2 subtables		lookup type 6 in AZE , lookup 2, 2 subtables
lookup type 4 in AZE , lookup 24, 1 subtable		lookup type 4 in AZE , lookup 24, 1 subtable
lookup type 1 in AZE , lookup 12, 1 subtable		lookup type 1 in AZE , lookup 12, 1 subtable
lookup type 1 in AZE , lookup 13, 1 subtable		lookup type 1 in AZE , lookup 13, 1 subtable
lookup type 1 in AZE , lookup 14, 1 subtable		lookup type 1 in AZE , lookup 14, 1 subtable
lookup type 6 in AZE , lookup 15, 2 subtables		lookup type 6 in AZE , lookup 15, 2 subtables
lookup type 1 in AZE , lookup 40, 1 subtable		lookup type 1 in AZE , lookup 40, 1 subtable
lookup type 1 in AZE , lookup 41, 1 subtable		lookup type 1 in AZE , lookup 41, 1 subtable
lookup type 4 in AZE , lookup 25, 1 subtable		lookup type 4 in AZE , lookup 25, 1 subtable
lookup type 1 in AZE , lookup 18, 1 subtable		lookup type 1 in AZE , lookup 18, 1 subtable
lookup type 1 in AZE , lookup 9, 1 subtable		lookup type 1 in AZE , lookup 9, 1 subtable
lookup type 1 in AZE , lookup 11, 1 subtable		lookup type 1 in AZE , lookup 11, 1 subtable
lookup type 1 in AZE , lookup 21, 1 subtable		lookup type 1 in AZE , lookup 21, 1 subtable
lookup type 6 in AZE , lookup 16, 2 subtables		lookup type 6 in AZE , lookup 16, 2 subtables
lookup type 4 in AZE , lookup 17, 1 subtable		lookup type 4 in AZE , lookup 17, 1 subtable
lookup type 3 in AZE , lookup 38, 1 subtable		lookup type 3 in AZE , lookup 38, 1 subtable
lookup type 1 in AZE , lookup 39, 1 subtable		lookup type 1 in AZE , lookup 39, 1 subtable
lookup type 1 in AZE , lookup 19, 1 subtable		lookup type 1 in AZE , lookup 19, 1 subtable
lookup type 1 in AZE , lookup 27, 1 subtable		lookup type 1 in AZE , lookup 27, 1 subtable
lookup type 1 in AZE , lookup 28, 1 subtable		lookup type 1 in AZE , lookup 28, 1 subtable
lookup type 1 in AZE , lookup 29, 1 subtable		lookup type 1 in AZE , lookup 29, 1 subtable
lookup type 1 in AZE , lookup 30, 1 subtable		lookup type 1 in AZE , lookup 30, 1 subtable
lookup type 1 in AZE , lookup 31, 1 subtable		lookup type 1 in AZE , lookup 31, 1 subtable
lookup type 1 in AZE , lookup 32, 1 subtable		lookup type 1 in AZE , lookup 32, 1 subtable
lookup type 1 in AZE , lookup 33, 1 subtable		lookup type 1 in AZE , lookup 33, 1 subtable
lookup type 1 in AZE , lookup 34, 1 subtable		lookup type 1 in AZE , lookup 34, 1 subtable
lookup type 1 in AZE , lookup 35, 1 subtable		lookup type 1 in AZE , lookup 35, 1 subtable
lookup type 1 in AZE , lookup 36, 1 subtable		lookup type 1 in AZE , lookup 36, 1 subtable
lookup type 1 in AZE , lookup 37, 1 subtable		lookup type 1 in AZE , lookup 37, 1 subtable
lookup type 1 in AZE , lookup 10, 1 subtable		lookup type 1 in AZE , lookup 10, 1 subtable
lookup type 1 in AZE , lookup 20, 1 subtable		lookup type 1 in AZE , lookup 20, 1 subtable
lookup type 1 in AZE , lookup 26, 1 subtable		lookup type 1 in AZE , lookup 26, 1 subtable
lookup type 1 in CRT , lookup 0, 1 subtable		lookup type 1 in CRT , lookup 0, 1 subtable
lookup type 3 in CRT , lookup 1, 1 subtable		lookup type 3 in CRT , lookup 1, 1 subtable
lookup type 1 in CRT , lookup 22, 1 subtable		lookup type 1 in CRT , lookup 22, 1 subtable
lookup type 6 in CRT , lookup 42, 9 subtables		lookup type 6 in CRT , lookup 42, 9 subtables
lookup type 1 in CRT , lookup 23, 1 subtable		lookup type 1 in CRT , lookup 23, 1 subtable
lookup type 6 in CRT , lookup 2, 2 subtables		lookup type 6 in CRT , lookup 2, 2 subtables
lookup type 4 in CRT , lookup 24, 1 subtable		lookup type 4 in CRT , lookup 24, 1 subtable
lookup type 1 in CRT , lookup 12, 1 subtable		lookup type 1 in CRT , lookup 12, 1 subtable
lookup type 1 in CRT , lookup 13, 1 subtable		lookup type 1 in CRT , lookup 13, 1 subtable
lookup type 1 in CRT , lookup 14, 1 subtable		lookup type 1 in CRT , lookup 14, 1 subtable
lookup type 6 in CRT , lookup 15, 2 subtables		lookup type 6 in CRT , lookup 15, 2 subtables
lookup type 1 in CRT , lookup 40, 1 subtable		lookup type 1 in CRT , lookup 40, 1 subtable
lookup type 1 in CRT , lookup 41, 1 subtable		lookup type 1 in CRT , lookup 41, 1 subtable
lookup type 4 in CRT , lookup 25, 1 subtable		lookup type 4 in CRT , lookup 25, 1 subtable
lookup type 1 in CRT , lookup 18, 1 subtable		lookup type 1 in CRT , lookup 18, 1 subtable
lookup type 1 in CRT , lookup 8, 1 subtable		lookup type 1 in CRT , lookup 8, 1 subtable
lookup type 1 in CRT , lookup 11, 1 subtable		lookup type 1 in CRT , lookup 11, 1 subtable
lookup type 1 in CRT , lookup 21, 1 subtable		lookup type 1 in CRT , lookup 21, 1 subtable
lookup type 6 in CRT , lookup 16, 2 subtables		lookup type 6 in CRT , lookup 16, 2 subtables
lookup type 4 in CRT , lookup 17, 1 subtable		lookup type 4 in CRT , lookup 17, 1 subtable
lookup type 3 in CRT , lookup 38, 1 subtable		lookup type 3 in CRT , lookup 38, 1 subtable
lookup type 1 in CRT , lookup 39, 1 subtable		lookup type 1 in CRT , lookup 39, 1 subtable
lookup type 1 in CRT , lookup 19, 1 subtable		lookup type 1 in CRT , lookup 19, 1 subtable
lookup type 1 in CRT , lookup 27, 1 subtable		lookup type 1 in CRT , lookup 27, 1 subtable
lookup type 1 in CRT , lookup 28, 1 subtable		lookup type 1 in CRT , lookup 28, 1 subtable
lookup type 1 in CRT , lookup 29, 1 subtable		lookup type 1 in CRT , lookup 29, 1 subtable
lookup type 1 in CRT , lookup 30, 1 subtable		lookup type 1 in CRT , lookup 30, 1 subtable
lookup type 1 in CRT , lookup 31, 1 subtable		lookup type 1 in CRT , lookup 31, 1 subtable
lookup type 1 in CRT , lookup 32, 1 subtable		lookup type 1 in CRT , lookup 32, 1 subtable
lookup type 1 in CRT , lookup 33, 1 subtable		lookup type 1 in CRT , lookup 33, 1 subtable
lookup type 1 in CRT , lookup 34, 1 subtable		lookup type 1 in CRT , lookup 34, 1 subtable
lookup type 1 in CRT , lookup 35, 1 subtable		lookup type 1 in CRT , lookup 35, 1 subtable
lookup type 1 in CRT , lookup 36, 1 subtable		lookup type 1 in CRT , lookup 36, 1 subtable
lookup type 1 in CRT , lookup 37, 1 subtable		lookup type 1 in CRT , lookup 37, 1 subtable
lookup type 1 in CRT , lookup 10, 1 subtable		lookup type 1 in CRT , lookup 10, 1 subtable
lookup type 1 in CRT , lookup 20, 1 subtable		lookup type 1 in CRT , lookup 20, 1 subtable
lookup type 1 in CRT , lookup 26, 1 subtable		lookup type 1 in CRT , lookup 26, 1 subtable
lookup type 1 in KAZ , lookup 0, 1 subtable		lookup type 1 in KAZ , lookup 0, 1 subtable
lookup type 3 in KAZ , lookup 1, 1 subtable		lookup type 3 in KAZ , lookup 1, 1 subtable
lookup type 1 in KAZ , lookup 22, 1 subtable		lookup type 1 in KAZ , lookup 22, 1 subtable
lookup type 6 in KAZ , lookup 42, 9 subtables		lookup type 6 in KAZ , lookup 42, 9 subtables
lookup type 1 in KAZ , lookup 23, 1 subtable		lookup type 1 in KAZ , lookup 23, 1 subtable
lookup type 6 in KAZ , lookup 2, 2 subtables		lookup type 6 in KAZ , lookup 2, 2 subtables
lookup type 4 in KAZ , lookup 24, 1 subtable		lookup type 4 in KAZ , lookup 24, 1 subtable
lookup type 1 in KAZ , lookup 12, 1 subtable		lookup type 1 in KAZ , lookup 12, 1 subtable
lookup type 1 in KAZ , lookup 13, 1 subtable		lookup type 1 in KAZ , lookup 13, 1 subtable
lookup type 1 in KAZ , lookup 14, 1 subtable		lookup type 1 in KAZ , lookup 14, 1 subtable
lookup type 6 in KAZ , lookup 15, 2 subtables		lookup type 6 in KAZ , lookup 15, 2 subtables
lookup type 1 in KAZ , lookup 40, 1 subtable		lookup type 1 in KAZ , lookup 40, 1 subtable
lookup type 1 in KAZ , lookup 41, 1 subtable		lookup type 1 in KAZ , lookup 41, 1 subtable
lookup type 4 in KAZ , lookup 25, 1 subtable		lookup type 4 in KAZ , lookup 25, 1 subtable
lookup type 1 in KAZ , lookup 18, 1 subtable		lookup type 1 in KAZ , lookup 18, 1 subtable
lookup type 1 in KAZ , lookup 5, 1 subtable		lookup type 1 in KAZ , lookup 5, 1 subtable
lookup type 1 in KAZ , lookup 11, 1 subtable		lookup type 1 in KAZ , lookup 11, 1 subtable
lookup type 1 in KAZ , lookup 21, 1 subtable		lookup type 1 in KAZ , lookup 21, 1 subtable
lookup type 6 in KAZ , lookup 16, 2 subtables		lookup type 6 in KAZ , lookup 16, 2 subtables
lookup type 4 in KAZ , lookup 17, 1 subtable		lookup type 4 in KAZ , lookup 17, 1 subtable
lookup type 3 in KAZ , lookup 38, 1 subtable		lookup type 3 in KAZ , lookup 38, 1 subtable
lookup type 1 in KAZ , lookup 39, 1 subtable		lookup type 1 in KAZ , lookup 39, 1 subtable
lookup type 1 in KAZ , lookup 19, 1 subtable		lookup type 1 in KAZ , lookup 19, 1 subtable
lookup type 1 in KAZ , lookup 27, 1 subtable		lookup type 1 in KAZ , lookup 27, 1 subtable
lookup type 1 in KAZ , lookup 28, 1 subtable		lookup type 1 in KAZ , lookup 28, 1 subtable
lookup type 1 in KAZ , lookup 29, 1 subtable		lookup type 1 in KAZ , lookup 29, 1 subtable
lookup type 1 in KAZ , lookup 30, 1 subtable		lookup type 1 in KAZ , lookup 30, 1 subtable
lookup type 1 in KAZ , lookup 31, 1 subtable		lookup type 1 in KAZ , lookup 31, 1 subtable
lookup type 1 in KAZ , lookup 32, 1 subtable		lookup type 1 in KAZ , lookup 32, 1 subtable
lookup type 1 in KAZ , lookup 33, 1 subtable		lookup type 1 in KAZ , lookup 33, 1 subtable
lookup type 1 in KAZ , lookup 34, 1 subtable		lookup type 1 in KAZ , lookup 34, 1 subtable
lookup type 1 in KAZ , lookup 35, 1 subtable		lookup type 1 in KAZ , lookup 35, 1 subtable
lookup type 1 in KAZ , lookup 36, 1 subtable		lookup type 1 in KAZ , lookup 36, 1 subtable
lookup type 1 in KAZ , lookup 37, 1 subtable		lookup type 1 in KAZ , lookup 37, 1 subtable
lookup type 1 in KAZ , lookup 10, 1 subtable		lookup type 1 in KAZ , lookup 10, 1 subtable
lookup type 1 in KAZ , lookup 20, 1 subtable		lookup type 1 in KAZ , lookup 20, 1 subtable
lookup type 1 in KAZ , lookup 26, 1 subtable		lookup type 1 in KAZ , lookup 26, 1 subtable
lookup type 1 in MOL , lookup 0, 1 subtable		lookup type 1 in MOL , lookup 0, 1 subtable
lookup type 3 in MOL , lookup 1, 1 subtable		lookup type 3 in MOL , lookup 1, 1 subtable
lookup type 1 in MOL , lookup 22, 1 subtable		lookup type 1 in MOL , lookup 22, 1 subtable
lookup type 6 in MOL , lookup 42, 9 subtables		lookup type 6 in MOL , lookup 42, 9 subtables
lookup type 1 in MOL , lookup 23, 1 subtable		lookup type 1 in MOL , lookup 23, 1 subtable
lookup type 6 in MOL , lookup 2, 2 subtables		lookup type 6 in MOL , lookup 2, 2 subtables
lookup type 4 in MOL , lookup 24, 1 subtable		lookup type 4 in MOL , lookup 24, 1 subtable
lookup type 1 in MOL , lookup 12, 1 subtable		lookup type 1 in MOL , lookup 12, 1 subtable
lookup type 1 in MOL , lookup 13, 1 subtable		lookup type 1 in MOL , lookup 13, 1 subtable
lookup type 1 in MOL , lookup 14, 1 subtable		lookup type 1 in MOL , lookup 14, 1 subtable
lookup type 6 in MOL , lookup 15, 2 subtables		lookup type 6 in MOL , lookup 15, 2 subtables
lookup type 1 in MOL , lookup 40, 1 subtable		lookup type 1 in MOL , lookup 40, 1 subtable
lookup type 1 in MOL , lookup 41, 1 subtable		lookup type 1 in MOL , lookup 41, 1 subtable
lookup type 4 in MOL , lookup 25, 1 subtable		lookup type 4 in MOL , lookup 25, 1 subtable
lookup type 1 in MOL , lookup 18, 1 subtable		lookup type 1 in MOL , lookup 18, 1 subtable
lookup type 1 in MOL , lookup 4, 1 subtable		lookup type 1 in MOL , lookup 4, 1 subtable
lookup type 1 in MOL , lookup 11, 1 subtable		lookup type 1 in MOL , lookup 11, 1 subtable
lookup type 1 in MOL , lookup 21, 1 subtable		lookup type 1 in MOL , lookup 21, 1 subtable
lookup type 6 in MOL , lookup 16, 2 subtables		lookup type 6 in MOL , lookup 16, 2 subtables
lookup type 4 in MOL , lookup 17, 1 subtable		lookup type 4 in MOL , lookup 17, 1 subtable
lookup type 3 in MOL , lookup 38, 1 subtable		lookup type 3 in MOL , lookup 38, 1 subtable
lookup type 1 in MOL , lookup 39, 1 subtable		lookup type 1 in MOL , lookup 39, 1 subtable
lookup type 1 in MOL , lookup 19, 1 subtable		lookup type 1 in MOL , lookup 19, 1 subtable
lookup type 1 in MOL , lookup 27, 1 subtable		lookup type 1 in MOL , lookup 27, 1 subtable
lookup type 1 in MOL , lookup 28, 1 subtable		lookup type 1 in MOL , lookup 28, 1 subtable
lookup type 1 in MOL , lookup 29, 1 subtable		lookup type 1 in MOL , lookup 29, 1 subtable
lookup type 1 in MOL , lookup 30, 1 subtable		lookup type 1 in MOL , lookup 30, 1 subtable
lookup type 1 in MOL , lookup 31, 1 subtable		lookup type 1 in MOL , lookup 31, 1 subtable
lookup type 1 in MOL , lookup 32, 1 subtable		lookup type 1 in MOL , lookup 32, 1 subtable
lookup type 1 in MOL , lookup 33, 1 subtable		lookup type 1 in MOL , lookup 33, 1 subtable
lookup type 1 in MOL , lookup 34, 1 subtable		lookup type 1 in MOL , lookup 34, 1 subtable
lookup type 1 in MOL , lookup 35, 1 subtable		lookup type 1 in MOL , lookup 35, 1 subtable
lookup type 1 in MOL , lookup 36, 1 subtable		lookup type 1 in MOL , lookup 36, 1 subtable
lookup type 1 in MOL , lookup 37, 1 subtable		lookup type 1 in MOL , lookup 37, 1 subtable
lookup type 1 in MOL , lookup 10, 1 subtable		lookup type 1 in MOL , lookup 10, 1 subtable
lookup type 1 in MOL , lookup 20, 1 subtable		lookup type 1 in MOL , lookup 20, 1 subtable
lookup type 1 in MOL , lookup 26, 1 subtable		lookup type 1 in MOL , lookup 26, 1 subtable
lookup type 1 in ROM , lookup 0, 1 subtable		lookup type 1 in ROM , lookup 0, 1 subtable
lookup type 3 in ROM , lookup 1, 1 subtable		lookup type 3 in ROM , lookup 1, 1 subtable
lookup type 1 in ROM , lookup 22, 1 subtable		lookup type 1 in ROM , lookup 22, 1 subtable
lookup type 6 in ROM , lookup 42, 9 subtables		lookup type 6 in ROM , lookup 42, 9 subtables
lookup type 1 in ROM , lookup 23, 1 subtable		lookup type 1 in ROM , lookup 23, 1 subtable
lookup type 6 in ROM , lookup 2, 2 subtables		lookup type 6 in ROM , lookup 2, 2 subtables
lookup type 4 in ROM , lookup 24, 1 subtable		lookup type 4 in ROM , lookup 24, 1 subtable
lookup type 1 in ROM , lookup 12, 1 subtable		lookup type 1 in ROM , lookup 12, 1 subtable
lookup type 1 in ROM , lookup 13, 1 subtable		lookup type 1 in ROM , lookup 13, 1 subtable
lookup type 1 in ROM , lookup 14, 1 subtable		lookup type 1 in ROM , lookup 14, 1 subtable
lookup type 6 in ROM , lookup 15, 2 subtables		lookup type 6 in ROM , lookup 15, 2 subtables
lookup type 1 in ROM , lookup 40, 1 subtable		lookup type 1 in ROM , lookup 40, 1 subtable
lookup type 1 in ROM , lookup 41, 1 subtable		lookup type 1 in ROM , lookup 41, 1 subtable
lookup type 4 in ROM , lookup 25, 1 subtable		lookup type 4 in ROM , lookup 25, 1 subtable
lookup type 1 in ROM , lookup 18, 1 subtable		lookup type 1 in ROM , lookup 18, 1 subtable
lookup type 1 in ROM , lookup 3, 1 subtable		lookup type 1 in ROM , lookup 3, 1 subtable
lookup type 1 in ROM , lookup 11, 1 subtable		lookup type 1 in ROM , lookup 11, 1 subtable
lookup type 1 in ROM , lookup 21, 1 subtable		lookup type 1 in ROM , lookup 21, 1 subtable
lookup type 6 in ROM , lookup 16, 2 subtables		lookup type 6 in ROM , lookup 16, 2 subtables
lookup type 4 in ROM , lookup 17, 1 subtable		lookup type 4 in ROM , lookup 17, 1 subtable
lookup type 3 in ROM , lookup 38, 1 subtable		lookup type 3 in ROM , lookup 38, 1 subtable
lookup type 1 in ROM , lookup 39, 1 subtable		lookup type 1 in ROM , lookup 39, 1 subtable
lookup type 1 in ROM , lookup 19, 1 subtable		lookup type 1 in ROM , lookup 19, 1 subtable
lookup type 1 in ROM , lookup 27, 1 subtable		lookup type 1 in ROM , lookup 27, 1 subtable
lookup type 1 in ROM , lookup 28, 1 subtable		lookup type 1 in ROM , lookup 28, 1 subtable
lookup type 1 in ROM , lookup 29, 1 subtable		lookup type 1 in ROM , lookup 29, 1 subtable
lookup type 1 in ROM , lookup 30, 1 subtable		lookup type 1 in ROM , lookup 30, 1 subtable
lookup type 1 in ROM , lookup 31, 1 subtable		lookup type 1 in ROM , lookup 31, 1 subtable
lookup type 1 in ROM , lookup 32, 1 subtable		lookup type 1 in ROM , lookup 32, 1 subtable
lookup type 1 in ROM , lookup 33, 1 subtable		lookup type 1 in ROM , lookup 33, 1 subtable
lookup type 1 in ROM , lookup 34, 1 subtable		lookup type 1 in ROM , lookup 34, 1 subtable
lookup type 1 in ROM , lookup 35, 1 subtable		lookup type 1 in ROM , lookup 35, 1 subtable
lookup type 1 in ROM , lookup 36, 1 subtable		lookup type 1 in ROM , lookup 36, 1 subtable
lookup type 1 in ROM , lookup 37, 1 subtable		lookup type 1 in ROM , lookup 37, 1 subtable
lookup type 1 in ROM , lookup 10, 1 subtable		lookup type 1 in ROM , lookup 10, 1 subtable
lookup type 1 in ROM , lookup 20, 1 subtable		lookup type 1 in ROM , lookup 20, 1 subtable
lookup type 1 in ROM , lookup 26, 1 subtable		lookup type 1 in ROM , lookup 26, 1 subtable
lookup type 1 in TAT , lookup 0, 1 subtable		lookup type 1 in TAT , lookup 0, 1 subtable
lookup type 3 in TAT , lookup 1, 1 subtable		lookup type 3 in TAT , lookup 1, 1 subtable
lookup type 1 in TAT , lookup 22, 1 subtable		lookup type 1 in TAT , lookup 22, 1 subtable
lookup type 6 in TAT , lookup 42, 9 subtables		lookup type 6 in TAT , lookup 42, 9 subtables
lookup type 1 in TAT , lookup 23, 1 subtable		lookup type 1 in TAT , lookup 23, 1 subtable
lookup type 6 in TAT , lookup 2, 2 subtables		lookup type 6 in TAT , lookup 2, 2 subtables
lookup type 4 in TAT , lookup 24, 1 subtable		lookup type 4 in TAT , lookup 24, 1 subtable
lookup type 1 in TAT , lookup 12, 1 subtable		lookup type 1 in TAT , lookup 12, 1 subtable
lookup type 1 in TAT , lookup 13, 1 subtable		lookup type 1 in TAT , lookup 13, 1 subtable
lookup type 1 in TAT , lookup 14, 1 subtable		lookup type 1 in TAT , lookup 14, 1 subtable
lookup type 6 in TAT , lookup 15, 2 subtables		lookup type 6 in TAT , lookup 15, 2 subtables
lookup type 1 in TAT , lookup 40, 1 subtable		lookup type 1 in TAT , lookup 40, 1 subtable
lookup type 1 in TAT , lookup 41, 1 subtable		lookup type 1 in TAT , lookup 41, 1 subtable
lookup type 4 in TAT , lookup 25, 1 subtable		lookup type 4 in TAT , lookup 25, 1 subtable
lookup type 1 in TAT , lookup 18, 1 subtable		lookup type 1 in TAT , lookup 18, 1 subtable
lookup type 1 in TAT , lookup 6, 1 subtable		lookup type 1 in TAT , lookup 6, 1 subtable
lookup type 1 in TAT , lookup 11, 1 subtable		lookup type 1 in TAT , lookup 11, 1 subtable
lookup type 1 in TAT , lookup 21, 1 subtable		lookup type 1 in TAT , lookup 21, 1 subtable
lookup type 6 in TAT , lookup 16, 2 subtables		lookup type 6 in TAT , lookup 16, 2 subtables
lookup type 4 in TAT , lookup 17, 1 subtable		lookup type 4 in TAT , lookup 17, 1 subtable
lookup type 3 in TAT , lookup 38, 1 subtable		lookup type 3 in TAT , lookup 38, 1 subtable
lookup type 1 in TAT , lookup 39, 1 subtable		lookup type 1 in TAT , lookup 39, 1 subtable
lookup type 1 in TAT , lookup 19, 1 subtable		lookup type 1 in TAT , lookup 19, 1 subtable
lookup type 1 in TAT , lookup 27, 1 subtable		lookup type 1 in TAT , lookup 27, 1 subtable
lookup type 1 in TAT , lookup 28, 1 subtable		lookup type 1 in TAT , lookup 28, 1 subtable
lookup type 1 in TAT , lookup 29, 1 subtable		lookup type 1 in TAT , lookup 29, 1 subtable
lookup type 1 in TAT , lookup 30, 1 subtable		lookup type 1 in TAT , lookup 30, 1 subtable
lookup type 1 in TAT , lookup 31, 1 subtable		lookup type 1 in TAT , lookup 31, 1 subtable
lookup type 1 in TAT , lookup 32, 1 subtable		lookup type 1 in TAT , lookup 32, 1 subtable
lookup type 1 in TAT , lookup 33, 1 subtable		lookup type 1 in TAT , lookup 33, 1 subtable
lookup type 1 in TAT , lookup 34, 1 subtable		lookup type 1 in TAT , lookup 34, 1 subtable
lookup type 1 in TAT , lookup 35, 1 subtable		lookup type 1 in TAT , lookup 35, 1 subtable
lookup type 1 in TAT , lookup 36, 1 subtable		lookup type 1 in TAT , lookup 36, 1 subtable
lookup type 1 in TAT , lookup 37, 1 subtable		lookup type 1 in TAT , lookup 37, 1 subtable
lookup type 1 in TAT , lookup 10, 1 subtable		lookup type 1 in TAT , lookup 10, 1 subtable
lookup type 1 in TAT , lookup 20, 1 subtable		lookup type 1 in TAT , lookup 20, 1 subtable
lookup type 1 in TAT , lookup 26, 1 subtable		lookup type 1 in TAT , lookup 26, 1 subtable
lookup type 1 in TRK , lookup 0, 1 subtable		lookup type 1 in TRK , lookup 0, 1 subtable
lookup type 3 in TRK , lookup 1, 1 subtable		lookup type 3 in TRK , lookup 1, 1 subtable
lookup type 1 in TRK , lookup 22, 1 subtable		lookup type 1 in TRK , lookup 22, 1 subtable
lookup type 6 in TRK , lookup 42, 9 subtables		lookup type 6 in TRK , lookup 42, 9 subtables
lookup type 1 in TRK , lookup 23, 1 subtable		lookup type 1 in TRK , lookup 23, 1 subtable
lookup type 6 in TRK , lookup 2, 2 subtables		lookup type 6 in TRK , lookup 2, 2 subtables
lookup type 4 in TRK , lookup 24, 1 subtable		lookup type 4 in TRK , lookup 24, 1 subtable
lookup type 1 in TRK , lookup 12, 1 subtable		lookup type 1 in TRK , lookup 12, 1 subtable
lookup type 1 in TRK , lookup 13, 1 subtable		lookup type 1 in TRK , lookup 13, 1 subtable
lookup type 1 in TRK , lookup 14, 1 subtable		lookup type 1 in TRK , lookup 14, 1 subtable
lookup type 6 in TRK , lookup 15, 2 subtables		lookup type 6 in TRK , lookup 15, 2 subtables
lookup type 1 in TRK , lookup 40, 1 subtable		lookup type 1 in TRK , lookup 40, 1 subtable
lookup type 1 in TRK , lookup 41, 1 subtable		lookup type 1 in TRK , lookup 41, 1 subtable
lookup type 4 in TRK , lookup 25, 1 subtable		lookup type 4 in TRK , lookup 25, 1 subtable
lookup type 1 in TRK , lookup 18, 1 subtable		lookup type 1 in TRK , lookup 18, 1 subtable
lookup type 1 in TRK , lookup 7, 1 subtable		lookup type 1 in TRK , lookup 7, 1 subtable
lookup type 1 in TRK , lookup 11, 1 subtable		lookup type 1 in TRK , lookup 11, 1 subtable
lookup type 1 in TRK , lookup 21, 1 subtable		lookup type 1 in TRK , lookup 21, 1 subtable
lookup type 6 in TRK , lookup 16, 2 subtables		lookup type 6 in TRK , lookup 16, 2 subtables
lookup type 4 in TRK , lookup 17, 1 subtable		lookup type 4 in TRK , lookup 17, 1 subtable
lookup type 3 in TRK , lookup 38, 1 subtable		lookup type 3 in TRK , lookup 38, 1 subtable
lookup type 1 in TRK , lookup 39, 1 subtable		lookup type 1 in TRK , lookup 39, 1 subtable
lookup type 1 in TRK , lookup 19, 1 subtable		lookup type 1 in TRK , lookup 19, 1 subtable
lookup type 1 in TRK , lookup 27, 1 subtable		lookup type 1 in TRK , lookup 27, 1 subtable
lookup type 1 in TRK , lookup 28, 1 subtable		lookup type 1 in TRK , lookup 28, 1 subtable
lookup type 1 in TRK , lookup 29, 1 subtable		lookup type 1 in TRK , lookup 29, 1 subtable
lookup type 1 in TRK , lookup 30, 1 subtable		lookup type 1 in TRK , lookup 30, 1 subtable
lookup type 1 in TRK , lookup 31, 1 subtable		lookup type 1 in TRK , lookup 31, 1 subtable
lookup type 1 in TRK , lookup 32, 1 subtable		lookup type 1 in TRK , lookup 32, 1 subtable
lookup type 1 in TRK , lookup 33, 1 subtable		lookup type 1 in TRK , lookup 33, 1 subtable
lookup type 1 in TRK , lookup 34, 1 subtable		lookup type 1 in TRK , lookup 34, 1 subtable
lookup type 1 in TRK , lookup 35, 1 subtable		lookup type 1 in TRK , lookup 35, 1 subtable
lookup type 1 in TRK , lookup 36, 1 subtable		lookup type 1 in TRK , lookup 36, 1 subtable
lookup type 1 in TRK , lookup 37, 1 subtable		lookup type 1 in TRK , lookup 37, 1 subtable
lookup type 1 in TRK , lookup 10, 1 subtable		lookup type 1 in TRK , lookup 10, 1 subtable
lookup type 1 in TRK , lookup 20, 1 subtable		lookup type 1 in TRK , lookup 20, 1 subtable
lookup type 1 in TRK , lookup 26, 1 subtable		 lookup type 1 in TRK , lookup 26, 1 subtable

Comment on lines +7 to +11
if (!brotliDecode) {
import("zlib").then((zlib) => {
nativeBrotliDecode = (buffer) => zlib.brotliDecompressSync(buffer);
});
}
Copy link
Owner Author

@Pomax Pomax Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a dynamic import, but for a native module, so while in theory this might kick in "after everything else": in reality it gets executed immediately.

Comment on lines 126 to 128
const start = entry.offset;
const end = start + (entry.transformLength ? entry.transformLength : entry.origLength);
const data = decoded.slice(start, end);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this does not have any code in place to deal with transformed glyf, loca, or hmtx tables yet. I've filed #118 to address that in the future.

Copy link
Collaborator

@RoelN RoelN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be working fine! (The last font in #114 fails, but that's because there's no GSUB table there).

Thanks for the work, @Pomax.

Comment on lines -18 to +19
constructor(name, dict, dataview) {
const { p, tableStart } = super(name, dict, dataview);
constructor(dict, dataview, name) {
const { p, tableStart } = super(dict, dataview, name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯

package.json Show resolved Hide resolved
@Pomax Pomax merged commit 0481241 into master May 20, 2021
@Pomax Pomax deleted the fix-woff2 branch May 20, 2021 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix woff2 support
2 participants