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

CheckOutlinesUFO pens work #230

Merged
merged 7 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions afdko/Tools/SharedData/FDKScripts/CheckOutlinesUFO.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import booleanOperations.booleanGlyph
import defcon
import ufoLib
from robofab.pens.digestPen import DigestPointPen
from fontPens.digestPointPen import DigestPointPen

import ufoTools
# noinspection PyPep8Naming
from ufoTools import kProcessedGlyphsLayer as PROCD_GLYPHS_LAYER
# noinspection PyPep8Naming
from ufoTools import kProcessedGlyphsLayerName as PROCD_GLYPHS_LAYER_NAME

__version__ = '2.0.0'
__version__ = '2.0.1'


class FocusOptionParseError(KeyError):
Expand Down Expand Up @@ -860,7 +860,7 @@ def round_point(pt):
return pt


def do_overlap_removal(bool_glyph, old_digest, changed, msg, options):
def do_overlap_removal(bool_glyph, changed, msg, options):
changed, msg = remove_coincident_points(bool_glyph, changed, msg)
options.remove_coincident_points_done = True
changed, msg = remove_flat_curves(bool_glyph, changed, msg, options)
Expand Down Expand Up @@ -900,19 +900,13 @@ def do_overlap_removal(bool_glyph, old_digest, changed, msg, options):
# These are not added by overlap removal.
# Tiny subpaths are added by overlap removal.
msg = remove_tiny_sub_paths(new_glyph, options.min_area, msg)
return new_glyph, new_digest, changed, msg
return new_glyph, changed, msg


def do_cleanup(new_glyph, old_digest, changed, msg, options):
new_digest = old_digest
def do_cleanup(new_glyph, changed, msg, options):

if new_glyph is None:
return new_glyph, new_digest, changed, msg

if old_digest is None:
old_digest = list(get_digest(new_glyph))
old_digest.sort()
old_digest = map(round_point, old_digest)
return new_glyph, changed, msg

# Note that these remove_coincident_points_done and remove_flat_curves_done
# get called only if do_overlap_removal is NOT called.
Expand All @@ -925,7 +919,7 @@ def do_cleanup(new_glyph, old_digest, changed, msg, options):
# as the latter can introduce new co-linear points.
changed, msg = remove_colinear_lines(new_glyph, changed, msg, options)

return new_glyph, new_digest, changed, msg
return new_glyph, changed, msg


def set_max_p(contour):
Expand Down Expand Up @@ -1139,11 +1133,10 @@ def run(args=None):
else:
msg = []
else:
glyph_digest = None
for test in options.test_list:
if test is not None:
new_glyph, glyph_digest, changed, msg = \
test(new_glyph, glyph_digest, changed, msg, options)
new_glyph, changed, msg = \
test(new_glyph, changed, msg, options)

if not options.quiet_mode:
if len(msg) == 0:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def main():
'mutatorMath>=2.1.0',
'ufolib>=2.1.1',
'ufonormalizer>=0.3.2',
'fontPens>=0.1.0'
],
scripts=scripts,
entry_points={
Expand Down