docs: def draw_name(self, context, transparency, only_calculate_size=False):
          """Draws the name of the port
  
          Offers the option to only calculate the size of the name.
  
          :param context: The context to draw on
          :param transparency: The transparency of the text
          :param only_calculate_size: Whether to only calculate the size
          :return: Size of the name
          :rtype: float, float
          """
          c = context
          cairo_context = c
          if isinstance(c, CairoBoundingBoxContext):
              cairo_context = c._cairo
          # c.set_antialias(Antialias.GOOD)
  
          side_length = self.port_side_size
  
          layout = PangoCairo.create_layout(cairo_context)
          font_name = constants.INTERFACE_FONT
          font_size = gap_draw_helper.FONT_SIZE
          font = FontDescription(font_name + " " + str(font_size))
          layout.set_font_description(font)
          layout.set_text(self.name, -1)
  
          ink_extents, logical_extents = layout.get_extents()
          extents = [extent / float(SCALE) for extent in [logical_extents.x, logical_extents.y,
                                                          logical_extents.width, logical_extents.height]]
          real_name_size = extents[2], extents[3]
          desired_height = side_length * 0.75
          scale_factor = real_name_size[1] / desired_height
  
          # Determine the size of the text, increase the width to have more margin left and right of the text
          margin = side_length / 4.
          name_size = real_name_size[0] / scale_factor, desired_height
          name_size_with_margin = name_size[0] + margin * 2, name_size[1] + margin * 2
  
          # Only the size is required, stop here
          if only_calculate_size:
              return name_size_with_margin
  
          # Current position is the center of the port rectangle
          c.save()
          if self.side is SnappedSide.RIGHT or self.side is SnappedSide.LEFT:
              c.rotate(deg2rad(-90))
          c.rel_move_to(-name_size[0] / 2, -name_size[1] / 2)
          c.scale(1. / scale_factor, 1. / scale_factor)
          c.rel_move_to(-extents[0], -extents[1])
  
          c.set_source_rgba(*gap_draw_helper.get_col_rgba(self.text_color, transparency))
          PangoCairo.update_layout(cairo_context, layout)
          PangoCairo.show_layout(cairo_context, layout)
          c.restore()
  
          return name_size_with_margin