def __init__(
        self,
        text="",
        *,
        name="label",
        font_height=22,
        font_path=ENC_SANS_BOLD_FONT_PATH,
        foreground_color=BLACK,
        background_color=(*BLACK, 0),
        padding=5,
        min_width=0,
        max_width=None,
        ellipsis_at_end=True,
        update_pos_on_change=False,
        coordinates_name="topleft",
        coordinates_value=(0, 0),
    ):
        """Perform setups and assign data for reuse.

        text
            string providing text to update surface.
        font_height
            Integer indicating desired font height in pixels.
        font_path
            String representing font style. Check local
            font.py module for available styles. In doubt
            use ENC_SANS_BOLD_FONT_PATH for default font.
        foreground_color
        background_color
            A tuple or list of r, g, b values which are
            integers ranging from 0 to 255. The background
            color can be None, though, in which case the
            background is rendered transparent. For the
            background color, an optional fourth value can
            be passed, which is an integer in the same range
            as the others, representing the image opacity
            (0 for full transparency and 255 for full
            opacity).
        padding (positive integer or 0, defaults to 5)
            amount of padding in all four sides of the
            text surface.
        max_width
        (positive integer or None, defaults to None)
            indicates maximum width to be assumed by the
            label. If None, it can assume any width.
        ellipsis_at_end (bool)
            only relevant if max width was specified.
            Indicates whether ellipsis is shown at the end
            or begginning of the text due to the
            max_width being reached by the content.
            (True = end of content; False = beginning)
        update_pos_on_change (boolean, default to False)
            whether the position of the rect should be
            reassigned using the original coordinates_name
            and coordinates_value whenever the contents
            of the label change or not.
        """
        ### convert the colors passed into tuples for
        ### simplicity (since colors can appear in other
        ### classes like pygame.Color and builtin lists too)

        background_color = tuple(background_color)
        foreground_color = tuple(foreground_color)

        ### store the background in its own attribute
        self.bg_color = background_color

        ### gather the remaining text rendering settings
        ### in a dictionary inside its own attribute;
        ### notice we left the background color data out
        ### of the map, due to the fact that it's data
        ### is handled separately (which is why it was
        ### already stored in its own attribute in the
        ### previous step)

        render_settings = {
            "font_height": font_height,
            "font_path": font_path,
            "foreground_color": foreground_color,
        }

        ### get char map for render settings then store
        ### its surf and width map

        text_map = TEXT_SURFS_DB[render_settings]

        self.surf_map = text_map["surf_map"]
        self.width_map = text_map["width_map"]

        ### store the padding
        self.padding = padding

        ### store a height taking the padding into account

        self.height = (
            ## get the height from a surface of a space
            ## character
            self.surf_map[" "].get_height()
            ## add the padding two times, to account for
            ## the padding on top and bottom
            + (self.padding * 2)
        )

        ### store the name
        self.name = name

        ### store the minimum width
        self.min_width = min_width

        ### store max width if not None, along with
        ### the ellipsis_at_end flag and additional data
        ### calculated on the spot

        if max_width is not None:

            self.max_width = max_width

            self.ellipsis_at_end = ellipsis_at_end

            self.ellipsis_width = self.width_map["."] * 3

        ### create an attribute with a string to store the
        ### text of the label
        self.contents = ""

        ### create a rect attribute holding a pygame.Rect
        ### instance
        self.rect = Rect(0, 0, 0, 0)

        ### add text the text passed as argument (this is
        ### also needed in order to create an image
        ### attribute and thus prevent errors)
        self.add_text(text)

        ### position rect
        setattr(self.rect, coordinates_name, coordinates_value)

        ### if update_pos_on_change flag is on, store
        ### the position related arguments

        if update_pos_on_change:
            self.coordinates_name = coordinates_name
            self.coordinates_value = coordinates_value
Perform setups and assign data for reuse.

        text
            string providing text to update surface.
        font_height
            Integer indicating desired font height in pixels.
        font_path
            String representing font style. Check local
            font.py module for available styles. In doubt
            use ENC_SANS_BOLD_FONT_PATH for default font.
        foreground_color
        background_color
            A tuple or list of r, g, b values which are
            integers ranging from 0 to 255. The background
            color can be None, though, in which case the
            background is rendered transparent. For the
            background color, an optional fourth value can
            be passed, which is an integer in the same range
            as the others, representing the image opacity
            (0 for full transparency and 255 for full
            opacity).
        padding (positive integer or 0, defaults to 5)
            amount of padding in all four sides of the
            text surface.
        max_width
        (positive integer or None, defaults to None)
            indicates maximum width to be assumed by the
            label. If None, it can assume any width.
        ellipsis_at_end (bool)
            only relevant if max width was specified.
            Indicates whether ellipsis is shown at the end
            or begginning of the text due to the
            max_width being reached by the content.
            (True = end of content; False = beginning)
        update_pos_on_change (boolean, default to False)
            whether the position of the rect should be
            reassigned using the original coordinates_name
            and coordinates_value whenever the contents
            of the label change or not.
        
nodezator/textman/label/main.py