Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Working on Ubuntu 17.04 #24

Open
jcubic opened this issue Dec 2, 2017 · 6 comments
Open

Working on Ubuntu 17.04 #24

jcubic opened this issue Dec 2, 2017 · 6 comments
Assignees
Labels
open-question A question FROM the project maintainers to the issue participants

Comments

@jcubic
Copy link

jcubic commented Dec 2, 2017

on Xubuntu I've installed fonttools:

pip install fonttools

but it keep serving me error:

$ glyphhanger ./index.html --subset=./css/fonts/bebasneue-webfont.ttf
`pyftsubset` from fonttools is required for the --subset feature.

Looking at the source code I've notice that it run which("pyftsubset") and that binary is not provided when Installing form pip you need to run sudo apt install fonttools

and running glyphhanger there is requirement for zopfli

$ glyphhanger ./index.html --subset=./css/fonts/bebasneue-webfont.ttf
Subsetting ./css/fonts/bebasneue-webfont.ttf to bebasneue-webfont-subset.ttf (was 37.93 KB, now 22.09 KB)
Traceback (most recent call last):
  File "/usr/bin/pyftsubset", line 6, in <module>
    subset.main(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/subset.py", line 2633, in main
    'output-file'])
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/subset.py", line 2279, in parse_opts
    raise self.UnknownOptionError("Unknown option '%s'" % a)
fontTools.subset.UnknownOptionError: Unknown option 'with-zopfli'
Error: pyftsubset command failed (pyftsubset ./css/fonts/bebasneue-webfont.ttf --output-file=css/fonts/bebasneue-webfont-subset.zopfli.woff --unicodes=U+A,U+20-22,U+26-29,U+2B-3F,U+41-5B,U+5D,U+5F,U+61-7D,U+A9,U+F3,U+105,U+107,U+119,U+142,U+144,U+15B,U+17A,U+17C,U+201C-201E --flavor=woff --with-zopfli).

Commenting out that option shows another error that brotli is required not optional:

$ glyphhanger ./index.html --subset=./css/fonts/bebasneue-webfont.ttf
Subsetting ./css/fonts/bebasneue-webfont.ttf to bebasneue-webfont-subset.ttf (was 37.93 KB, now 22.09 KB)
Subsetting ./css/fonts/bebasneue-webfont.ttf to bebasneue-webfont-subset.zopfli.woff (was 37.93 KB, now 9.4 KB)
The WOFF2 encoder requires the Brotli Python extension, available at:
https://github.com/google/brotli
Traceback (most recent call last):
  File "/usr/bin/pyftsubset", line 6, in <module>
    subset.main(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/subset.py", line 2713, in main
    save_font (font, outfile, options)
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/subset.py", line 2586, in save_font
    font.save(outfile, reorderTables=options.canonical_order)
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/ttLib/__init__.py", line 217, in save
    writer = sfnt.SFNTWriter(tmp, numTables, self.sfntVersion, self.flavor, self.flavorData)
  File "/usr/lib/python2.7/dist-packages/FontTools/fontTools/ttLib/woff2.py", line 137, in __init__
    raise ImportError("No module named brotli")
ImportError: No module named brotli
Error: pyftsubset command failed (pyftsubset ./css/fonts/bebasneue-webfont.ttf --output-file=css/fonts/bebasneue-webfont-subset.woff2 --unicodes=U+A,U+20-22,U+26-29,U+2B-3F,U+41-5B,U+5D,U+5F,U+61-7D,U+A9,U+F3,U+105,U+107,U+119,U+142,U+144,U+15B,U+17A,U+17C,U+201C-201E --flavor=woff2).

After installing brotli and commentout out cmd.push( "--with-zopfli" ) the program finally run.

@zachleat
Copy link
Member

Interesting! Is there a better method to check for pyftsubset that would work with pip?

Glyphhanger defaults to using the following: --formats=ttf,woff2,woff-zopfli. You can change this to your liking? Specifically, you can use woff instead of woff-zopfli. Should we change this default?

@zachleat zachleat added the open-question A question FROM the project maintainers to the issue participants label Dec 20, 2017
@zachleat zachleat self-assigned this Dec 20, 2017
@patrickkettner
Copy link
Contributor

fwiw, I installed fonttools via pip and it came up with the path without a problem. Is it possible that /usr/local/bin was not in your $PATH, @jcubic ?

@jcubic
Copy link
Author

jcubic commented May 3, 2018

@patrickkettner sorry I don't have Ubuntu anymore, I've switch to Fedora so I can't test but I definitely will install font tools from pip when I'll need to use this project on Fedora.

@bardware
Copy link

Installing fonttools resulted in success message in my case, but using glyphhanger resulted in the well known message pyftsubset from fonttools is required for the --subset feature.
I changed into root context using sudo su - and called python3 -m pip install fonttools. This set up everything as needed. On ubuntu 16.04 LTS

@zachleat
Copy link
Member

zachleat commented Dec 3, 2018

@bardware thanks for the clarification! Do you think there’s anything we can do here to clarify or improve our current check for fonttools?

@polarbirke
Copy link

Can confirm that @bardware's approach works fine with Ubuntu 18.04 LTS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
open-question A question FROM the project maintainers to the issue participants
Projects
None yet
Development

No branches or pull requests

5 participants