Skip to content

Commit

Permalink
fix: do not create empty PathObject
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Dec 2, 2024
1 parent c84c853 commit 285c8ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions playa/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,8 @@ def create(self, object_class, **kwargs) -> ContentObject:

def do_S(self) -> Iterator[ContentObject]:
"""Stroke path"""
if not self.curpath:
return
yield self.create(
PathObject,
stroke=True,
Expand All @@ -2162,6 +2164,8 @@ def do_s(self) -> Iterator[ContentObject]:

def do_f(self) -> Iterator[ContentObject]:
"""Fill path using nonzero winding number rule"""
if not self.curpath:
return
yield self.create(
PathObject,
stroke=False,
Expand All @@ -2177,6 +2181,8 @@ def do_F(self) -> Iterator[ContentObject]:

def do_f_a(self) -> Iterator[ContentObject]:
"""Fill path using even-odd rule"""
if not self.curpath:
return
yield self.create(
PathObject,
stroke=False,
Expand All @@ -2188,6 +2194,8 @@ def do_f_a(self) -> Iterator[ContentObject]:

def do_B(self) -> Iterator[ContentObject]:
"""Fill and stroke path using nonzero winding number rule"""
if not self.curpath:
return
yield self.create(
PathObject,
stroke=True,
Expand All @@ -2199,6 +2207,8 @@ def do_B(self) -> Iterator[ContentObject]:

def do_B_a(self) -> Iterator[ContentObject]:
"""Fill and stroke path using even-odd rule"""
if not self.curpath:
return
yield self.create(
PathObject,
stroke=True,
Expand Down

0 comments on commit 285c8ae

Please sign in to comment.