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

Fontmake can not compile some ufo files in noto-sources #260

Closed
zjusbo opened this issue Feb 18, 2017 · 10 comments
Closed

Fontmake can not compile some ufo files in noto-sources #260

zjusbo opened this issue Feb 18, 2017 · 10 comments

Comments

@zjusbo
Copy link
Contributor

zjusbo commented Feb 18, 2017

Affected files are :
noto-source/src/NotoSansCham/NotoSansCham-Regular.ufo
noto-source/src/NotoSansCham/NotoSansCham-Bold.ufo
noto-source/src/NotoSansLao/NotoSansLao-Regular.ufo
noto-source/src/NotoSansLao/NotoSansLao-Bold.ufo

and probably more.

The error is
(dev) bosong-macbookpro:NotoSansLao bosong$ fontmake -u NotoSansLao-Bold.ufo/
INFO:fontmake.font_project:Building OTFs
INFO:fontmake.font_project:Decomposing glyphs for NotoSansLao-Bold
INFO:fontmake.font_project:Removing overlaps for NotoSansLao-Bold
Traceback (most recent call last):
File "/Users/bosong/i18n/fonttools/dev/bin/fontmake", line 11, in
load_entry_point('fontmake', 'console_scripts', 'fontmake')()
File "/Users/bosong/i18n/fontmake/Lib/fontmake/main.py", line 183, in main
ufo_paths, is_instance=args.pop('masters_as_instances'), **args)
File "/Users/bosong/i18n/fontmake/Lib/fontmake/font_project.py", line 435, in run_from_ufos
ufos, remove_overlaps, mti_paths=mti_paths, **kwargs)
File "/Users/bosong/i18n/fontmake/Lib/fontmake/font_project.py", line 146, in build_otfs
self.remove_overlaps(ufos)
File "/Users/bosong/i18n/fonttools/Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
return func(*args, **kwds)
File "/Users/bosong/i18n/fontmake/Lib/fontmake/font_project.py", line 87, in remove_overlaps
union(contours, glyph.getPointPen())
File "/Users/bosong/i18n/fonttools/dev/lib/python2.7/site-packages/booleanOperations/booleanOperationManager.py", line 104, in union
return _performOperation("union", contours, [], outPen)
File "/Users/bosong/i18n/fonttools/dev/lib/python2.7/site-packages/booleanOperations/booleanOperationManager.py", line 64, in _performOperation
subjectInputContours = [InputContour(contour) for contour in subjectContours if contour and len(contour) > 1]
File "/Users/bosong/i18n/fonttools/dev/lib/python2.7/site-packages/booleanOperations/flatten.py", line 72, in init
self.segments = _convertPointsToSegments(points)
File "/Users/bosong/i18n/fonttools/dev/lib/python2.7/site-packages/booleanOperations/flatten.py", line 440, in _convertPointsToSegments
willBeReversed=willBeReversed
File "/Users/bosong/i18n/fonttools/dev/lib/python2.7/site-packages/booleanOperations/flatten.py", line 174, in init
for pt1, pt2 in decomposeQuadraticSegment(pointCoordinates[1:]):
File "/Users/bosong/i18n/fonttools/Lib/fontTools/pens/basePen.py", line 329, in decomposeQuadraticSegment
assert n > 0
AssertionError

However, the fontmake can compile the intermediate ufo files generated by its self in master_ufo folder.

@anthrotype
Copy link
Member

booleanOperations currently does not support removing overlaps from outlines containing (TrueType) quadratic curves.
There's a "quadratics" branch, but it's not merged into master yet:
https://github.com/typemytype/booleanOperations/tree/quadratics

@zjusbo
Copy link
Contributor Author

zjusbo commented Feb 18, 2017 via email

@davelab6
Copy link
Member

davelab6 commented Feb 18, 2017 via email

@brawer
Copy link
Contributor

brawer commented Feb 19, 2017

@davelab6, not even when building CFF fonts from quadratic sources, which (I think) is what happened here? Of course it’s a weird case, but why shouldn’t fontmake support it?

@davelab6
Copy link
Member

davelab6 commented Feb 19, 2017 via email

@anthrotype
Copy link
Member

anthrotype commented Feb 19, 2017

I'm curious where cff was indicated

The OP typed fontmake -u NotoSansLao-Bold.ufo, and fontmake by default tries to compile both OTF and TTF, in that order, unless one explicitly passes -o [formats] option.

However, the AssertionError in the traceback above was not caused by fontmake trying to create a CFF-OTF from a UFO containing TrueType outlines (this is not supported yet, depends on googlefonts/cu2qu#29 being landed first).
The problem is that booleanOperations can't remove overlaps from contours with TrueType outlines ("qcurve"), and fontmake by default attempts to remove the overlaps, unless told otherwise with --keep-overlaps option.

I haven't checked the source files, but if they contain quadratic contours, it's likely that these were generated by decompiling binary TTF rather than drawn that way, and hence they may already have overlaps removed. Passing options --keep-overlaps -o ttf should complete successfully.

@davelab6
Copy link
Member

davelab6 commented Feb 20, 2017 via email

@zjusbo
Copy link
Contributor Author

zjusbo commented Feb 21, 2017 via email

@marekjez86
Copy link
Contributor

@zjusbo : we are replacing Lao with the new sources

@zjusbo
Copy link
Contributor Author

zjusbo commented Mar 17, 2017

I'm closing this issue since:

  1. Bug in Cham is fixed by Fix bugs in Cham notofonts/noto-source#67
    2.Lao is replaced with new sources
  2. Passing options --keep-overlaps -o ttf should complete successfully.

@zjusbo zjusbo closed this as completed Mar 17, 2017
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

5 participants