bdusell / webfont-generator

Locally convert fonts to web formats and generate CSS rules
MIT License
190 stars 34 forks source link

svg errors for NotoColorEmoji.ttf #14

Closed ghost closed 6 years ago

ghost commented 6 years ago

NotoColorEmoji.ttf is known to cause problems due to its non-standard ..something... I still get woff, woff2, ttf and eot, so I guess it breaks on svg, just FYI..

Here is the log I got from running ~/webfont-generator-master $ ./bin/generate-webfonts -o assets NotoColorEmoji.ttf

Traceback (most recent call last):
  File "./bin/../src/python/generate_webfonts.py", line 164, in <module>
    main()
  File "./bin/../src/python/generate_webfonts.py", line 150, in main
    output_files = convert_files(input_files, output_dir, output_formats, logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/dependencies.py", line 151, in convert_files
    vertex.process(logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/dependencies.py", line 45, in process
    self.value(input_files, output_files, logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/operations.py", line 71, in convert_with_fontforge
    _convert_with_fontforge(input_path, output_paths)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/operations.py", line 87, in _convert_with_fontforge
    raise Error('FontForge conversion failed:\n\n' + indent(err, '  '))
  File "/home/me/webfont-generator-master/src/python/webfont_generator/util.py", line 2, in indent
    return '\n'.join(tab + line for line in s.split('\n'))
TypeError: a bytes-like object is required, not 'str'

and here is the verbose log

me@me-vm ~/webfont-generator-master $ ./bin/generate-webfonts --verbose -o assets NotoColorEmoji.ttf
using sfntly to convert NotoColorEmoji.ttf to assets/NotoColorEmoji.eot, assets/NotoColorEmoji.woff
copying NotoColorEmoji.ttf to assets/NotoColorEmoji.ttf
using woff2_compress to convert assets/NotoColorEmoji.ttf to woff2
using FontForge to convert NotoColorEmoji.ttf to assets/NotoColorEmoji.svg
Traceback (most recent call last):
  File "./bin/../src/python/generate_webfonts.py", line 164, in <module>
    main()
  File "./bin/../src/python/generate_webfonts.py", line 150, in main
    output_files = convert_files(input_files, output_dir, output_formats, logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/dependencies.py", line 151, in convert_files
    vertex.process(logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/dependencies.py", line 45, in process
    self.value(input_files, output_files, logger)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/operations.py", line 71, in convert_with_fontforge
    _convert_with_fontforge(input_path, output_paths)
  File "/home/me/webfont-generator-master/src/python/webfont_generator/operations.py", line 87, in _convert_with_fontforge
    raise Error('FontForge conversion failed:\n\n' + indent(err, '  '))
  File "/home/me/webfont-generator-master/src/python/webfont_generator/util.py", line 2, in indent
    return '\n'.join(tab + line for line in s.split('\n'))
TypeError: a bytes-like object is required, not 'str'
bdusell commented 6 years ago

Hah, you caught a bug in the way the error is handled too (missing a .decode()).

For me, the svg conversion works fine, but woff2_compress fails. We must have different versions of FontForge and sfntly.

bdusell commented 6 years ago

Quick breakdown:

Here's what happens when I try to run fontforge on this font manually:

$ fontforge -lang=ff -script -
Copyright (c) 2000-2014 by George Williams. 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.
 Based on sources from 20170106-ML-D.
 Based on source from git with hash: 
> Open("test-fonts/NotoColorEmoji.ttf")
The following table(s) in the font have been ignored by FontForge
  Ignoring 'CBDT'
  Ignoring 'CBLC'
No (useable) bitmap strikes in this TTF font: /home/bdusell/Programming/github/webfont-generator/test-fonts/NotoColorEmoji.ttf
Couldn't find a font file named /home/bdusell/Programming/github/webfont-generator/test-fonts/NotoColorEmoji.ttf
NotoColorEmoji.ttf is not in a known format (or uses features of that format fontforge does not support, or is so badly corrupted as to be unreadable)
Open: Failed to open: test-fonts/NotoColorEmoji.ttf
> Generate("test-out/NotoColorEmoji.svg")
Generate: This command requires an active font
> Ctrl-D
$ echo $?
0

It fails silently. Version:

$ fontforge -version
Copyright (c) 2000-2014 by George Williams. 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.
 Based on sources from 20170106-ML-D.
 Based on source from git with hash: 
no xdefs_filename!
TESTING: getPixmapDir:/usr/share/fontforge/pixmaps
TESTING: getShareDir:/usr/share/fontforge
TESTING: GResourceProgramDir:/usr/bin
trying default theme:/usr/share/fontforge/pixmaps/resources
fontforge 20170106
libfontforge 20170106
bdusell commented 6 years ago

Submitted a bug report at https://github.com/google/woff2/issues/100.

bdusell commented 6 years ago

Turns out woff2_compress is fine, it just takes a long time.