diff --git a/.github/scripts/supported_python_versions.py b/.github/scripts/supported_python_versions.py index ae8a75a1..d8c2cec1 100755 --- a/.github/scripts/supported_python_versions.py +++ b/.github/scripts/supported_python_versions.py @@ -39,10 +39,7 @@ def supported_versions() -> list[str]: def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( - "which", - nargs="?", - default="all", - choices=["all", "oldest", "newest"], + "which", nargs="?", default="all", choices=["all", "oldest", "newest"] ) args = parser.parse_args() diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index f2c024da..a097df44 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -4,7 +4,6 @@ on: push: branches: - 'main' - - 'dev' tags: - '[0-9].*' @@ -61,31 +60,6 @@ jobs: - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - publish-to-testpypi: - name: Publish to TestPyPI - if: startsWith(github.ref, 'refs/heads/dev') - needs: - - build - runs-on: ubuntu-latest - - environment: - name: testpypi - url: https://test.pypi.org/p/fontParts - - permissions: - id-token: write - - steps: - - name: Download all the dists - uses: actions/download-artifact@v6 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - create-github-release: name: Create GitHub Release needs: diff --git a/Lib/fontParts/base/font.py b/Lib/fontParts/base/font.py index ac612875..25f134c0 100644 --- a/Lib/fontParts/base/font.py +++ b/Lib/fontParts/base/font.py @@ -54,7 +54,9 @@ class BaseFont(_BaseGlyphVendor, InterpolationMixin, DeprecatedFont, RemovedFont """ def __init__( - self, pathOrObject: str | BaseFont | None = None, showInterface: bool = True + self, + pathOrObject: str | os.PathLike | BaseFont | None = None, + showInterface: bool = True, ) -> None: super().__init__(pathOrObject=pathOrObject, showInterface=showInterface) @@ -221,7 +223,7 @@ def _get_path(self, **kwargs: Any) -> str | None: # type: ignore[return] def save( self, - path: str | None = None, + path: str | os.PathLike | None = None, showProgress: bool = False, formatVersion: int | None = None, fileStructure: str | None = None, @@ -285,7 +287,7 @@ def save( def _save( self, - path: str | None, + path: str | os.PathLike | None, showProgress: bool, formatVersion: int | None, fileStructure: str | None, @@ -405,7 +407,10 @@ def generateFormatToExtension(format: str, fallbackFormat: str) -> str: return formatToExtension.get(format, fallbackFormat) def generate( - self, format: str, path: str | None = None, **environmentOptions: Any + self, + format: str, + path: str | os.PathLike | None = None, + **environmentOptions: Any, ) -> None: r"""Generate the font in another format. @@ -463,7 +468,7 @@ def generate( "The file cannot be generated because an output path was not defined." ) elif path is None: - path = os.path.splitext(self.path)[0] + path = os.path.splitext(os.fsdecode(self.path))[0] path += ext elif os.path.isdir(path): if self.path is None: @@ -501,7 +506,11 @@ def _isValidGenerateEnvironmentOption(name: str) -> bool: return False def _generate( - self, format: str, path: str | None, environmentOptions: dict, **kwargs: object + self, + format: str, + path: str | os.PathLike | None, + environmentOptions: dict, + **kwargs: object, ) -> None: """Generate the native font in another format. diff --git a/Lib/fontParts/base/normalizers.py b/Lib/fontParts/base/normalizers.py index e8dcf7dd..6c80e138 100644 --- a/Lib/fontParts/base/normalizers.py +++ b/Lib/fontParts/base/normalizers.py @@ -5,6 +5,7 @@ from fontTools.misc.fixedTools import otRound from pathlib import Path import datetime +import os from fontParts.base.annotations import ( InterpolationFactorLike, @@ -1164,7 +1165,7 @@ def normalizeGlyphNote(value: str) -> str: # File Path -def normalizeFilePath(value: str | Path) -> str: +def normalizeFilePath(value: str | os.PathLike) -> str: """Normalize a file path. :param value: The file path to normalize as a :class:`str` or :class:`pathlib.Path`. diff --git a/Lib/fontParts/fontshell/font.py b/Lib/fontParts/fontshell/font.py index 2c8eb31d..a6e1b221 100644 --- a/Lib/fontParts/fontshell/font.py +++ b/Lib/fontParts/fontshell/font.py @@ -55,7 +55,7 @@ def _get_path(self, **kwargs: Any) -> str | None: def _save( self, - path: str | None = None, + path: str | os.PathLike | None = None, showProgress: bool = False, formatVersion: int | None = None, fileStructure: str | None = None, diff --git a/NEWS.rst b/NEWS.rst index 32f80c36..48325921 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,8 @@ +1.1.1 (released 2026-07-9) +-------------------------- +- Include os.PathLike in path types, thanks @adbac! (#940) + + 1.1.0 (released 2026-07-3) -------------------------- Adding in Bounds object, `insertContour` method along with more tests, bug fixes, and cleanup. diff --git a/documentation/examples/howtos/helpneeded/buildingAccents_01.py b/documentation/examples/howtos/helpneeded/buildingAccents_01.py index 7d240949..5880de71 100644 --- a/documentation/examples/howtos/helpneeded/buildingAccents_01.py +++ b/documentation/examples/howtos/helpneeded/buildingAccents_01.py @@ -8,10 +8,10 @@ font = OpenFont("test.ufo") # a list of accented glyphs that you want to build -myList = ['Aacute', 'aacute'] +myList = ["Aacute", "aacute"] # search for glyphs related to glyphs in myList and add them to myList -myList = buildRelatedAccentList(font, myList)+myList +myList = buildRelatedAccentList(font, myList) + myList # start the class at = AccentTools(font, myList) diff --git a/documentation/examples/howtos/helpneeded/buildingAccents_02.py b/documentation/examples/howtos/helpneeded/buildingAccents_02.py index 223a894a..d48cac35 100644 --- a/documentation/examples/howtos/helpneeded/buildingAccents_02.py +++ b/documentation/examples/howtos/helpneeded/buildingAccents_02.py @@ -17,18 +17,19 @@ theList = [ # caps - 'AEacute', - 'AEmacron', - 'Aacute', - 'Abreve', + "AEacute", + "AEmacron", + "Aacute", + "Abreve", # add all the accents you want in this list ] con = readGlyphConstructions() theList.sort() + def accentify(f, preflight=False): - print('start accentification', f.info.fullName) + print("start accentification", f.info.fullName) slots = list(con.keys()) slots.sort() for k in theList: @@ -52,5 +53,6 @@ def accentify(f, preflight=False): f[k].update() f.update() + accentify(f) -print('done') +print("done") diff --git a/documentation/examples/howtos/helpneeded/generatingFonts_00.py b/documentation/examples/howtos/helpneeded/generatingFonts_00.py index 22b93fcb..27674f17 100644 --- a/documentation/examples/howtos/helpneeded/generatingFonts_00.py +++ b/documentation/examples/howtos/helpneeded/generatingFonts_00.py @@ -11,4 +11,4 @@ # fontParts does not seem to expose the fullName attribute through the RInfo class path = os.sep.join([dir, font.info.fullName]) # raises NotImplemented -font.generate('mactype1', path) +font.generate("mactype1", path) diff --git a/documentation/examples/howtos/helpneeded/glyphMath_00.py b/documentation/examples/howtos/helpneeded/glyphMath_00.py index fb23b777..e68358a6 100644 --- a/documentation/examples/howtos/helpneeded/glyphMath_00.py +++ b/documentation/examples/howtos/helpneeded/glyphMath_00.py @@ -2,7 +2,7 @@ # Glyphmath howto # Fun examples -#FLM: Fun with GlyphMath +# FLM: Fun with GlyphMath # this example is meant to run with the RoboFab Demo Font # as the Current Font. So, if you're doing this in FontLab @@ -20,9 +20,9 @@ destination = f.newGlyph("a#deltaexperiment") destination.clear() -x = wideBold + (condensedLight-wideLight)*random() +x = wideBold + (condensedLight - wideLight) * random() -destination.appendGlyph( x) +destination.appendGlyph(x) destination.width = x.width f.update() diff --git a/documentation/examples/howtos/helpneeded/interpolate_01.py b/documentation/examples/howtos/helpneeded/interpolate_01.py index dded3e25..c2e31615 100644 --- a/documentation/examples/howtos/helpneeded/interpolate_01.py +++ b/documentation/examples/howtos/helpneeded/interpolate_01.py @@ -1,4 +1,5 @@ from fontParts.world import OpenFont + f = OpenFont("test.ufo") a = f["a"] # fontParts RGlyph.isCompatible doesn't take the boolean argument. diff --git a/documentation/examples/howtos/helpneeded/interpolate_02.py b/documentation/examples/howtos/helpneeded/interpolate_02.py index bc456bb5..6732d636 100644 --- a/documentation/examples/howtos/helpneeded/interpolate_02.py +++ b/documentation/examples/howtos/helpneeded/interpolate_02.py @@ -3,6 +3,7 @@ # Straight Interpolating examples from fontParts.world import OpenFont + minFont = OpenFont(pathToMinFont) maxFont = OpenFont(pathToMaxFont) # or any other way you like to get two font objects @@ -10,9 +11,9 @@ inbetweenFont = OpenFont(pathToInbetweenFont) # so now we have 3 font objects, right? -inbetweenFont.interpolate(.5, minFont, maxFont) +inbetweenFont.interpolate(0.5, minFont, maxFont) # presto, inbetweenFont is now 50% of one and 50% of the other -inbetweenFont.interpolate((.92, .12), minFont, maxFont) +inbetweenFont.interpolate((0.92, 0.12), minFont, maxFont) # presto, inbetweenFont is now horizontally # vertically interpolated in different ways. diff --git a/documentation/examples/howtos/helpneeded/kerning_00.py b/documentation/examples/howtos/helpneeded/kerning_00.py index c5f53c4d..f69456da 100644 --- a/documentation/examples/howtos/helpneeded/kerning_00.py +++ b/documentation/examples/howtos/helpneeded/kerning_00.py @@ -9,4 +9,4 @@ print(list(f.kerning.keys())) # get the value for this pair -print(f.kerning[('MMK_L_baseserif', 'n')]) +print(f.kerning[("MMK_L_baseserif", "n")]) diff --git a/documentation/examples/howtos/helpneeded/makeUFO_00.py b/documentation/examples/howtos/helpneeded/makeUFO_00.py index 9d595c27..ed446098 100644 --- a/documentation/examples/howtos/helpneeded/makeUFO_00.py +++ b/documentation/examples/howtos/helpneeded/makeUFO_00.py @@ -5,7 +5,7 @@ from fontParts.tools.toolsAll import fontToUFO from fontParts.interface.all.dialogs import GetFile, PutFile -srcPath = GetFile('Select the source') -dstPath = PutFile('Save as...') +srcPath = GetFile("Select the source") +dstPath = PutFile("Save as...") fontToUFO(srcPath, dstPath) diff --git a/documentation/examples/howtos/helpneeded/pens_00.py b/documentation/examples/howtos/helpneeded/pens_00.py index d1451ed1..557cbc88 100644 --- a/documentation/examples/howtos/helpneeded/pens_00.py +++ b/documentation/examples/howtos/helpneeded/pens_00.py @@ -6,7 +6,7 @@ f = OpenFont("test.ufo") -newGlyph = f.newGlyph('demoDrawGlyph', clear=True) +newGlyph = f.newGlyph("demoDrawGlyph", clear=True) newGlyph.width = 1000 # hey, what's this: diff --git a/documentation/examples/howtos/helpneeded/pens_01.py b/documentation/examples/howtos/helpneeded/pens_01.py index 85f84c21..db99cd0d 100644 --- a/documentation/examples/howtos/helpneeded/pens_01.py +++ b/documentation/examples/howtos/helpneeded/pens_01.py @@ -8,6 +8,6 @@ f = OpenFont("test.ufo") myPen = DigestPointPen() -f['period'].drawPoints(myPen) +f["period"].drawPoints(myPen) print(myPen.getDigest()) diff --git a/documentation/examples/howtos/helpneeded/pens_02.py b/documentation/examples/howtos/helpneeded/pens_02.py index 1821156c..491aec7e 100644 --- a/documentation/examples/howtos/helpneeded/pens_02.py +++ b/documentation/examples/howtos/helpneeded/pens_02.py @@ -8,6 +8,6 @@ f = OpenFont("test.ufo") myPen = DigestPointStructurePen() -f['period'].drawPoints(myPen) +f["period"].drawPoints(myPen) print(myPen.getDigest()) diff --git a/documentation/examples/howtos/helpneeded/pens_04.py b/documentation/examples/howtos/helpneeded/pens_04.py index 2f231f3a..dd344f1c 100644 --- a/documentation/examples/howtos/helpneeded/pens_04.py +++ b/documentation/examples/howtos/helpneeded/pens_04.py @@ -1,4 +1,5 @@ from fontParts.world import CurrentGlyph from fontParts.pens.filterPen import thresholdGlyph + d = 10 thresholdGlyph(CurrentGlyph(), d) diff --git a/documentation/examples/howtos/helpneeded/pens_05.py b/documentation/examples/howtos/helpneeded/pens_05.py index 7ff14ab6..8bb94a1c 100644 --- a/documentation/examples/howtos/helpneeded/pens_05.py +++ b/documentation/examples/howtos/helpneeded/pens_05.py @@ -1,5 +1,6 @@ from fontParts.world import CurrentGlyph from fontParts.pens.filterPen import spikeGlyph + segmentLength = 20 spikeLength = 100 spikeGlyph(CurrentGlyph(), segmentLength, spikeLength) diff --git a/documentation/examples/howtos/helpneeded/pens_06.py b/documentation/examples/howtos/helpneeded/pens_06.py index 0369acd7..1fb79091 100644 --- a/documentation/examples/howtos/helpneeded/pens_06.py +++ b/documentation/examples/howtos/helpneeded/pens_06.py @@ -1,3 +1,4 @@ from fontParts.world import CurrentGlyph from fontParts.pens.filterPen import halftoneGlyph + halftoneGlyph(CurrentGlyph()) diff --git a/documentation/examples/howtos/interpolate_00.py b/documentation/examples/howtos/interpolate_00.py index 07c6b8e3..b058b1e8 100644 --- a/documentation/examples/howtos/interpolate_00.py +++ b/documentation/examples/howtos/interpolate_00.py @@ -1,6 +1,7 @@ from fontParts.world import OpenFont + f = OpenFont("test.ufo") a = f["a"] # RGlyph.isCompatible doesn't accept the boolean argument. -#print(a.isCompatible(f["b"], False)) +# print(a.isCompatible(f["b"], False)) print(a.isCompatible(f["b"])) diff --git a/documentation/examples/howtos/lowLevel_00.py b/documentation/examples/howtos/lowLevel_00.py index c8617b37..f4a82209 100644 --- a/documentation/examples/howtos/lowLevel_00.py +++ b/documentation/examples/howtos/lowLevel_00.py @@ -1,4 +1,5 @@ from fontParts.world import OpenFont + f = OpenFont("test.ufo") # this is the high level RoboFab object print(f) diff --git a/documentation/examples/howtos/scripting_00.py b/documentation/examples/howtos/scripting_00.py index 9d69f9ab..924d7a1b 100644 --- a/documentation/examples/howtos/scripting_00.py +++ b/documentation/examples/howtos/scripting_00.py @@ -1,4 +1,5 @@ from fontParts.world import OpenFont + f = OpenFont("test.ufo") # hey look! an open font dialog! print(f) diff --git a/documentation/examples/howtos/scripting_01.py b/documentation/examples/howtos/scripting_01.py index b05e4704..d5ddc6c0 100644 --- a/documentation/examples/howtos/scripting_01.py +++ b/documentation/examples/howtos/scripting_01.py @@ -1,4 +1,5 @@ from fontParts.world import OpenFont + path = "test.ufo" f = OpenFont(path) # hey look! it opens the file without asking.. diff --git a/documentation/examples/howtos/scripting_02.py b/documentation/examples/howtos/scripting_02.py index e29e7223..f98aefb2 100644 --- a/documentation/examples/howtos/scripting_02.py +++ b/documentation/examples/howtos/scripting_02.py @@ -1,4 +1,5 @@ # in Fontlab: from fontParts.world import OpenFont + f = OpenFont("test.ufo") print(f) diff --git a/documentation/examples/objects/RAnchor_01.py b/documentation/examples/objects/RAnchor_01.py index 54f6249b..ef944316 100644 --- a/documentation/examples/objects/RAnchor_01.py +++ b/documentation/examples/objects/RAnchor_01.py @@ -5,7 +5,7 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] if len(g.anchors) > 0: for a in g.anchors: diff --git a/documentation/examples/objects/RComponent_00.py b/documentation/examples/objects/RComponent_00.py index 61a89489..8f7ec446 100644 --- a/documentation/examples/objects/RComponent_00.py +++ b/documentation/examples/objects/RComponent_00.py @@ -4,7 +4,7 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['gbreve'] +g = f["gbreve"] for c in g.components: print(c) diff --git a/documentation/examples/objects/RComponent_01.py b/documentation/examples/objects/RComponent_01.py index f7220a30..952f2b86 100644 --- a/documentation/examples/objects/RComponent_01.py +++ b/documentation/examples/objects/RComponent_01.py @@ -6,11 +6,11 @@ f = OpenFont("test.ufo") -print(f['gbreve'].components[0].baseGlyph) -print(f['gbreve'].components[1].baseGlyph) +print(f["gbreve"].components[0].baseGlyph) +print(f["gbreve"].components[1].baseGlyph) # move the component in the base glyph -f['gbreve'].components[1].offset = (100,100) +f["gbreve"].components[1].offset = (100, 100) # scale the component in the base glyph -f['gbreve'].components[0].scale = (.5, .25) +f["gbreve"].components[0].scale = (0.5, 0.25) diff --git a/documentation/examples/objects/RContour_00.py b/documentation/examples/objects/RContour_00.py index 3a1fbfec..603de9a0 100644 --- a/documentation/examples/objects/RContour_00.py +++ b/documentation/examples/objects/RContour_00.py @@ -6,7 +6,7 @@ f = OpenFont("test.ufo") # take a glyph (one with outlines obviously) -g = f['adieresis'] +g = f["adieresis"] # get to contours by index: print(g[0]) diff --git a/documentation/examples/objects/RFont_00.py b/documentation/examples/objects/RFont_00.py index 2040a3aa..4c22552d 100644 --- a/documentation/examples/objects/RFont_00.py +++ b/documentation/examples/objects/RFont_00.py @@ -4,11 +4,13 @@ # start using the current font from fontParts.world import OpenFont + f = OpenFont("test.ufo") # get a clean, empty new font object, # appropriate for the current environment from fontParts.world import RFont + f = RFont() # get an open dialog and start a new font diff --git a/documentation/examples/objects/RFont_01.py b/documentation/examples/objects/RFont_01.py index 6e3941ab..d76145e3 100644 --- a/documentation/examples/objects/RFont_01.py +++ b/documentation/examples/objects/RFont_01.py @@ -3,6 +3,7 @@ # Iterate through the font object to get to the glyphs. from fontParts.world import OpenFont + f = OpenFont("test.ufo") for glyph in f: diff --git a/documentation/examples/objects/RFont_02.py b/documentation/examples/objects/RFont_02.py index f37379a9..9616b50a 100644 --- a/documentation/examples/objects/RFont_02.py +++ b/documentation/examples/objects/RFont_02.py @@ -5,4 +5,4 @@ f = OpenFont("test.ufo") cachedKerning = f.kerning -# continue to use cachedKerning, not f.kerning. \ No newline at end of file +# continue to use cachedKerning, not f.kerning. diff --git a/documentation/examples/objects/RFont_03.py b/documentation/examples/objects/RFont_03.py index 8155ffcc..f2817a5b 100644 --- a/documentation/examples/objects/RFont_03.py +++ b/documentation/examples/objects/RFont_03.py @@ -5,6 +5,7 @@ # are actually stored in RFont.info from fontParts.world import OpenFont + f = OpenFont("test.ufo") print(f.info.unitsPerEm) diff --git a/documentation/examples/objects/RFont_04.py b/documentation/examples/objects/RFont_04.py index d02d7066..d0edee51 100644 --- a/documentation/examples/objects/RFont_04.py +++ b/documentation/examples/objects/RFont_04.py @@ -3,6 +3,7 @@ # method examples from fontParts.world import OpenFont + f = OpenFont("test.ufo") # the keys() method returns a list of glyphnames: @@ -10,4 +11,4 @@ # Not implemented in fontParts # find unicodes for each glyph by using the postscript name: -#f.autoUnicodes() +# f.autoUnicodes() diff --git a/documentation/examples/objects/RFont_05.py b/documentation/examples/objects/RFont_05.py index 931f2f9f..cfb0e3dd 100644 --- a/documentation/examples/objects/RFont_05.py +++ b/documentation/examples/objects/RFont_05.py @@ -3,6 +3,7 @@ # method examples, available in FontLab from fontParts.world import OpenFont + f = OpenFont("test.ufo") # the keys() method returns a list of glyphnames: diff --git a/documentation/examples/objects/RGlyph_00.py b/documentation/examples/objects/RGlyph_00.py index f5a7d259..74403856 100644 --- a/documentation/examples/objects/RGlyph_00.py +++ b/documentation/examples/objects/RGlyph_00.py @@ -6,10 +6,11 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] # suppose you've done the right imports # different ways of creating glyphs # a new empty glyph object from fontParts.world import RGlyph + g = RGlyph() diff --git a/documentation/examples/objects/RGlyph_01.py b/documentation/examples/objects/RGlyph_01.py index ff95c926..4ddbcd13 100644 --- a/documentation/examples/objects/RGlyph_01.py +++ b/documentation/examples/objects/RGlyph_01.py @@ -3,13 +3,14 @@ # attribute examples from fontParts.world import OpenFont, CurrentGlyph + f = OpenFont("test.ufo") # create a glyph object by asking the font g = f["Adieresis"] # alternatively, create a glyph object for the current glyph -#g = CurrentGlyph() +# g = CurrentGlyph() # get the width print(g.width) diff --git a/documentation/examples/objects/RGlyph_03.py b/documentation/examples/objects/RGlyph_03.py index 0936d063..2473ed19 100644 --- a/documentation/examples/objects/RGlyph_03.py +++ b/documentation/examples/objects/RGlyph_03.py @@ -6,6 +6,7 @@ # This assumes that there will only be # one component that needs to be remapped. + def remapComponent(glyph, oldBaseGlyph, newBaseGlyph): foundComponent = None for component in glyph.components: @@ -18,4 +19,3 @@ def remapComponent(glyph, oldBaseGlyph, newBaseGlyph): scale = foundComponent.scale glyph.removeComponent(component) glyph.appendComponent(newBaseGlyph, offset=offset, scale=scale) - diff --git a/documentation/examples/objects/RInfo_00.py b/documentation/examples/objects/RInfo_00.py index da97f671..d643c886 100644 --- a/documentation/examples/objects/RInfo_00.py +++ b/documentation/examples/objects/RInfo_00.py @@ -18,4 +18,3 @@ # but you can set the values as well f.info.postscriptUniqueID = 4309359 f.info.openTypeNameDesigner = "Eric Gill" - diff --git a/documentation/examples/objects/RPoint_00.py b/documentation/examples/objects/RPoint_00.py index bcdde6cb..67f95f11 100644 --- a/documentation/examples/objects/RPoint_00.py +++ b/documentation/examples/objects/RPoint_00.py @@ -5,14 +5,15 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] contour = g[0] print(contour.points[0]) from random import randint + for p in contour.points: - p.x += randint(-10,10) - p.y += randint(-10,10) + p.x += randint(-10, 10) + p.y += randint(-10, 10) contour.update() diff --git a/documentation/examples/objects/bPoint_00.py b/documentation/examples/objects/bPoint_00.py index 2e4b9e29..c2448d7e 100644 --- a/documentation/examples/objects/bPoint_00.py +++ b/documentation/examples/objects/bPoint_00.py @@ -5,6 +5,6 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] for aPt in g[0].bPoints: print(aPt) diff --git a/documentation/examples/objects/bPoint_01.py b/documentation/examples/objects/bPoint_01.py index 6bb9a780..90ffd745 100644 --- a/documentation/examples/objects/bPoint_01.py +++ b/documentation/examples/objects/bPoint_01.py @@ -5,7 +5,7 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] for aPt in g[0].bPoints: print(aPt.bcpIn, aPt.bcpOut, aPt.anchor) diff --git a/documentation/examples/objects/helpneeded/RKerning_00.py b/documentation/examples/objects/helpneeded/RKerning_00.py index 16dcd717..01f26159 100644 --- a/documentation/examples/objects/helpneeded/RKerning_00.py +++ b/documentation/examples/objects/helpneeded/RKerning_00.py @@ -12,6 +12,6 @@ # kerning for the V,A kern pair through a kerning class. # getting a value from the kerning dictionary -print(f.kerning[('V', 'A')]) -print(f.kerning[('T', 'X')]) +print(f.kerning[("V", "A")]) +print(f.kerning[("T", "X")]) print(list(f.kerning.keys())) diff --git a/documentation/examples/objects/helpneeded/psHints_02.py b/documentation/examples/objects/helpneeded/psHints_02.py index cc6bcfc7..8b0943ab 100644 --- a/documentation/examples/objects/helpneeded/psHints_02.py +++ b/documentation/examples/objects/helpneeded/psHints_02.py @@ -6,7 +6,7 @@ print(f.psHints.asDict()) # a math operation returns a new, unbound object -ps2 = f.psHints * .5 +ps2 = f.psHints * 0.5 # it needs to be rounded first ps2.round() diff --git a/documentation/examples/objects/helpneeded/psHints_03.py b/documentation/examples/objects/helpneeded/psHints_03.py index 4ca8154b..06130727 100644 --- a/documentation/examples/objects/helpneeded/psHints_03.py +++ b/documentation/examples/objects/helpneeded/psHints_03.py @@ -1,6 +1,7 @@ -#FLM: Get and set font level PostScript hint data. +# FLM: Get and set font level PostScript hint data. from fontParts.world import OpenFont + """ This script shows the way to get to the font level postscript hint values. These values were available from the fl layer, but not in RoboFab. @@ -21,7 +22,7 @@ # blueScale, blueShift, blueFuzz and forceBold are all single values. print("blueScale", f.psHints.blueScale) -f.psHints.blueScale = .5 +f.psHints.blueScale = 0.5 print("blueScale changed", f.psHints.blueScale) print("blueShift", f.psHints.blueShift) diff --git a/documentation/examples/objects/pen_00.py b/documentation/examples/objects/pen_00.py index e8adc834..e17b83f9 100644 --- a/documentation/examples/objects/pen_00.py +++ b/documentation/examples/objects/pen_00.py @@ -5,7 +5,7 @@ from fontParts.world import OpenFont f = OpenFont("test.ufo") -g = f['a'] +g = f["a"] pen = g.getPen() diff --git a/documentation/examples/talks/helpneeded/interpol_00.py b/documentation/examples/talks/helpneeded/interpol_00.py index a006cece..b93b3057 100644 --- a/documentation/examples/talks/helpneeded/interpol_00.py +++ b/documentation/examples/talks/helpneeded/interpol_00.py @@ -7,4 +7,4 @@ factor = 0.5 f["C"].interpolate(factor, f["A"], f["B"]) -f["C"].update() \ No newline at end of file +f["C"].update() diff --git a/documentation/examples/talks/helpneeded/interpol_01.py b/documentation/examples/talks/helpneeded/interpol_01.py index 2c055265..2a688082 100644 --- a/documentation/examples/talks/helpneeded/interpol_01.py +++ b/documentation/examples/talks/helpneeded/interpol_01.py @@ -10,8 +10,8 @@ # syntax f[name].interpolate(...) on a non-existing f[name], which doesn't # work in fontParts. But neither does this attempt to make it work. for i in range(0, 10): - factor = i*.1 - name = "result_%f"%factor + factor = i * 0.1 + name = "result_%f" % factor print("interpolating", name) f[name] = RGlyph() f[name].interpolate(factor, f["A"], f["B"]) diff --git a/documentation/examples/talks/helpneeded/interpol_03.py b/documentation/examples/talks/helpneeded/interpol_03.py index 9750a91b..b121c82a 100644 --- a/documentation/examples/talks/helpneeded/interpol_03.py +++ b/documentation/examples/talks/helpneeded/interpol_03.py @@ -1,5 +1,6 @@ # see if "A" and "B" can interpolate from fontParts.world import OpenFont + f = OpenFont("test.ufo") a = f["a"] print(a.isCompatible(f["b"], False)) diff --git a/documentation/examples/talks/helpneeded/interpol_04.py b/documentation/examples/talks/helpneeded/interpol_04.py index 8d2c3aa0..8eadf324 100644 --- a/documentation/examples/talks/helpneeded/interpol_04.py +++ b/documentation/examples/talks/helpneeded/interpol_04.py @@ -1,6 +1,7 @@ # see if "A" and "B" can interpolate # and find out what's wrong if you can from fontParts.world import OpenFont + f = OpenFont("test.ufo") a = f["a"] print(a.isCompatible(f["b"], True)) diff --git a/documentation/examples/talks/helpneeded/interpol_06.py b/documentation/examples/talks/helpneeded/interpol_06.py index 8999991a..454a5e00 100644 --- a/documentation/examples/talks/helpneeded/interpol_06.py +++ b/documentation/examples/talks/helpneeded/interpol_06.py @@ -8,7 +8,7 @@ font2 = SelectFont("Select font 2") value = AskString("What percentage?") -value = int(value) * .01 +value = int(value) * 0.01 destination = NewFont() @@ -19,4 +19,4 @@ # comment this line out of you're just testing destination.kerning.interpolate(font1.kerning, font2.kerning, value) -destination.update() \ No newline at end of file +destination.update() diff --git a/documentation/examples/talks/helpneeded/interpol_07.py b/documentation/examples/talks/helpneeded/interpol_07.py index 03419364..3c350845 100644 --- a/documentation/examples/talks/helpneeded/interpol_07.py +++ b/documentation/examples/talks/helpneeded/interpol_07.py @@ -3,6 +3,7 @@ # on positions A and B. from fontParts.world import OpenFont + f = OpenFont("test.ufo") # glyphmath @@ -31,7 +32,7 @@ f.insertGlyph(d, name="A.A_minus_B") # combination: interpolation! -d = a + .5 * (b-a) +d = a + 0.5 * (b - a) f.insertGlyph(d, name="A.A_interpolate_B") -f.update() \ No newline at end of file +f.update() diff --git a/documentation/examples/talks/helpneeded/interpol_08.py b/documentation/examples/talks/helpneeded/interpol_08.py index 6b46093b..0a7ec395 100644 --- a/documentation/examples/talks/helpneeded/interpol_08.py +++ b/documentation/examples/talks/helpneeded/interpol_08.py @@ -26,13 +26,13 @@ dst.interpolate(value, font1, font2, doProgress=True) # this interpolates the kerning # comment this line out of you're just testing - #dst.kerning.interpolate(font1.kerning, font2.kerning, value) + # dst.kerning.interpolate(font1.kerning, font2.kerning, value) dst.info.familyName = "MyBigFamily" dst.info.styleName = name dst.info.autoNaming() dst.update() fileName = dst.info.familyName + "-" + dst.info.styleName + ".vfb" path = os.path.join(where, fileName) - print('saving at', path) + print("saving at", path) dst.save(path) dst.close() diff --git a/documentation/examples/talks/helpneeded/interpol_09.py b/documentation/examples/talks/helpneeded/interpol_09.py index bd0c620c..fe9de1ee 100644 --- a/documentation/examples/talks/helpneeded/interpol_09.py +++ b/documentation/examples/talks/helpneeded/interpol_09.py @@ -5,6 +5,7 @@ # stems will get their original thickness from fontParts.world import OpenFont + f = OpenFont("test.ufo") # these are measurements you have to take diff --git a/documentation/examples/talks/helpneeded/session1_00.py b/documentation/examples/talks/helpneeded/session1_00.py index 53134031..0b9a7f82 100644 --- a/documentation/examples/talks/helpneeded/session1_00.py +++ b/documentation/examples/talks/helpneeded/session1_00.py @@ -1,2 +1,3 @@ from fontParts.world import OpenFont -print(CurrentFont()) \ No newline at end of file + +print(CurrentFont()) diff --git a/documentation/examples/talks/helpneeded/session1_01.py b/documentation/examples/talks/helpneeded/session1_01.py index 2718b1fe..1d1fc2c9 100644 --- a/documentation/examples/talks/helpneeded/session1_01.py +++ b/documentation/examples/talks/helpneeded/session1_01.py @@ -1,3 +1,4 @@ # open a glyph in FL first! from fontParts.world import CurrentGlyph + print(CurrentGlyph()) diff --git a/documentation/examples/talks/helpneeded/session1_02.py b/documentation/examples/talks/helpneeded/session1_02.py index 8d2050b2..fd057bd2 100644 --- a/documentation/examples/talks/helpneeded/session1_02.py +++ b/documentation/examples/talks/helpneeded/session1_02.py @@ -1,3 +1,4 @@ # open a couple of fonts in FL first! from fontParts.world import AllFonts + print(AllFonts()) diff --git a/documentation/examples/talks/helpneeded/session1_03.py b/documentation/examples/talks/helpneeded/session1_03.py index e7c13977..e0db477e 100644 --- a/documentation/examples/talks/helpneeded/session1_03.py +++ b/documentation/examples/talks/helpneeded/session1_03.py @@ -4,4 +4,4 @@ font = OpenFont("test.ufo") print(font.path) print(font.kerning) -print(font.info) \ No newline at end of file +print(font.info) diff --git a/documentation/examples/talks/helpneeded/session1_04.py b/documentation/examples/talks/helpneeded/session1_04.py index be56ccb1..cf850f1e 100644 --- a/documentation/examples/talks/helpneeded/session1_04.py +++ b/documentation/examples/talks/helpneeded/session1_04.py @@ -13,4 +13,4 @@ # dimension attributes print(font.info.unitsPerEm) print(font.info.ascender) -print(font.info.descender) \ No newline at end of file +print(font.info.descender) diff --git a/documentation/examples/talks/helpneeded/session1_05.py b/documentation/examples/talks/helpneeded/session1_05.py index dfcc1c61..2c492db0 100644 --- a/documentation/examples/talks/helpneeded/session1_05.py +++ b/documentation/examples/talks/helpneeded/session1_05.py @@ -10,7 +10,7 @@ print(font.info.familyName) font.info.styleName = "Roman" print(font.info.styleName) -font.info.fullName = font.info.familyName + '-' + font.info.styleName +font.info.fullName = font.info.familyName + "-" + font.info.styleName print(font.info.fullName) # dimension attributes @@ -19,4 +19,4 @@ font.info.descender = -400 print(font.info.descender) -font.update() \ No newline at end of file +font.update() diff --git a/documentation/examples/talks/helpneeded/session1_06.py b/documentation/examples/talks/helpneeded/session1_06.py index 71527c84..05a342c2 100644 --- a/documentation/examples/talks/helpneeded/session1_06.py +++ b/documentation/examples/talks/helpneeded/session1_06.py @@ -11,4 +11,4 @@ print(font.info.fullName) print(font.info.fontName) -print(font.info.fondName) \ No newline at end of file +print(font.info.fondName) diff --git a/documentation/examples/talks/helpneeded/session1_07.py b/documentation/examples/talks/helpneeded/session1_07.py index 882d11ba..fec4a1ee 100644 --- a/documentation/examples/talks/helpneeded/session1_07.py +++ b/documentation/examples/talks/helpneeded/session1_07.py @@ -5,7 +5,7 @@ font = OpenFont("test.ufo") -print(font['A']) -print(font['Adieresis']) -print(font['two']) -print(font['afii12934']) \ No newline at end of file +print(font["A"]) +print(font["Adieresis"]) +print(font["two"]) +print(font["afii12934"]) diff --git a/documentation/examples/talks/helpneeded/session1_08.py b/documentation/examples/talks/helpneeded/session1_08.py index 8e8d827d..d611f150 100644 --- a/documentation/examples/talks/helpneeded/session1_08.py +++ b/documentation/examples/talks/helpneeded/session1_08.py @@ -8,4 +8,4 @@ print("font has %d glyphs" % len(font)) for glyph in font: - print(glyph) \ No newline at end of file + print(glyph) diff --git a/documentation/examples/talks/helpneeded/session2_00.py b/documentation/examples/talks/helpneeded/session2_00.py index dbb12177..6c004564 100644 --- a/documentation/examples/talks/helpneeded/session2_00.py +++ b/documentation/examples/talks/helpneeded/session2_00.py @@ -4,7 +4,7 @@ from fontParts.world import OpenFont font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] print(glyph.name) print(glyph.width) @@ -13,4 +13,4 @@ print(glyph.box) print(glyph.str) -glyph.update() \ No newline at end of file +glyph.update() diff --git a/documentation/examples/talks/helpneeded/session2_01.py b/documentation/examples/talks/helpneeded/session2_01.py index d9390156..b5ac86d3 100644 --- a/documentation/examples/talks/helpneeded/session2_01.py +++ b/documentation/examples/talks/helpneeded/session2_01.py @@ -4,7 +4,7 @@ from fontParts.world import OpenFont font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] glyph.width = 200 print(glyph.width) diff --git a/documentation/examples/talks/helpneeded/session2_02.py b/documentation/examples/talks/helpneeded/session2_02.py index 0575b8a3..9f1e1cd1 100644 --- a/documentation/examples/talks/helpneeded/session2_02.py +++ b/documentation/examples/talks/helpneeded/session2_02.py @@ -6,13 +6,13 @@ font = OpenFont("test.ufo") # ask a font for a glyph by name -glyph = font['A'] +glyph = font["A"] # now you have a glyph object # make it do stuff by calling some of its methods glyph.move((100, 75)) -glyph.scale((.5, 1.5)) -glyph.appendGlyph(font['B']) +glyph.scale((0.5, 1.5)) +glyph.appendGlyph(font["B"]) glyph.removeOverlap() glyph.correctDirection() glyph.update() diff --git a/documentation/examples/talks/helpneeded/session2_03.py b/documentation/examples/talks/helpneeded/session2_03.py index be9409b6..1cdfaa35 100644 --- a/documentation/examples/talks/helpneeded/session2_03.py +++ b/documentation/examples/talks/helpneeded/session2_03.py @@ -6,4 +6,4 @@ font = OpenFont("test.ufo") glyph = font["A"] -print(glyph.getParent()) \ No newline at end of file +print(glyph.getParent()) diff --git a/documentation/examples/talks/helpneeded/session2_04.py b/documentation/examples/talks/helpneeded/session2_04.py index dd84b1a8..4b6700b5 100644 --- a/documentation/examples/talks/helpneeded/session2_04.py +++ b/documentation/examples/talks/helpneeded/session2_04.py @@ -4,7 +4,7 @@ from fontParts.world import OpenFont font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] print("glyph has %d contours" % len(glyph)) for contour in glyph.contours: - print(contour) \ No newline at end of file + print(contour) diff --git a/documentation/examples/talks/helpneeded/session2_05.py b/documentation/examples/talks/helpneeded/session2_05.py index 469a9685..c13e98d7 100644 --- a/documentation/examples/talks/helpneeded/session2_05.py +++ b/documentation/examples/talks/helpneeded/session2_05.py @@ -5,7 +5,7 @@ from fontParts.world import OpenFont font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] contour = glyph[0] print(contour.points) print(countours.segments) diff --git a/documentation/examples/talks/helpneeded/session2_06.py b/documentation/examples/talks/helpneeded/session2_06.py index aa413043..07a03b7d 100644 --- a/documentation/examples/talks/helpneeded/session2_06.py +++ b/documentation/examples/talks/helpneeded/session2_06.py @@ -4,6 +4,6 @@ from fontParts.world import OpenFont font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] for p in glyph[0].points: - print(p.x, p.y, p.type) \ No newline at end of file + print(p.x, p.y, p.type) diff --git a/documentation/examples/talks/helpneeded/session2_07.py b/documentation/examples/talks/helpneeded/session2_07.py index 35ab12e3..814533a6 100644 --- a/documentation/examples/talks/helpneeded/session2_07.py +++ b/documentation/examples/talks/helpneeded/session2_07.py @@ -34,4 +34,4 @@ myPen.curveTo((556, 111), (524, 71), (508, 20)) myPen.closePath() -g.update() \ No newline at end of file +g.update() diff --git a/documentation/examples/talks/helpneeded/session2_08.py b/documentation/examples/talks/helpneeded/session2_08.py index 95a8f7e9..ef1e34d8 100644 --- a/documentation/examples/talks/helpneeded/session2_08.py +++ b/documentation/examples/talks/helpneeded/session2_08.py @@ -7,7 +7,7 @@ from fontParts.pens.pointPen import PrintingSegmentPen font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] # PrintingSegmentPen won't actually draw anything # just print the coordinates to the output: diff --git a/documentation/examples/talks/helpneeded/session2_09.py b/documentation/examples/talks/helpneeded/session2_09.py index a8dc1220..03c8ab65 100644 --- a/documentation/examples/talks/helpneeded/session2_09.py +++ b/documentation/examples/talks/helpneeded/session2_09.py @@ -13,20 +13,22 @@ xMin, yMin, xMax, yMax = source.box # create a new glyph -dest = f.newGlyph(sourceGlyph+".silly") +dest = f.newGlyph(sourceGlyph + ".silly") dest.width = source.width # get a pen to draw in the new glyph myPen = dest.getPen() + # a function which draws a rectangle at a specified place def drawRect(pen, x, y, size=50): - pen.moveTo((x-.5*size, y-.5*size)) - pen.lineTo((x+.5*size, y-.5*size)) - pen.lineTo((x+.5*size, y+.5*size)) - pen.lineTo((x-.5*size, y+.5*size)) + pen.moveTo((x - 0.5 * size, y - 0.5 * size)) + pen.lineTo((x + 0.5 * size, y - 0.5 * size)) + pen.lineTo((x + 0.5 * size, y + 0.5 * size)) + pen.lineTo((x - 0.5 * size, y + 0.5 * size)) pen.closePath() + # the size of the raster unit resolution = 30 @@ -39,7 +41,7 @@ def drawRect(pen, x, y, size=50): for x in range(xMin, xMax, resolution): # check the source glyph is white or black at x,y if source.pointInside((x, y)): - drawRect(myPen, x, y, resolution-5) + drawRect(myPen, x, y, resolution - 5) # update for each line if you like the animation # otherwise move the update() out of the loop dest.update() diff --git a/documentation/examples/talks/helpneeded/session2_10.py b/documentation/examples/talks/helpneeded/session2_10.py index 7fe73f5c..8c91bd72 100644 --- a/documentation/examples/talks/helpneeded/session2_10.py +++ b/documentation/examples/talks/helpneeded/session2_10.py @@ -4,7 +4,7 @@ from fontParts.pens.pointPen import PrintingPointPen font = OpenFont("test.ufo") -glyph = font['A'] +glyph = font["A"] pen = PrintingPointPen() glyph.drawPoints(pen) diff --git a/documentation/examples/talks/helpneeded/session3_00.py b/documentation/examples/talks/helpneeded/session3_00.py index fea785b3..d559f30c 100644 --- a/documentation/examples/talks/helpneeded/session3_00.py +++ b/documentation/examples/talks/helpneeded/session3_00.py @@ -1,6 +1,7 @@ # robothon06 # work with kerning 1 from fontParts.world import OpenFont + font = OpenFont("test.ufo") # now the kerning object is generated once kerning = font.kerning @@ -9,4 +10,4 @@ print(len(kerning)) print(list(kerning.keys())) # proceed to work with the myKerning object -# this happens in the following examples too. \ No newline at end of file +# this happens in the following examples too. diff --git a/documentation/examples/talks/helpneeded/session3_01.py b/documentation/examples/talks/helpneeded/session3_01.py index f5134f22..918ddc3d 100644 --- a/documentation/examples/talks/helpneeded/session3_01.py +++ b/documentation/examples/talks/helpneeded/session3_01.py @@ -20,4 +20,4 @@ # this prints all the pairs for (left, right), value in list(kerning.items()): - print((left, right), value) \ No newline at end of file + print((left, right), value) diff --git a/documentation/examples/talks/helpneeded/session3_02.py b/documentation/examples/talks/helpneeded/session3_02.py index d11f73b4..8f145d4f 100644 --- a/documentation/examples/talks/helpneeded/session3_02.py +++ b/documentation/examples/talks/helpneeded/session3_02.py @@ -9,4 +9,4 @@ for left, right in list(kerning.keys()): if kerning[(left, right)] < -100: - print(left, right, kerning[(left, right)]) \ No newline at end of file + print(left, right, kerning[(left, right)]) diff --git a/documentation/examples/talks/helpneeded/session3_03.py b/documentation/examples/talks/helpneeded/session3_03.py index ca118e3d..e138659b 100644 --- a/documentation/examples/talks/helpneeded/session3_03.py +++ b/documentation/examples/talks/helpneeded/session3_03.py @@ -8,4 +8,4 @@ for left, right in list(kerning.keys()): if left == "acircumflex": - print(left, right, kerning[(left, right)]) \ No newline at end of file + print(left, right, kerning[(left, right)]) diff --git a/documentation/examples/talks/helpneeded/session3_04.py b/documentation/examples/talks/helpneeded/session3_04.py index 20835c53..8ec32edf 100644 --- a/documentation/examples/talks/helpneeded/session3_04.py +++ b/documentation/examples/talks/helpneeded/session3_04.py @@ -19,4 +19,4 @@ # set the width too f["aacute"].width = f["a"].width -f.update() \ No newline at end of file +f.update() diff --git a/documentation/examples/talks/helpneeded/session3_05.py b/documentation/examples/talks/helpneeded/session3_05.py index 42478673..d57946f3 100644 --- a/documentation/examples/talks/helpneeded/session3_05.py +++ b/documentation/examples/talks/helpneeded/session3_05.py @@ -16,9 +16,7 @@ # each tuple has the name of the accent as first element # and the name of the anchor which to use as the second element -accentList = [("dieresis", "top"), - ("acute", "top"), - ("cedilla", "bottom")] +accentList = [("dieresis", "top"), ("acute", "top"), ("cedilla", "bottom")] # The accents are compiled in this order, so first # "dieresis" connects to "a" using "top" anchor diff --git a/documentation/examples/talks/helpneeded/session6_01.py b/documentation/examples/talks/helpneeded/session6_01.py index 2984c0a3..6ccc7f4c 100644 --- a/documentation/examples/talks/helpneeded/session6_01.py +++ b/documentation/examples/talks/helpneeded/session6_01.py @@ -15,11 +15,11 @@ text.append(str(font.info.unitsPerEm)) text.append(str(font.info.ascender)) text.append(str(font.info.descender)) - text.append('') + text.append("") -text = '\n'.join(text) -path = PutFile('Save file as:') +text = "\n".join(text) +path = PutFile("Save file as:") if path: - file = open(path, 'w') + file = open(path, "w") file.write(text) - file.close() \ No newline at end of file + file.close() diff --git a/documentation/examples/talks/helpneeded/session6_02.py b/documentation/examples/talks/helpneeded/session6_02.py index e3f9357c..c70d5a71 100644 --- a/documentation/examples/talks/helpneeded/session6_02.py +++ b/documentation/examples/talks/helpneeded/session6_02.py @@ -10,4 +10,4 @@ for font in AllFonts(): fileName = os.path.basename(font.path) newPath = os.path.join(path, fileName) - font.save(newPath) \ No newline at end of file + font.save(newPath) diff --git a/documentation/examples/talks/helpneeded/session6_03.py b/documentation/examples/talks/helpneeded/session6_03.py index cbf11d2a..2bd6bf8b 100644 --- a/documentation/examples/talks/helpneeded/session6_03.py +++ b/documentation/examples/talks/helpneeded/session6_03.py @@ -8,7 +8,7 @@ font1 = SelectFont("Select font 1") font2 = SelectFont("Select font 2") # these are the interpolation factors: -values = [.3, .6] +values = [0.3, 0.6] for value in values: # make a new font @@ -21,4 +21,4 @@ fileName = "Demo_%d.vfb" % (1000 * value) # save at this path and close the font destination.save(os.path.join(dir, fileName)) - destination.close() \ No newline at end of file + destination.close() diff --git a/documentation/examples/talks/helpneeded/session6_04.py b/documentation/examples/talks/helpneeded/session6_04.py index 9dd184a5..d73e33a7 100644 --- a/documentation/examples/talks/helpneeded/session6_04.py +++ b/documentation/examples/talks/helpneeded/session6_04.py @@ -8,6 +8,7 @@ from fontParts.interface.all.dialogs import GetFolder from fontParts.world import OpenFont + # this function looks for fontlab files in a folder def walk(someFolder, extension): extension = extension.lower() @@ -17,22 +18,23 @@ def walk(someFolder, extension): # of stuff in the folder you feed it: names = os.listdir(someFolder) for n in names: - p = os.path.join(someFolder, n) - # if this new thing is a folder itself, - # call this function again, but now with the - # new path to check that as well. This is - # called recursion. - if os.path.isdir(p): - # add the results of the other folder - # to the list - files += walk(p, extension) - continue - # is it a file with the extension we want? - # add it then! - if n.lower().find(extension) != -1: - files.append(p) + p = os.path.join(someFolder, n) + # if this new thing is a folder itself, + # call this function again, but now with the + # new path to check that as well. This is + # called recursion. + if os.path.isdir(p): + # add the results of the other folder + # to the list + files += walk(p, extension) + continue + # is it a file with the extension we want? + # add it then! + if n.lower().find(extension) != -1: + files.append(p) return files + yourFolder = GetFolder("Search a folder:") if yourFolder is not None: fontPaths = walk(yourFolder, ".vfb") diff --git a/documentation/examples/talks/helpneeded/session6_05.py b/documentation/examples/talks/helpneeded/session6_05.py index 554082b0..32de5070 100644 --- a/documentation/examples/talks/helpneeded/session6_05.py +++ b/documentation/examples/talks/helpneeded/session6_05.py @@ -2,12 +2,13 @@ # in the current font to .sc from fontParts.world import OpenFont + f = OpenFont("test.ufo") for g in f: if g.selected == 0: continue - newName = g.name+".sc" + newName = g.name + ".sc" print("moving", g.name, "to", newName) f.insertGlyph(g, name=newName) f.removeGlyph(g.name) diff --git a/documentation/examples/talks/helpneeded/session6_06.py b/documentation/examples/talks/helpneeded/session6_06.py index 894fb64c..cbaee9b2 100644 --- a/documentation/examples/talks/helpneeded/session6_06.py +++ b/documentation/examples/talks/helpneeded/session6_06.py @@ -4,4 +4,4 @@ from fontParts.world import AllFonts for font in AllFonts(): - font.generate('otfcff') \ No newline at end of file + font.generate("otfcff") diff --git a/documentation/examples/talks/helpneeded/session6_07.py b/documentation/examples/talks/helpneeded/session6_07.py index e196fb0a..4c77a808 100644 --- a/documentation/examples/talks/helpneeded/session6_07.py +++ b/documentation/examples/talks/helpneeded/session6_07.py @@ -5,29 +5,34 @@ from fontParts.world import RFont, OpenFont import os + def collectSources(root): files = [] - ext = ['.vfb'] + ext = [".vfb"] names = os.listdir(root) for n in names: if os.path.splitext(n)[1] in ext: files.append(os.path.join(root, n)) return files + # A little function for making folders. we'll need it later. def makeFolder(path): # if the path doesn't exist, make it! if not os.path.exists(path): os.makedirs(path) + def makeDestination(root): - macPath = os.path.join(root, 'FabFonts', 'ForMac') + macPath = os.path.join(root, "FabFonts", "ForMac") makeFolder(macPath) return macPath + def generateOne(f, dstDir): - print("generating %s"%f.info.fullName) - f.generate('otfcff', dstDir) + print("generating %s" % f.info.fullName) + f.generate("otfcff", dstDir) + f = GetFolder() @@ -43,4 +48,4 @@ def generateOne(f, dstDir): finally: if font is not None: font.close(False) - print('done') + print("done") diff --git a/documentation/examples/talks/helpneeded/session6_08.py b/documentation/examples/talks/helpneeded/session6_08.py index d3b122b4..05e109fc 100644 --- a/documentation/examples/talks/helpneeded/session6_08.py +++ b/documentation/examples/talks/helpneeded/session6_08.py @@ -26,15 +26,15 @@ digest2 = pointPen.getDigest() if digest1 != digest2: - print('> alt >', glyphName) - glyph3 = font1.insertGlyph(glyph2, name=glyphName+'.alt') + print("> alt >", glyphName) + glyph3 = font1.insertGlyph(glyph2, name=glyphName + ".alt") glyph3.mark = 1 glyph3.update() for glyphName in uncommonNames: - print('>', glyphName) + print(">", glyphName) glyph = font1.insertGlyph(font2[glyphName]) glyph.mark = 60 glyph.update() -font1.update() \ No newline at end of file +font1.update() diff --git a/documentation/examples/talks/helpneeded/session6_09.py b/documentation/examples/talks/helpneeded/session6_09.py index 8e065ad9..ab2b84f3 100644 --- a/documentation/examples/talks/helpneeded/session6_09.py +++ b/documentation/examples/talks/helpneeded/session6_09.py @@ -5,5 +5,5 @@ f = OpenFont("test.ufo") print(f.naked()) -g = f["A"] +g = f["A"] print(g.naked()) diff --git a/documentation/source/conf.py b/documentation/source/conf.py index 2a813d1d..c172b199 100644 --- a/documentation/source/conf.py +++ b/documentation/source/conf.py @@ -92,9 +92,7 @@ def __getattr__(cls, name): autodoc_member_order = "bysource" autoclass_content = "both" -autodoc_type_aliases = { - "LibValueType": "~fontParts.base.annotations.LibValue" -} +autodoc_type_aliases = {"LibValueType": "~fontParts.base.annotations.LibValue"} # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -285,13 +283,7 @@ def __getattr__(cls, name): # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ( - master_doc, - "FontParts.tex", - "FontParts Documentation", - "Dr. Rob O. Fab", - "manual", - ), + (master_doc, "FontParts.tex", "FontParts Documentation", "Dr. Rob O. Fab", "manual") ] # The name of an image file (relative to this directory) to place at the top of @@ -339,7 +331,7 @@ def __getattr__(cls, name): "FontParts", "One line description of project.", "Miscellaneous", - ), + ) ] # Documents to append as an appendix to all manuals. diff --git a/documentation/tools/docstring.py b/documentation/tools/docstring.py index aee2c460..2fad8083 100644 --- a/documentation/tools/docstring.py +++ b/documentation/tools/docstring.py @@ -996,8 +996,7 @@ def insertDocstring(obj: Any, newDocstring: str, preserveVariadics: bool = True) return updatedSourceCode except TypeError as exc: raise TypeError( - f"The source of a {obj.__class__.__name__} " - "instance can not be inspected." + f"The source of a {obj.__class__.__name__} instance can not be inspected." ) from exc diff --git a/setup.py b/setup.py index fc1f76c8..60684932 100755 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ from setuptools import setup -setup() \ No newline at end of file +setup()