Created
March 12, 2020 19:43
-
-
Save cjdunn/5f7a1fca6aaab4526255d41a7f74ebe3 to your computer and use it in GitHub Desktop.
removes selected off-curve points for AllFonts() so they are still VF compatible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# removes selected off-curve points for AllFonts() so they are still VF compatible | |
def segment2line(glyph, index, ): | |
c, s = index | |
contour = glyph[c] | |
segment = contour[s] | |
segment.type = "line" | |
glyph = CurrentGlyph() | |
selection = glyph.selection | |
deleteList = [] | |
#get contour and segment index for selected points and add to list | |
for contour in glyph: | |
for segment in contour: | |
for p in selection: | |
if p in segment: | |
deleteList.append( ( glyph.name, (segment.contour.index, segment.index) ) ) | |
#remove duplicates in list | |
deleteList = list ( set( deleteList ) ) | |
fonts = AllFonts() | |
for f in fonts: | |
for gname, index in deleteList: | |
glyph = f[gname] | |
segment2line(glyph, index,) | |
f.save() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment