Open nasmal opened 4 years ago
I think this is broken since the release of FA6. Here is a simple workaround to download the older v4 files locally into your working directory and then the example commands will work:
# download v4 ttf
curl -o fontawesome-webfont.ttf https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/fonts/fontawesome-webfont.ttf
# download v4 css
curl -o font-awesome.css https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/css/font-awesome.css
# test examples
icon-font-to-png --css font-awesome.css --ttf fontawesome-webfont.ttf --size 64 play stop
# should work and output
file ./exported/play.png ./exported/stop.png
./exported/play.png: PNG image data, 64 x 64, 8-bit/color RGBA, non-interlaced
./exported/stop.png: PNG image data, 64 x 64, 8-bit/color RGBA, non-interlaced
Newer URLs:
# download v4 ttf
curl -Lo fontawesome-webfont.ttf https://github.com/FortAwesome/Font-Awesome/raw/4.x/fonts/fontawesome-webfont.ttf
# download v4 css
curl -o font-awesome.css https://raw.githubusercontent.com/FortAwesome/Font-Awesome/4.x/css/font-awesome.css
Downloading them can also be done with npm
:
# use a local node_modules directory
npm init -y
# @fortawesome/fontawesome-free is the newest version, but
# this installs the 4.X version
npm install font-awesome
# use it
icon-font-to-png --css node_modules/font-awesome/css/font-awesome.css --ttf node_modules/font-awesome/fonts/fontawesome-webfont.ttf --list
Running the first example I get the error
urllib.error.HTTPError: HTTP Error 404: Not Found
.On OSX 10.15.2 and Python 3.5.6:
(env) nathan@Nathans-MBP fontawesometopng % icon-font-to-png --download font-awesome
Traceback (most recent call last):
File "/Users/nathan/Playground/fontawesometopng/env/bin/icon-font-to-png", line 16, in
command_line.run(sys.argv[1:])
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/command_line.py", line 85, in run
downloader = download_icon_font(args.download, os.getcwd())
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/command_line.py", line 172, in download_icon_font
downloader.download_files()
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 75, in download_files
self.css_path = self.download_css(self.directory)
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 67, in download_css
return self._download_file_from_url(self.css_url, directory)
File "/Users/nathan/Playground/fontawesometopng/env/lib/python3.5/site-packages/icon_font_to_png/icon_font_downloader.py", line 49, in _download_file_from_url
return urlretrieve(url, filename=css_filename)[0]
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 472, in open
response = meth(req, response)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 582, in http_response
'http', request, response, code, msg, hdrs)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 510, in error
return self._call_chain(args)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(args)
File "/Users/nathan/.pyenv/versions/3.5.6/lib/python3.5/urllib/request.py", line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found