ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
52.86k stars 3.6k forks source link

fontforge --script ./font-patcher --complete xx.ttf has error ZeroDivisionError: float division by zero #1460

Closed brettKK closed 7 months ago

brettKK commented 7 months ago

➜ FontPatcher fontforge --script ./font-patcher --complete ./src/glyphs/devicons.ttf Copyright (c) 2000-2023. See AUTHORS for Contributors. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html with many parts BSD http://fontforge.org/license.html. Please read LICENSE. Version: 20230101 Based on sources from 2023-01-01 05:27 UTC-D. Nerd Fonts Patcher v3.1.1 (4.8.2) (ff 20230101) Adding 185 Glyphs from Seti-UI + Custom Set ╢████████████████████████████████████████╟ 100% Adding 6 Glyphs from Heavy Angle Brackets Set ╢████████████████████████████████████████╟ 100% Adding 198 Glyphs from Devicons Set ╢████████████████████████████████████████╟ 100% Adding 3 Glyphs from Powerline Symbols Set ╢████████████████████████████████████████╟ 100% Adding 4 Glyphs from Powerline Symbols Set ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ 25%Traceback (most recent call last): File "/Users/kk/Downloads/FontPatcher/./font-patcher", line 2072, in main() File "/Users/kk/Downloads/FontPatcher/./font-patcher", line 2059, in main patcher.patch(sourceFonts[-1]) File "/Users/kk/Downloads/FontPatcher/./font-patcher", line 399, in patch self.copy_glyphs(SrcStart, symfont, patch['SymStart'], patch['SymEnd'], patch['Exact'], patch['ScaleRules'], patch['Name'], patch['Attributes']) File "/Users/kk/Downloads/FontPatcher/./font-patcher", line 1444, in copy_glyphs scale_ratio_x = 1.0 + (self.font_dim['width'] / (sym_dim['width'] scale_ratio_x)) * overlap


ZeroDivisionError: float division by zero
Finii commented 7 months ago

Urgh! Sorry to see your problem. Can you give me a link to the font you want to patch?

Finii commented 7 months ago

sichuan university

Ah, most probably a font without latin glyphs, as font-patcher detects no source font width. And there is no code for pure Chinese font's "cell width".

An example font to work with would be good.

Finii commented 7 months ago

@allcontributors please add @brettKK for bug

allcontributors[bot] commented 7 months ago

@Finii

I've put up a pull request to add @brettKK! :tada:

Finii commented 7 months ago

➜ FontPatcher fontforge --script ./font-patcher --complete ./src/glyphs/devicons.ttf

Ah hmm. You try to patch devicons.ttf? Most likely this is not what you want. Maybe describe what you want to do. The argument should be the font you want to patch with more icons. devicons.ttf is one of the containers that hold the icons that we want to patch into other fonts.

Finii commented 7 months ago

The actual issue (the crash) is fixed via

I close this now. If you have information with a only-Chinese-font please reopen and tell me which font it is and we can work out a solution.

The command in the report above is most likely not what was intended.

Finii commented 7 months ago

If your intention was to create a font with only all the symbols

github-actions[bot] commented 3 weeks ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.