FontCustom / fontcustom

Generate custom icon webfonts from the comfort of the command line.
3.28k stars 423 forks source link

Fontcustom not working after Catalina OS upgrade #382

Open paufar opened 4 years ago

paufar commented 4 years ago

I keep getting this issue when I try to run the compile command. I have tried uninstalling and reinstalling everything and am running out of options to try. How can this be solved? What could be causing the issue?

 debug  Using settings from `fontcustom.yml`.
       debug  Using options:
                {:input=>{:vectors=>"images/icons", :templates=>"images/icons"},
                :output=>
                 {:fonts=>"fonts/icon-font",
                  :css=>"fonts/icon-font",
                  :preview=>"fonts/icon-font"},
                :config=>"fontcustom.yml",
                :templates=>["css", "preview"],
                :font_name=>"fontcustom",
                :font_design_size=>16,
                :font_em=>512,
                :font_ascent=>448,
                :font_descent=>64,
                :css_selector=>".icon-{{glyph}}",
                :preprocessor_path=>nil,
                :autowidth=>false,
                :no_hash=>false,
                :css3=>false,
                :debug=>true,
                :force=>false,
                :quiet=>false,
                :copyright=>""}
      delete  fonts/icon-font/fontcustom_5f5fd34181718e63f9793a33c4fc8bc7.ttf
              fonts/icon-font/fontcustom_5f5fd34181718e63f9793a33c4fc8bc7.svg
       debug  Copyright (c) 2000-2019. 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: 20190801
               Based on sources from 12:50 UTC 14-Nov-2019-D.
              Traceback (most recent call last):
                File "/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 120, in <module>
                  subprocess.Popen([scriptPath + '/sfnt2woff', fontfile + '.ttf'], stdout=subprocess.PIPE)
                File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
                  restore_signals, start_new_session)
                File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
                  raise child_exception_type(errno_num, err_msg, err_filename)
              OSError: [Errno 86] Bad CPU type in executable: '/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/sfnt2woff'

              During handling of the above exception, another exception occurred:

              Traceback (most recent call last):
                File "/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 125, in <module>
                  subprocess.call(['sfnt2woff', fontfile + '.ttf'])
                File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 339, in call
                  with Popen(*popenargs, **kwargs) as p:
                File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
                  restore_signals, start_new_session)
                File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
                  raise child_exception_type(errno_num, err_msg, err_filename)
              FileNotFoundError: [Errno 2] No such file or directory: 'sfnt2woff': 'sfnt2woff'
       error  `fontforge` compilation failed.
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
/usr/local/bin/fontcustom:23:in `load'
/usr/local/bin/fontcustom:23:in `<main>'
`
andrefelipe commented 4 years ago

Got it working on a macOS Catalina clean install! The missing part was: brew tap bramstein/webfonttools brew install sfnt2woff

(Note on the debug, somewhat at the end, it says something about a missing "sfnt2woff")

So in a full install instructions should be:

brew tap bramstein/webfonttools
brew install woff2 sfnt2woff eot-utils
brew cask install fontforge
sudo gem install fontcustom

and edit your PATH to include both Ruby and FontForge paths:
/usr/local/lib/ruby/gems/2.6.0/bin
/Applications/FontForge.app/Contents/Resources/opt/local/bin

in my .zshrc I have (may need cleaning):
export PATH=$HOME/bin:/usr/local/lib/ruby/gems/2.6.0/bin:/Applications/FontForge.app/Contents/Resources/opt/local/bin:/usr/local/bin:/usr/local/sbin:/Users/MYUSER/.composer/vendor/bin:/usr/local/opt/ruby/bin:/$PATH
Maciekek commented 4 years ago

@andrefelipe thanks! This solved our issue! FontCustom is working again on Catalina :)

snovey commented 4 years ago

I have a similar problem and adopted @andrefelipe's solution. But I can not find this path: /usr/local/lib/ruby/gems/2.6.0/bin Here is my log:

       debug  Using settings from `global.yml`.
       debug  Using options:
                {:input=>{:vectors=>"svg", :templates=>"../tpl"},
                :output=>{:fonts=>"fonts", :css=>"./", :preview=>"../"},
                :config=>"global.yml",
                :templates=>["css", "fontcustom-preview.html"],
                :font_name=>"global",
                :font_design_size=>16,
                :font_em=>512,
                :font_ascent=>448,
                :font_descent=>64,
                :css_selector=>".icon-nc-{{glyph}}",
                :preprocessor_path=>nil,
                :autowidth=>false,
                :no_hash=>true,
                :css3=>false,
                :debug=>true,
                :force=>false,
                :quiet=>false,
                :copyright=>""}
       debug  Copyright (c) 2000-2020. 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: 20200314
               Based on sources from 2020-05-20 15:35 UTC-D.
              解析颜色  失败
              解析颜色  失败
              抱歉,此文件太复杂,我不能理解。 (它可能有点问题)
              解析颜色  失败
              解析颜色  失败
              解析颜色  失败
              抱歉,此文件太复杂,我不能理解。 (它可能有点问题)
              抱歉,此文件太复杂,我不能理解。 (它可能有点问题)
              抱歉,此文件太复杂,我不能理解。 (它可能有点问题)
       error  `fontforge` compilation failed.
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
/Library/Ruby/Gems/2.6.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
/usr/local/bin/fontcustom:23:in `load'
/usr/local/bin/fontcustom:23:in `<main>'

Here is my gem environment:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin19]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
  - USER INSTALLATION DIRECTORY: /Users/snovey/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /Users/snovey/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-19
  - GEM PATHS:
     - /Library/Ruby/Gems/2.6.0
     - /Users/snovey/.gem/ruby/2.6.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

Could someone help me?