ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/text.cpython-37.pyc

B

s�]��@s�dZddlmZddlmZmZmZddlmZm	Z	m
Z
mZGdd�dee�ZGdd�dee�Z
Gd	d
�d
eee�ZGdd�deee�ZGd
d�de�ZGdd�deee�ZdS)z�
Text that is to be rendered as part of an SVG document fragment is specified
using the **text** element. The characters to be drawn are expressed as XML
character data inside the **text** element.

�)�BaseElement)�Presentation�	Transform�XLink)�iterflatlist�strlist�	is_string�
to_unicodecs2eZdZdZdZd�fdd�	Z�fdd�Z�ZS)	�TSpana%
    Within a **Text** element, text and font properties
    and the current text position can be adjusted with absolute or relative
    coordinate values by using the **TSpan** element.
    The characters to be drawn are expressed as XML character data inside the
    **TSpan** element.

    ZtspanNc	s�tt|�jf|�||_|dk	rTt|�r0td��|s8|r@td��|dg}|dg}|dk	rrttt	|��d�|d<|dk	r�ttt	|��d�|d<|dk	r�ttt	|��d�|d	<|dk	r�ttt	|��d�|d
<|dk	r�ttt	|��d�|d<dS)a�
        :param string text: **tspan** content
        :param 2-tuple insert: The **insert** parameter is the absolute insert point
                               of the text, don't use this parameter in combination
                               with the **x** or the **y** parameter.
        :param list x: list of absolute x-axis values for characters
        :param list y: list of absolute y-axis values for characters
        :param list dx: list of relative x-axis values for characters
        :param list dy: list of relative y-axis values for characters
        :param list rotate: list of rotation-values for characters (in degrees)

        NzE'insert' should be a <tuple> or a <list>  with at least two elements.z;Use 'insert' and 'x' or 'y' parameter not at the same time!r�� �x�y�dx�dy�rotate)
�superr
�__init__�textr�	TypeError�
ValueErrorr�listr)	�selfr�insertr
rrrr�extra)�	__class__��/text.pyrs&

zTSpan.__init__cstt|���}t|j�|_|S)N)rr
�get_xmlr	r)r�xml)rrrrCsz
TSpan.get_xml)NNNNNN)�__name__�
__module__�__qualname__�__doc__�elementnamerr�
__classcell__rr)rrr
s%r
c@seZdZdZdZdS)�Textz�
    The **Text** element defines a graphics element consisting of text.
    The characters to be drawn are expressed as XML character data inside the
    **Text** element.

    rN)r r!r"r#r$rrrrr&Isr&cs0eZdZdZdZ�fdd�Z�fdd�Z�ZS)�TRefz�
    The textual content for a **Text** can be either character data directly
    embedded within the <text> element or the character data content of a
    referenced element, where the referencing is specified with a **TRef**
    element.

    Ztrefcs tt|�jf|�|�|�dS)aA
        :param element: create a reference this element, if element is a                         `string` its the **id** name of the referenced element,                         if element is a :class:`~svgwrite.base.BaseElement`                         the **id** SVG Attribute is used to create the reference.

        N)rr'r�set_href)r�elementr)rrrr]sz
TRef.__init__cs|��tt|���S)N)�	update_idrr'r)r)rrrrhszTRef.get_xml)r r!r"r#r$rrr%rr)rrr'Ssr'cs2eZdZdZdZd
�fdd�	Z�fdd	�Z�ZS)�TextPathax
    In addition to text drawn in a straight line, SVG also includes the
    ability to place text along the shape of a **path** element. To specify that
    a block of text is to be rendered along the shape of a **path**, include
    the given text within a **textPath** element which includes an **xlink:href**
    attribute with a IRI reference to a **path** element.

    ZtextPathN�align�exactcsVtt|�jf|�||_|dkr(||d<|dkr8||d<|dk	rH||d<|�|�dS)a0
        :param path: link to **path**, **id** string or **Path** object
        :param string text: **textPath** content
        :param number startOffset: text starts with offset from begin of path.
        :param string method: ``align|stretch``
        :param string spacing: ``exact|auto``

        Zstretch�method�auto�spacingN�startOffset)rr+rrr()r�pathrr1r.r0r)rrrrxs
zTextPath.__init__cs&|��tt|���}t|j�|_|S)N)r*rr+rr	r)rr)rrrr�szTextPath.get_xml)Nr,r-)r r!r"r#r$rrr%rr)rrr+msr+cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�TBreakZtbreakcstt|�jf|�dS)N)rr3r)rr)rrrr�szTBreak.__init__cCstd��dS)Nz,__getitem__() not supported by TBreak class.)�NotImplementedError)r�keyrrr�__getitem__�szTBreak.__getitem__cCstd��dS)Nz,__setitem__() not supported by TBreak class.)r4)rr5�valuerrr�__setitem__�szTBreak.__setitem__cCstd��dS)Nz$add() not supported by TBreak class.)r4)rr)rrr�add�sz
TBreak.add)	r r!r"r$rr6r8r9r%rr)rrr3�s
r3cs6eZdZdZdZd
�fdd�	Zdd�Zdd	�Z�ZS)�TextAreaa
    At this time **textArea** is only available for SVG 1.2 Tiny profile.

    The **textArea**  element allows simplistic wrapping of text content within a
    given region. The `tiny` profile of SVG specifies a single rectangular region.
    Other profiles may allow a sequence of arbitrary shapes.

    Text wrapping via the **textArea** element is available as a lightweight and
    convenient facility for simple text wrapping where a complete box model layout
    engine is not required.

    The layout of wrapped text is user agent dependent; thus, content developers
    need to be aware that there might be different results, particularly with
    regard to where line breaks occur.

    The TextArea class wraps every text added by write() or writeline() as
    **tspan** element.

    ZtextAreaNcshtt|�jf|�|dk	r$|�|�|dk	rD|d|d<|d|d<|dk	rd|d|d<|d|d<dS)Nrr
rr�widthZheight)rr:r�write)rrr�sizer)rrrr�s
zTextArea.__init__cCs||d<dS)z" Set the line-spacing to *value*. zline-incrementNr)rr7rrr�line_increment�szTextArea.line_incrementcKs�d|kr|�t|f|��n`|�d�}x6|dd�D]&}|rN|�t|f|��|�t��q4W|dr||�t|df|��dS)z�
        Add text as **tspan** elements, with extra-params for the **tspan** element.

        Use the '\\n' character for line breaks.
        �
N���)r9r
�splitr3)rrr�lines�linerrrr<�s
zTextArea.write)NNN)	r r!r"r#r$rr>r<r%rr)rrr:�s
r:N)r#Z
svgwrite.baserZsvgwrite.mixinsrrrZsvgwrite.utilsrrrr	r
r&r'r+r3r:rrrr�<module>s6
&

Zerion Mini Shell 1.0