Skip to content

Commit

Permalink
Drop support for textsize completely
Browse files Browse the repository at this point in the history
  • Loading branch information
avalentino committed Jul 9, 2023
1 parent 0a7a12a commit 400c85f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions pycoast/cw_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ def _draw_text_box(
):
"""Add a text box at position (x,y)."""
if box_outline is not None:
if hasattr(draw, "textsize"):
text_size = draw.textsize(text, font)
else:
left, top, right, bottom = draw.textbbox(text_position, text, font)
text_size = right - left, top - bottom
left, top, right, bottom = draw.textbbox(text_position, text, font)
text_size = right - left, top - bottom
margin = 2
xUL = text_position[0] - margin
yUL = text_position[1]
Expand Down
7 changes: 2 additions & 5 deletions pycoast/cw_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,8 @@ def is_agg(self) -> bool:

def _draw_text(self, draw, position, txt, font, align="cc", **kwargs):
"""Draw text with agg module."""
if hasattr(draw, "textsize"):
txt_width, txt_height = draw.textsize(txt, font)
else:
left, top, right, bottom = draw.textbbox(position, txt, font)
txt_width, txt_height = right - left, top - bottom
left, top, right, bottom = draw.textbbox(position, txt, font)
txt_width, txt_height = right - left, top - bottom
x_pos, y_pos = position
ax, ay = align.lower()
if ax == "r":
Expand Down

0 comments on commit 400c85f

Please sign in to comment.