Skip to content

Commit

Permalink
determine size using getbbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Jan 11, 2024
1 parent e9b01f7 commit 62bb7f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,10 @@ def draw_shape_label(self, shape, bounds):
except Exception:
font = ImageFont.load(
'%s/pilfonts/B%0.2d.pil' % (self.GATEWAYPATH, size))
textsize = font.getbbox(text)[2:]
xy = (center[0] - textsize[0] / 2.0, center[1] - textsize[1] / 2.0)
box = font.getbbox(text)
width = box[2] - box[0]
height = box[3] - box[1]
xy = (center[0] - width / 2.0, center[1] - height / 2.0)
self.draw.text(xy, text, fill=rgba, font=font)

def draw_arrow(self, shape):
Expand Down

0 comments on commit 62bb7f8

Please sign in to comment.