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

Generated font files seem corrupt #2

Open
jovilog opened this issue Jun 11, 2024 · 8 comments
Open

Generated font files seem corrupt #2

jovilog opened this issue Jun 11, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@jovilog
Copy link

jovilog commented Jun 11, 2024

Describe the bug

Generated font files from pack.phosphoricons.com do not work, console throws error.

Steps to Reproduce

  1. Use Phosphor Backpack to generate smaller font files.
  2. Implement files into project with CSS provided.
  3. Console has errors: Firefox: downloadable font: rejected by sanitizer; Chrome: failed to decode downloaded font
  4. Icons don't show, unicode placeholder is shown.

Expected behavior

Font file should load without error. Icons should be seen.

Context

  • OS: Windows 10
  • Browser: latest Chrome, Firefox
  • Phosphor Backpack based on phosphor-icons/web v2.1.1

Additional notes

Trying to use generated .ttf file with a different WOFF-Converter (Font Squirrel) results in The font 'Phosphor.ttf' is corrupt and cannot be converted., too.

Using the (full) font files from phosphor-icons/web works without issues.

Maybe this is a problem with line feeds/formatting while generating the files.

@jovilog jovilog added the bug Something isn't working label Jun 11, 2024
@lewisking
Copy link

Get exactly the same issue.

@rektdeckard
Copy link
Member

Interesting. My test page uses the single-file CSS which uses the base64-encoded version of the font inline, and I have not seen this issue there. The font file should be the same underlying bytes. Will do some investigating!

I had experienced some errors in the past due to manipulating the Unicode codepoints incorrectly, but that doesn't seem to be the issue if the inlined font works.

@hachi
Copy link

hachi commented Sep 6, 2024

I get an error saying the file length doesn't match the header when I try to use the .woff file

@rektdeckard
Copy link
Member

rektdeckard commented Sep 6, 2024

Does the issue occur when generating a .ttf font? I'll take another look at it this weekend.

@hachi
Copy link

hachi commented Oct 14, 2024

Did you ever test this? I haven't had a chance myself to test your question about .ttf but .woff is definitely broken still

@hachi
Copy link

hachi commented Oct 14, 2024

It seems like your code might be outputting base64 text into the files that should be binary? I think your testing method is flawed if this is working for you.

@hachi
Copy link

hachi commented Oct 14, 2024

These two choices give the same output:

CSS and external font(s)
Font(s) only

Download of individual font files gives base64 encoded file contents
Download of zip includes font files that are base64 encoded file contents

@hachi
Copy link

hachi commented Nov 16, 2024

@rektdeckard any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants