Skip to content

Font not working on macOS or iOS #614

@colecrouter

Description

@colecrouter

I'm using opentype.js to modify the font files in bootstrap-icons (to strip out unused icons). It works on Windows and Android, but not on macOS or iOS. I suspected a WebKit error, but this occurs in Chrome on macOS. I also tried a WebKit browser on Windows to confirm, and it was fine.

Possible Solution

I honestly have no clue where the issue even lies. Given the scope, this might not even be an issue with opentype.js, but there's obviously
something that's causing the outputted woff not to work, while the regular one does.

Steps to Reproduce (for bugs)

I have a function that looks like this:

function strip(path: string) {
  const buffer = await readFile(path);
  
  let data = path.endsWith('.woff2')
      ? (await decompress(buffer)).slice(0) // Need to slice, for some reason the buffer has wrong size
      : new Uint8Array(buffer);

  const font = parse(data.buffer);
  
  let output = new Uint8Array(font.toArrayBuffer());
  if (path.endsWith('.woff2') {
    data = await compress(data);
  }
  
  await writeFile(path, data);
}

It deals with woff or woff2 types, which is what bootstrap-icons exports. Even without modifying the underlying font data (as in the example), this issue occurs.

Your Environment

Here's a zip with both the working unmodified version, and the "modified and broken" one.

I apologize for the lack of useful info; I genuinely don't know how I would go about debugging such a thing. Let me know if there's anything else I can do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions