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

in `initialize': wrong number of arguments (given 2, expected 1) #390

Open
jose1711 opened this issue Apr 22, 2022 · 7 comments
Open

in `initialize': wrong number of arguments (given 2, expected 1) #390

jose1711 opened this issue Apr 22, 2022 · 7 comments

Comments

@jose1711
Copy link

Getting the following on fontcustom compile:

        warn  No input directory given. Using present working directory.
      create  .fontcustom-manifest.json
/usr/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from /usr/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in `new'
	from /usr/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/manifest.rb:39:in `reload'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/manifest.rb:11:in `initialize'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:12:in `new'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:12:in `initialize'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `new'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
	from /home/jose/.gem/ruby/3.0.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	from /home/jose/.gem/ruby/3.0.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	from /home/jose/.gem/ruby/3.0.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	from /home/jose/.gem/ruby/3.0.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
	from /usr/bin/fontcustom:25:in `load'
	from /usr/bin/fontcustom:25:in `<main>'
@joe-batt
Copy link

joe-batt commented Jul 5, 2022

This seems to be related to JSON::Ext::Parser. I haven't really found out why. As a workaround I am using JSON::Pure::Parser. My solution is a bit hacky but it works and nothing else on my system uses json-1.8.6, so I don't care:
In json/common.rb add require 'json/pure/parser' to the imports at the beginning. Then change in the function parser (after adding the require it starts on line 26) and replace the line

const_set :Parser, parser

with

const_set :Parser, JSON::Pure::Parser

@brandondrew
Copy link

brandondrew commented Aug 16, 2022

@jose1711 @joe-batt Have you tried opening /usr/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb and adding the splat operator (**) at line 155?

Background: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

@lcuis
Copy link

lcuis commented Oct 17, 2022

Hello @brandondrew ,

I have the same issue as @jose1711 on Ubuntu.

Here is what I have at the location you mentioned (which is also the place pointed at by my error message):

Parser.new(source, opts).parse

I tried this:

Parser.new(source, **opts).parse

Got that:

fontcustom compile my_svg_files_folder
      create  fontcustom
       error  `fontforge` compilation failed. Try again with --debug for more details.

As suggested by the error message, I tried with the --debug flag:

fontcustom compile --debug my_svg_files_folder
       debug  Generated files will be saved to `fontcustom/`.
       debug  Using options:
                {:input=>
                 {:vectors=>"my_svg_files_folder", :templates=>"my_svg_files_folder"},
                :output=>{:fonts=>"fontcustom", :css=>"fontcustom", :preview=>"fontcustom"},
                :config=>false,
                :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=>""}
       debug  Copyright (c) 2000-2022. 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: 20201107
               Based on sources from 2022-01-13 19:13 UTC-ML-D-GDK3.
              PythonUI_Init()
              copyUIMethodsToBaseTable()
              Traceback (most recent call last):
                File "/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 88, in <module>
                  name = createGlyph(glyph, data['source'], data['codepoint'])
                File "/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 80, in createGlyph
                  glyph.left_side_bearing = glyph.left_side_bearing - shift
              TypeError: 'float' object cannot be interpreted as an integer
       error  `fontforge` compilation failed.
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
/var/lib/gems/3.0.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/var/lib/gems/3.0.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/var/lib/gems/3.0.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/var/lib/gems/3.0.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
/var/lib/gems/3.0.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
/usr/local/bin/fontcustom:25:in `load'
/usr/local/bin/fontcustom:25:in `<main>'

So, it seems your suggestion solved my first issue. (I'll now be digging into my next issue which is surprising as I have fontforge installed but this is a separate question.)

Thanks!

@dapaopaopao
Copy link

@lcuis have u solve the fontforge problem? i have the same problem, thx

@lcuis
Copy link

lcuis commented Jan 11, 2023

Hi @dapaopaopao . Sorry, I don't remember this topic at the moment. It seems it was on a different computer than the one I use today as the files are not present. If I stumble on this problem again, I will try to bring a better answer. I probably found another way to get what I needed. For sure, I use FontForge to edit fonts with success. I remember automating SVG imports from Inkscape to FontForge in a very weird but working way using xdotool . I wish you to easily find a solution to your issue.

@Oscarz90
Copy link

how did you solve this?

@lcuis
Copy link

lcuis commented May 24, 2023

how did you solve this?

Hi @Oscarz90 ,

Sorry, I don't remember better than the comment I wrote then. I hope you'll find a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants