Skip to content

Text

Text

Source code in gdsr/_gdsr.pyi
class Text:
    text: str
    """Text content."""
    @property
    def origin(self) -> Point:
        """Text origin."""
    @origin.setter
    def origin(self, origin: PointLike) -> None:
        """Set the text origin."""
    layer: Layer
    """Text layer."""
    magnification: float
    """Text magnification."""
    angle: float
    """Text angle in degrees."""
    x_reflection: bool
    """Text x reflection."""
    vertical_presentation: VerticalPresentation
    """Text vertical presentation."""
    horizontal_presentation: HorizontalPresentation
    """Text horizontal presentation."""
    def __init__(
        self,
        text: str,
        origin: PointLike = Point(0, 0),
        layer: Layer = 0,
        magnification: float = 1.0,
        angle: float = 0.0,
        x_reflection: bool = False,
        vertical_presentation: VerticalPresentation = VerticalPresentation.Middle,
        horizontal_presentation: HorizontalPresentation = HorizontalPresentation.Centre,
    ) -> None:
        """Initialize the Text with text and origin.

        :param str text: Text content.
        :param PointLike origin: Text origin, defaults to Point(0, 0).
        :param Layer layer: Text layer, defaults to 0.
        :param float magnification: Text magnification, defaults to 1.0.
        :param float angle: Text angle in degrees, defaults to 0.0.
        :param bool x_reflection: Text x reflection, defaults to False.
        :param VerticalPresentation vertical_presentation: Text vertical presentation,
        defaults to VerticalPresentation.Middle.
        :param HorizontalPresentation horizontal_presentation: Text horizontal
        presentation, defaults to HorizontalPresentation.Centre.
        """
    @property
    def bounding_box(self) -> tuple[Point, Point]:
        """Return the bounding box of the text."""
    def set_text(self, text: str) -> Self:
        """Set the text content."""
    def set_origin(self, origin: PointLike) -> Self:
        """Set the origin of the text."""
    def set_layer(self, layer: Layer) -> Self:
        """Set the layer of the text."""
    def set_magnification(self, magnification: float) -> Self:
        """Set the magnification of the text."""
    def set_angle(self, angle: float) -> Self:
        """Set the angle of the text."""
    def set_x_reflection(self, x_reflection: bool) -> Self:
        """Set the x reflection of the text."""
    def set_vertical_presentation(
        self, vertical_presentation: VerticalPresentation
    ) -> Self:
        """Set the vertical presentation of the text."""
    def set_horizontal_presentation(
        self, horizontal_presentation: HorizontalPresentation
    ) -> Self:
        """Set the horizontal presentation of the text."""
    def copy(self) -> Self:
        """Return a copy of the text."""
    def move_to(self, point: PointLike) -> Self:
        """Move the text to a point.

        This method modifies the text in place and returns itself.

        :param PointLike point: Point to move the text to.
        """
    def move_by(self, vector: PointLike) -> Self:
        """Move the text by a vector.

        This method modifies the text in place and returns itself.

        :param PointLike vector: Vector to move the text by.
        """
    def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
        """Rotate the text by an angle around a centre point.

        This method modifies the text in place and returns itself.

        :param float angle: Counter-clockwise rotation angle in degrees.
        :param PointLike centre: Centre point of rotation, defaults to (0, 0).
        """
    def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
        """Scale the text by a factor around a centre point.

        This method modifies the text in place and returns itself.

        :param float factor: Scaling factor.
        :param PointLike centre: Centre point of scaling, defaults to (0, 0).
        """
    def is_on(self, *layer_data_types: LayerDataType) -> bool:
        """Return True if the text is on any of the layer, data_type pairs."""
    def __str__(self) -> str:
        """Return a string representation of the text."""
    def __repr__(self) -> str:
        """Return a string representation of the text."""
    def __eq__(self, value: object) -> bool:
        """Return True if the text is equal to another object."""

text instance-attribute

text: str

Text content.

origin property writable

origin: Point

Text origin.

layer instance-attribute

layer: Layer

Text layer.

magnification instance-attribute

magnification: float

Text magnification.

angle instance-attribute

angle: float

Text angle in degrees.

x_reflection instance-attribute

x_reflection: bool

Text x reflection.

vertical_presentation instance-attribute

vertical_presentation: VerticalPresentation

Text vertical presentation.

horizontal_presentation instance-attribute

horizontal_presentation: HorizontalPresentation

Text horizontal presentation.

bounding_box property

bounding_box: tuple[Point, Point]

Return the bounding box of the text.

__init__

__init__(text: str, origin: PointLike = Point(0, 0), layer: Layer = 0, magnification: float = 1.0, angle: float = 0.0, x_reflection: bool = False, vertical_presentation: VerticalPresentation = VerticalPresentation.Middle, horizontal_presentation: HorizontalPresentation = HorizontalPresentation.Centre) -> None

Initialize the Text with text and origin.

Parameters:

  • text (str) –

    Text content.

  • origin (PointLike, default: Point(0, 0) ) –

    Text origin, defaults to Point(0, 0).

  • layer (Layer, default: 0 ) –

    Text layer, defaults to 0.

  • magnification (float, default: 1.0 ) –

    Text magnification, defaults to 1.0.

  • angle (float, default: 0.0 ) –

    Text angle in degrees, defaults to 0.0.

  • x_reflection (bool, default: False ) –

    Text x reflection, defaults to False.

  • vertical_presentation (VerticalPresentation, default: VerticalPresentation.Middle ) –

    Text vertical presentation, defaults to VerticalPresentation.Middle.

  • horizontal_presentation (HorizontalPresentation, default: HorizontalPresentation.Centre ) –

    Text horizontal presentation, defaults to HorizontalPresentation.Centre.

Source code in gdsr/_gdsr.pyi
def __init__(
    self,
    text: str,
    origin: PointLike = Point(0, 0),
    layer: Layer = 0,
    magnification: float = 1.0,
    angle: float = 0.0,
    x_reflection: bool = False,
    vertical_presentation: VerticalPresentation = VerticalPresentation.Middle,
    horizontal_presentation: HorizontalPresentation = HorizontalPresentation.Centre,
) -> None:
    """Initialize the Text with text and origin.

    :param str text: Text content.
    :param PointLike origin: Text origin, defaults to Point(0, 0).
    :param Layer layer: Text layer, defaults to 0.
    :param float magnification: Text magnification, defaults to 1.0.
    :param float angle: Text angle in degrees, defaults to 0.0.
    :param bool x_reflection: Text x reflection, defaults to False.
    :param VerticalPresentation vertical_presentation: Text vertical presentation,
    defaults to VerticalPresentation.Middle.
    :param HorizontalPresentation horizontal_presentation: Text horizontal
    presentation, defaults to HorizontalPresentation.Centre.
    """

set_text

set_text(text: str) -> Self

Set the text content.

Source code in gdsr/_gdsr.pyi
def set_text(self, text: str) -> Self:
    """Set the text content."""

set_origin

set_origin(origin: PointLike) -> Self

Set the origin of the text.

Source code in gdsr/_gdsr.pyi
def set_origin(self, origin: PointLike) -> Self:
    """Set the origin of the text."""

set_layer

set_layer(layer: Layer) -> Self

Set the layer of the text.

Source code in gdsr/_gdsr.pyi
def set_layer(self, layer: Layer) -> Self:
    """Set the layer of the text."""

set_magnification

set_magnification(magnification: float) -> Self

Set the magnification of the text.

Source code in gdsr/_gdsr.pyi
def set_magnification(self, magnification: float) -> Self:
    """Set the magnification of the text."""

set_angle

set_angle(angle: float) -> Self

Set the angle of the text.

Source code in gdsr/_gdsr.pyi
def set_angle(self, angle: float) -> Self:
    """Set the angle of the text."""

set_x_reflection

set_x_reflection(x_reflection: bool) -> Self

Set the x reflection of the text.

Source code in gdsr/_gdsr.pyi
def set_x_reflection(self, x_reflection: bool) -> Self:
    """Set the x reflection of the text."""

set_vertical_presentation

set_vertical_presentation(vertical_presentation: VerticalPresentation) -> Self

Set the vertical presentation of the text.

Source code in gdsr/_gdsr.pyi
def set_vertical_presentation(
    self, vertical_presentation: VerticalPresentation
) -> Self:
    """Set the vertical presentation of the text."""

set_horizontal_presentation

set_horizontal_presentation(horizontal_presentation: HorizontalPresentation) -> Self

Set the horizontal presentation of the text.

Source code in gdsr/_gdsr.pyi
def set_horizontal_presentation(
    self, horizontal_presentation: HorizontalPresentation
) -> Self:
    """Set the horizontal presentation of the text."""

copy

copy() -> Self

Return a copy of the text.

Source code in gdsr/_gdsr.pyi
def copy(self) -> Self:
    """Return a copy of the text."""

move_to

move_to(point: PointLike) -> Self

Move the text to a point.

This method modifies the text in place and returns itself.

Parameters:

  • point (PointLike) –

    Point to move the text to.

Source code in gdsr/_gdsr.pyi
def move_to(self, point: PointLike) -> Self:
    """Move the text to a point.

    This method modifies the text in place and returns itself.

    :param PointLike point: Point to move the text to.
    """

move_by

move_by(vector: PointLike) -> Self

Move the text by a vector.

This method modifies the text in place and returns itself.

Parameters:

  • vector (PointLike) –

    Vector to move the text by.

Source code in gdsr/_gdsr.pyi
def move_by(self, vector: PointLike) -> Self:
    """Move the text by a vector.

    This method modifies the text in place and returns itself.

    :param PointLike vector: Vector to move the text by.
    """

rotate

rotate(angle: float, centre: PointLike = Point(0, 0)) -> Self

Rotate the text by an angle around a centre point.

This method modifies the text in place and returns itself.

Parameters:

  • angle (float) –

    Counter-clockwise rotation angle in degrees.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of rotation, defaults to (0, 0).

Source code in gdsr/_gdsr.pyi
def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
    """Rotate the text by an angle around a centre point.

    This method modifies the text in place and returns itself.

    :param float angle: Counter-clockwise rotation angle in degrees.
    :param PointLike centre: Centre point of rotation, defaults to (0, 0).
    """

scale

scale(factor: float, centre: PointLike = Point(0, 0)) -> Self

Scale the text by a factor around a centre point.

This method modifies the text in place and returns itself.

Parameters:

  • factor (float) –

    Scaling factor.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of scaling, defaults to (0, 0).

Source code in gdsr/_gdsr.pyi
def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
    """Scale the text by a factor around a centre point.

    This method modifies the text in place and returns itself.

    :param float factor: Scaling factor.
    :param PointLike centre: Centre point of scaling, defaults to (0, 0).
    """

is_on

is_on(*layer_data_types: LayerDataType) -> bool

Return True if the text is on any of the layer, data_type pairs.

Source code in gdsr/_gdsr.pyi
def is_on(self, *layer_data_types: LayerDataType) -> bool:
    """Return True if the text is on any of the layer, data_type pairs."""

__str__

__str__() -> str

Return a string representation of the text.

Source code in gdsr/_gdsr.pyi
def __str__(self) -> str:
    """Return a string representation of the text."""

__repr__

__repr__() -> str

Return a string representation of the text.

Source code in gdsr/_gdsr.pyi
def __repr__(self) -> str:
    """Return a string representation of the text."""

__eq__

__eq__(value: object) -> bool

Return True if the text is equal to another object.

Source code in gdsr/_gdsr.pyi
def __eq__(self, value: object) -> bool:
    """Return True if the text is equal to another object."""

VerticalPresentation

Source code in gdsr/_gdsr.pyi
class VerticalPresentation(Enum):
    Top = 0
    Middle = 1
    Bottom = 2

    @staticmethod
    def values() -> list[VerticalPresentation]:
        """Return a list of all VerticalPresentation values."""

Top class-attribute instance-attribute

Top = 0

Middle class-attribute instance-attribute

Middle = 1

Bottom class-attribute instance-attribute

Bottom = 2

values staticmethod

values() -> list[VerticalPresentation]

Return a list of all VerticalPresentation values.

Source code in gdsr/_gdsr.pyi
@staticmethod
def values() -> list[VerticalPresentation]:
    """Return a list of all VerticalPresentation values."""

HorizontalPresentation

Source code in gdsr/_gdsr.pyi
class HorizontalPresentation(Enum):
    Left = 0
    Centre = 1
    Right = 2

    @staticmethod
    def values() -> list[HorizontalPresentation]:
        """Return a list of all HorizontalPresentation values."""

Left class-attribute instance-attribute

Left = 0

Centre class-attribute instance-attribute

Centre = 1

Right class-attribute instance-attribute

Right = 2

values staticmethod

values() -> list[HorizontalPresentation]

Return a list of all HorizontalPresentation values.

Source code in gdsr/_gdsr.pyi
@staticmethod
def values() -> list[HorizontalPresentation]:
    """Return a list of all HorizontalPresentation values."""