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

Fix copyData based on #758 #765

Merged
merged 2 commits into from
Nov 8, 2024
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
11 changes: 5 additions & 6 deletions Lib/fontParts/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def copyData(self, source):
if isinstance(selfValue, BaseObject):
selfValue.copyData(sourceValue)
else:
setattr(self, attr, sourceValue)

setattr(self, attr, deepcopy(sourceValue))
# ----------
# Exceptions
# ----------
Expand Down Expand Up @@ -832,10 +831,10 @@ def _setIdentifier(self, value):
def reference(obj):
"""
This code returns a simple function that returns the given object.
This is a backwards compatibility function that is under review.
See #749. We used to use weak references, but they proved
problematic (see issue #71), so this function was put in place to
make sure existing code continued to function. The need for it is
This is a backwards compatibility function that is under review.
See #749. We used to use weak references, but they proved
problematic (see issue #71), so this function was put in place to
make sure existing code continued to function. The need for it is
questionable, so it may be deleted soon.
"""
def wrapper():
Expand Down
12 changes: 12 additions & 0 deletions Lib/fontParts/test/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ def test_update(self):
self.assertEqual(info1.familyName, "test2")
self.assertEqual(info1.unitsPerEm, 2000)

# ----
# Copy
# ----
def test_copy(self):
info1 = self.getInfo_generic()
info1.postscriptBlueValues = [-10, 0, 50, 60]

info2 = info1.copy()
info2.postscriptBlueValues[0] = -2

self.assertNotEqual(info1.postscriptBlueValues, info2.postscriptBlueValues)

# -------------
# Interpolation
# -------------
Expand Down
Loading