Codebase list fontmath / uncommitted/main
* New upstream version 0.9.2 * debian/control: - Bump Standards-Version to 4.6.1; No other changes are needed. - Update dependencies Yao Wei (魏銘廷) authored 1 year, 11 months ago Debian Janitor committed 1 year, 11 months ago
8 changed file(s) with 59 addition(s) and 69 deletion(s). Raw diff Collapse all Expand all
1717 if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
1818 strategy:
1919 matrix:
20 python-version: [3.7, 3.8, 3.9]
20 python-version: ['3.7', '3.8', '3.9', '3.10']
2121 platform: [ubuntu-latest, macos-latest, windows-latest]
2222 exclude: # Only test on the oldest and latest supported stable Python on macOS and Windows.
2323 - platform: macos-latest
2424 python-version: 3.8
2525 - platform: windows-latest
2626 python-version: 3.8
27 - platform: macos-latest
28 python-version: 3.9
29 - platform: windows-latest
30 python-version: 3.9
2731 steps:
2832 - uses: actions/checkout@v2
2933 - name: Set up Python ${{ matrix.python-version }}
8080 multiplied by the given scalar. If scaleComponentTransform is False, then
8181 only the component's xOffset and yOffset attributes are scaled, whereas the
8282 xScale, xyScale, yxScale and yScale attributes are kept unchanged.
83 strict (bool): when set to False, offcurve points will be added to all
83 strict (bool): when set to False, offcurve points will be added to all
8484 straight segments to improve compatibility. Any offcurves that are
8585 still on-point will be filtered when extracted. When set to True,
86 no offcurves will be added or filtered.
86 no offcurves will be added or filtered.
8787 """
8888 self.scaleComponentTransform = scaleComponentTransform
8989 self.contours = []
431431 self._points = []
432432
433433 def _flushContour(self):
434 # keep the point order and
435 # change the removed flag if the point should be removed
434436 points = self._points
435 prevOnCurve = None
436 offCurves = []
437
438 pointsToDraw = []
439
440 # deal with the first point
441 pt, segmentType, smooth, name, identifier = points[0]
442 # if it is an offcurve, add it to the offcurve list
443 if segmentType is None:
444 offCurves.append((pt, segmentType, smooth, name, identifier))
445 else:
446 # potential redundancy
447 if segmentType == "curve":
448 # gather preceding off curves
449 testOffCurves = []
450 lastPoint = None
451 for i in range(len(points)):
452 i = -i - 1
453 testPoint = points[i]
454 testSegmentType = testPoint[1]
455 if testSegmentType is not None:
456 lastPoint = testPoint[0]
457 break
458 testOffCurves.append(testPoint[0])
459 # if two offcurves exist we can test for redundancy
460 if len(testOffCurves) == 2:
461 if testOffCurves[1] == lastPoint and testOffCurves[0] == pt:
462 segmentType = "line"
463 # remove the last two points
464 points = points[:-2]
465 # add the point to the contour
466 pointsToDraw.append((pt, segmentType, smooth, name, identifier))
467 prevOnCurve = pt
468 for pt, segmentType, smooth, name, identifier in points[1:]:
469 # store offcurves
470 if segmentType is None:
471 offCurves.append((pt, segmentType, smooth, name, identifier))
472 continue
473 # curves are a potential redundancy
474 elif segmentType == "curve":
475 if len(offCurves) == 2:
476 # test for redundancy
477 if offCurves[0][0] == prevOnCurve and offCurves[1][0] == pt:
478 offCurves = []
479 segmentType = "line"
480 # add all offcurves
481 for offCurve in offCurves:
482 pointsToDraw.append(offCurve)
483 # add the on curve
484 pointsToDraw.append((pt, segmentType, smooth, name, identifier))
485 # reset the stored data
486 prevOnCurve = pt
487 offCurves = []
488 # catch any remaining offcurves
489 if len(offCurves) != 0:
490 for offCurve in offCurves:
491 pointsToDraw.append(offCurve)
492 # draw to the pen
493 for pt, segmentType, smooth, name, identifier in pointsToDraw:
494 self._pen.addPoint(pt, segmentType, smooth=smooth, name=name, identifier=identifier)
437 for index, data in enumerate(points):
438 if data["segmentType"] == "curve":
439 prevOnCurve = points[index - 3]
440 prevOffCurve1 = points[index - 2]
441 prevOffCurve2 = points[index - 1]
442 # check if the curve is a super bezier
443 if prevOnCurve["segmentType"] is not None:
444 if prevOnCurve["pt"] == prevOffCurve1["pt"] and prevOffCurve2["pt"] == data["pt"]:
445 # the off curves are on top of the on curve point
446 # change the segmentType
447 data["segmentType"] = "line"
448 # flag the off curves to be removed
449 prevOffCurve1["removed"] = True
450 prevOffCurve2["removed"] = True
451
452 for data in points:
453 if not data["removed"]:
454 self._pen.addPoint(
455 data["pt"],
456 data["segmentType"],
457 smooth=data["smooth"],
458 name=data["name"],
459 identifier=data["identifier"]
460 )
495461
496462 def beginPath(self, identifier=None, **kwargs):
497463 self._points = []
498464 self._pen.beginPath(identifier=identifier)
499465
500466 def addPoint(self, pt, segmentType=None, smooth=False, name=None, identifier=None, **kwargs):
501 self._points.append((pt, segmentType, smooth, name, identifier))
467 self._points.append(
468 dict(
469 pt=pt,
470 segmentType=segmentType,
471 smooth=smooth,
472 name=name,
473 identifier=identifier,
474 removed=False
475 )
476 )
502477
503478 def endPath(self):
504479 self._flushContour()
506481
507482 def addComponent(self, baseGlyph, transformation, identifier=None, **kwargs):
508483 self._pen.addComponent(baseGlyph, transformation, identifier)
484
509485
510486 # -------
511487 # Support
00 [![Build Status](https://github.com/robotools/fontMath/workflows/Tests/badge.svg)](https://github.com/robotools/fontMath/actions?query=workflow%3ATests)
11 [![codecov](https://codecov.io/gh/robotools/fontMath/branch/master/graph/badge.svg)](https://codecov.io/gh/robotools/fontMath)
22 [![PyPI version fury.io](https://badge.fury.io/py/fontMath.svg)](https://pypi.org/project/fontMath/)
3 ![Python versions](https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9-blue.svg)
3 ![Python versions](https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9%2C%203.10-blue.svg)
44
55 # fontMath
66 A collection of objects that implement fast font, glyph, etc. math.
0 fontmath (0.9.2-1) UNRELEASED; urgency=medium
1
2 * New upstream version 0.9.2
3 * debian/control:
4 - Bump Standards-Version to 4.6.1; No other changes are needed.
5 - Update dependencies
6
7 -- Yao Wei (魏銘廷) <mwei@debian.org> Sun, 29 May 2022 13:08:55 +0800
8
09 fontmath (0.9.1-1) unstable; urgency=medium
110
211 * New upstream version 0.9.1
66 dh-python,
77 python3-all,
88 python3-setuptools,
9 python3-fonttools (>= 4.28.5),
9 python3-fonttools (>= 4.33.3),
1010 python3-setuptools-scm,
1111 python3-pytest
12 Standards-Version: 4.6.0
12 Standards-Version: 4.6.1
1313 Homepage: https://github.com/robotools/fontMath
1414 Vcs-Git: https://salsa.debian.org/fonts-team/fontmath.git
1515 Vcs-Browser: https://salsa.debian.org/fonts-team/fontmath
0 fonttools==4.28.5
0 fonttools==4.33.3
4444 'Topic :: Multimedia :: Graphics :: Editors :: Vector-Based',
4545 'Topic :: Software Development :: Libraries :: Python Modules',
4646 ],
47 python_requires='>=3.7',
4748 zip_safe=True,
4849 )
00 [tox]
1 envlist = py3{7,8,9}-cov, htmlcov
1 envlist = py3{7,8,9,10}-cov, htmlcov
22 skip_missing_interpreters = true
33
44 [testenv]