Giter Site home page Giter Site logo

Comments (15)

kjkent avatar kjkent commented on July 28, 2024

After some testing out of docker:

  • The errors above happened on variable fonts, and judging from some script output, ie., opening may fail, the results will most likely not be what you want, it appears compatibility with these fonts isn't fully supported.

  • The errors also occurred on .woff and .woff2 files. From the docker entrypoint script, I believed at least .woff would be supported; but, perhaps it's font-specific!

In any case it seems this isn't the container issue I thought, and instead is just incompatibility with variable and potentially web fonts.

If this is expected, I can close this issue? Sorry for the noise if so.

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

Thanks for reporting!

Indeed, variable fonts can not be opened (and then patched) with fontforge. This is a fontforge limitation and Nerd Fonts font-patcher needs to be rewritten for some more modern backend to support VF.

But that message "opening may fail" should also be visible in the docker runs 🤔

And this font file name does not sound very variableish /in/berkeley-mono/OTF/BerkeleyMono-BoldItalic.otf.

(On the other hand, I never had the idea to put subdirectories under /in, so that is completely untestet 😬 )

And woffs are also untested, but fontfore should be able to handle them just fine.

Maybe you can give me a link to the fonts that fail and I can investigate further.

The error message with the index 0 out of bounds is completely unexpected.
It seems fontforge.fontsInFile() fails to detect any fonts in the file and does not not error out and WE do not check the result.
I'd fix that, a file that causes this would be great for testing.

from nerd-fonts.

kjkent avatar kjkent commented on July 28, 2024

Hey, thanks for the feedback! So I think the 'opening may fail' message perhaps was present in the Docker runs, although as the script now runs with parallel, the more noisy errors such as the index issue quickly drown out those lines! I can check :)

The BoldItalic font you mention didn't cause an error -- I truncated some of the logs where text was repeated. When I removed the WOFF/WOFF2/variable fonts, the rest sailed through without any issue (I ran --mono with fonts in subfolders and then without mono after realising I like the bigger glyphs, coincidentally without subfolders, both completed similarly problem-free).

I'd be happy to provide font files, but I'm concerned about running afoul of the licence as it's not a free font. There is a trial download of the font with some vowel glyphs swapped. Let me see if I can find that and what font files are in there. If all else fails I recently spoke with the author of the fontface and think I'll need to contact him again shortly; I can ask for permission if it that's helpful.

I'll also rerun the patcher and more specifically detail what fonts throw the index error, and what similarities they hold.

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

Thanks for the additional information!

Maybe it will be more helpful if you run the docker in sequential -j 1 mode, which is a bit harder to achieve. I would have liked the usual j option, but ... sigh. Here the example how to activate it by setting PN (which means process-number, presumably?):

docker run --rm -v /path/to/fonts:/in:Z -v /path/for/output:/out:Z -e "PN=1" nerdfonts/patcher [OPTIONS]

I will fix the empty array / index error. But it would be interesting which font triggers it. I expected it can never turn up empty, and it would be good to understand the situation where my assumptions fail. If you can identify the font file that does, maybe it is also the case with the same file as trial version.

Thanks again for helping 👍

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

@allcontributors please add @kjkent for bug

from nerd-fonts.

allcontributors avatar allcontributors commented on July 28, 2024

@Finii

We had trouble processing your request. Please try again later.

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

Hmm, it's even documented ;-)

image

Ah, of course it triggers if the specified "font file" is no font at all 🤦‍♀️

image

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

Ok, thanks again, this will be fixed by the PR (see above).

Now I need to find out what's wrong with the allcontributors bot 😬

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

@allcontributors please add @kjkent for bug

from nerd-fonts.

allcontributors avatar allcontributors commented on July 28, 2024

@Finii

I've put up a pull request to add @kjkent! 🎉

from nerd-fonts.

kjkent avatar kjkent commented on July 28, 2024

Hey @Finii, I've been digging into this a little bit more. It appears to be an upstream issue with fontforge, as in, fontsInFile() is currently incompatible with woff fonts: fontforge/fontforge#1964.

As a workaround, those with the woff2 library installed can run woff2_decompress prior to running the script, then woff2_compress after. The files I tested underwent this process without issue. It's woff2-specific though (sorry woff1)

If you'd find it beneficial, I could make a PR handling this in the script, either checking whether the user has https://github.com/google/woff2 installed and using it from PATH, or, as a fallback, cloning and building it. Admittedly, it's a bit of a hack workaround, so I understand if you'd rather leave it to the user :D

from nerd-fonts.

kjkent avatar kjkent commented on July 28, 2024

Oh! And if it's useful to anyone reading this, I figured a way for users to grab the latest font-patcher and its deps without pulling the kitchen sink with it. It was useful for me for scripting as I was experimenting with the NerdFontsSymbolsOnly TTF. I found sparse-clone and cone mode very fickle to have it behave how I'd expect it, but the following does the job:

repo='https://github.com/ryanoasis/nerd-fonts'
branch='master'

# Accepts directories and single files
git_include=(
        '/font-patcher'
        '/src/glyphs/**'
        '/bin/scripts/name_parser/**'
)

git clone -n --depth=1 --filter=tree:0 "$repo" "${repo##*/}"
cd "$_"
git sparse-checkout set --no-cone ${git_include[@]}
git checkout "$branch"

from nerd-fonts.

Finii avatar Finii commented on July 28, 2024

Thanks for sharing the interesting find above regarding woff2!

I need to digest and let that simmer a bit ;-) But I want to comment on this right away:

Oh! And if it's useful to anyone reading this, I figured a way for users to grab the latest font-patcher and its deps without pulling the kitchen sink with it.

Why not just using the FontPatcher.zip; I believe that is far easier to grasp for usual users that have a very specific sparse checkout. Well, except you want to contribute.

https://github.com/ryanoasis/nerd-fonts/blob/master/FontPatcher.zip is updated automagically (via CI) whenever anything related to selfpatching changes in the default branch.

from nerd-fonts.

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.