403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/ufoLib2/objects/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/ufoLib2/objects/__pycache__/glyph.cpython-310.pyc
o

��b�L�@sddlmZddlmZddlmZmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZmZmZddlmZdd	lmZdd
lmZddlmZddlmZdd
l m!Z!m"Z"m#Z#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+ddl,m-Z-m.Z.eGdd�d��Z/dS)�)�annotations)�deepcopy)�Any�Iterator�List�Mapping�Optional�cast)�define�field)�	Transform)�AbstractPen)�AbstractPointPen�PointToSegmentPen�SegmentToPointPen)�Anchor)�	Component)�Contour)�	Guideline)�Image)�Lib�_convert_Lib�_get_lib�_set_lib)�BoundingBox�_object_lib�	getBounds�getControlBounds��
GlyphPointPen)�GlyphSet�
HasIdentifierc@s�eZdZUdZdZded<dZded<	dZded<	ee	d	�Z
d
ed<	eed	�Zded
<ee
ed�Zded<	dZded<	ee	d	�Zded<ee	d	�Zded<	ee	d	�Zded<	ee	d	�Zded<d�dd�Zd�d d!�Zd�d$d%�Zd�d'd(�Zd�d*d+�Zeee�Zed�d-d.��Zejd�d1d.��Zed�d3d4��Z e jd�d5d4��Z ed�d7d8��Z!ed�d:d;��Z"e"jd�d<d;��Z"ed�d=d>��Z#e#jd�dAd>��Z#d�dEdF�Z$d�dGdH�Z%d�dIdJ�Z&d�dKdL�Z'd�dMdN�Z(d�dOdP�Z)d�dSdT�Z*d�dWdX�Z+d�d[d\�Z,d�d]d^�Z-d�d�d`da�Z.d�dcdd�Z/d�dgdh�Z0d�dkdl�Z1d�dodp�Z2d�dqdr�Z3d�dsdt�Z4ed�dudv��Z5e5jd�dwdv��Z5ed�dydz��Z6e6jd�d{dz��Z6d�d�dd��Z7d�d�d�d��Z8d�d�d�d��Z9d�d�d�d��Z:d�d�d�d��Z;d�d�d�d��Z<d�d�d�d��Z=d�d�d�d��Z>d�d�d�d��Z?d�d�d�d��Z@dS)��Glypha0Represents a glyph, containing contours, components, anchors and various
    other bits of data concerning it.

    See http://unifiedfontobject.org/versions/ufo3/glyphs/glif/.

    Behavior:
        The Glyph object has list-like behavior. This behavior allows you to interact
        with contour data directly. For example, to get a particular contour::

            contour = glyph[0]

        To iterate over all contours::

            for contour in glyph:
                ...

        To get the number of contours::

            contourCount = len(glyph)

        To check if a :class:`.Contour` object is in glyph::

            exists = contour in glyph

        To interact with components or anchors in a similar way, use the
        :attr:`.Glyph.components` and :attr:`.Glyph.anchors` attributes.
    Nz
Optional[str]�_namer�float�width�height)�factoryz	List[int]�unicodesr�_image)r'�	converterr�_lib�notezList[Anchor]�_anchorszList[Component]�
componentsz
List[Contour]�contourszList[Guideline]�_guidelines�return�intcC�
t|j�S�N)�lenr/��self�r8�7/usr/lib/python3/dist-packages/ufoLib2/objects/glyph.py�__len__U�
z
Glyph.__len__�indexrcCs
|j|Sr4�r/)r7r<r8r8r9�__getitem__Xr;zGlyph.__getitem__�contour�boolcCs
||jvSr4r=�r7r?r8r8r9�__contains__[r;zGlyph.__contains__�Iterator[Contour]cCr3r4)�iterr/r6r8r8r9�__iter__^r;zGlyph.__iter__�strcCs8d�|jj|jj|jdurd|j�d�ndtt|���S)Nz<{}.{} {}at {}>�'z' �)�format�	__class__�
__module__�__name__r#�hex�idr6r8r8r9�__repr__as
�zGlyph.__repr__�list[Anchor]cC�|jS)aThe list of anchors the glyph contains.

        Getter:
            Returns a list of anchors the glyph contains. Modifications of the list
            modify the Glyph object.

        Setter:
            Clears current anchors and sets the new ones.
        �r-r6r8r8r9�anchorsk�z
Glyph.anchors�value�NonecC� |��|D]}|�|�qdSr4)�clearAnchors�appendAnchor)r7rU�anchorr8r8r9rSx���list[Guideline]cCrQ)aThe list of guidelines the glyph contains.

        Getter:
            Returns a list of guidelines the glyph contains. Modifications of the list
            modify the Glyph object.

        Setter:
            Clears current guidelines and sets the new ones.
        �r0r6r8r8r9�
guidelines~rTzGlyph.guidelinescCrWr4)�clearGuidelines�appendGuideline)r7rU�	guideliner8r8r9r^�r[�
str | NonecCrQ)zThe name of the glyph.)r#r6r8r8r9�name�sz
Glyph.name�
int | NonecCs|jr|jdSdS)aYThe first assigned Unicode code point or None.

        See http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#unicode.

        Setter:
            Sets the value to be the first of the assigned Unicode code points. Will
            remove a duplicate if exists. Will clear the list of Unicode points if
            value is None.
        rN)r(r6r8r8r9�unicode�s
z
Glyph.unicodecCsp|dur	g|_dS|jr0|jd|krdSz|j�|�Wn	ty&Ynw|j�d|�dS|j�|�dS)Nr)r(�remove�
ValueError�insert�append�r7rUr8r8r9re�s
�cCrQ)z�The background image reference associated with the glyph.

        See http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#image.

        Setter:
            Sets the background image reference. Clears it if value is None.
        )r)r6r8r8r9�image�s	zGlyph.imagerk� Image | Mapping[str, Any] | Nonec
Csn|dur|j��dSt|t�r||_dSt|dt|d|d|d|d|d|d�|�d�d	�|_dS)
N�fileName�xScale�xyScale�yxScale�yScale�xOffset�yOffset�color)rm�transformationrt)r)�clear�
isinstancerr�get)r7rkr8r8r9rk�s 

���objectr!�dict[str, Any]cCst|j|�S)a$Return the lib for an object with an identifier, as stored in a glyph's lib.

        If the object does not yet have an identifier, a new one is assigned to it. If
        the font lib does not yet contain the object's lib, a new one is inserted and
        returned.

        .. doctest::

            >>> from ufoLib2.objects import Font, Guideline
            >>> font = Font()
            >>> glyph = font.newGlyph("a")
            >>> glyph.guidelines = [Guideline(x=100)]
            >>> guideline_lib = glyph.objectLib(glyph.guidelines[0])
            >>> guideline_lib["com.test.foo"] = 1234
            >>> guideline_id = glyph.guidelines[0].identifier
            >>> assert guideline_id is not None
            >>> assert glyph.lib["public.objectLibs"][guideline_id] is guideline_lib
        )r�lib)r7ryr8r8r9�	objectLib�szGlyph.objectLibcCs>|jdd�=|jdd�=|jdd�=|jdd�=|j��dS)zRClears out anchors, components, contours, guidelines and image
        references.N)r-r.r/r0rkrvr6r8r8r9rv�s
zGlyph.clearcC�|jdd�=dS)zClears out anchors.NrRr6r8r8r9rX��zGlyph.clearAnchorscCr})zClears out contours.Nr=r6r8r8r9�
clearContours�r~zGlyph.clearContourscCr})zClears out components.N)r.r6r8r8r9�clearComponents�r~zGlyph.clearComponentscCr})zClears out guidelines.Nr]r6r8r8r9r_�r~zGlyph.clearGuidelines�	componentrcCs|j�|�dS)zGRemoves :class:`.Component` object from the glyph's list of components.N)r.rf)r7r�r8r8r9�removeComponentr~zGlyph.removeComponentrZ�Anchor | Mapping[str, Any]cC�Ht|t�st|t�stddt|�j����tdi|��}|j�|�dS)z�Appends an :class:`.Anchor` object to glyph's list of anchors.

        Args:
            anchor: An :class:`.Anchor` object or mapping for the Anchor constructor.
        z,Expected Anchor object or a Mapping for the zAnchor constructor, found Nr8)rwrr�	TypeError�typerLrSri)r7rZr8r8r9rYs

�zGlyph.appendAnchorra�Guideline | Mapping[str, Any]cCr�)z�Appends a :class:`.Guideline` object to glyph's list of guidelines.

        Args:
            guideline: A :class:`.Guideline` object or a mapping for the Guideline
                constructor.
        z/Expected Guideline object or a Mapping for the zGuideline constructor, found Nr8)rwrrr�r�rLr0ri)r7rar8r8r9r`s

�zGlyph.appendGuidelinecCs.t|t�stdt|�j����|j�|�dS)z?Appends a :class:`.Contour` object to glyph's list of contours.zExpected Contour, found N)rwrr�r�rLr/rirAr8r8r9�
appendContour&s
zGlyph.appendContourrccCst|�}|dur||_|S)zPReturns a new Glyph (deep) copy, optionally override the new glyph
        name.N)rr#)r7rc�otherr8r8r9�copy,sz
Glyph.copy�glyphcCsz|j|_|j|_t|j�|_t|j�|_|j|_t|j�|_t|j�|_t|j	�|_	|�
�|��|��}|�
|�dS)z�Deep-copies everything from the other glyph into self, except for
        the name.

        Existing glyph data is overwritten.

        |defcon_compat|
        N)r%r&�listr(rrkr,r{rSr^rr��getPointPen�
drawPoints)r7r��pointPenr8r8r9�copyDataFromGlyph4szGlyph.copyDataFromGlyph�delta�tuple[float, float]cCsF|jD]}|�|�q|jD]}|�|�q|jD]}|�|�qdS)z@Moves all contours, components and anchors by (x, y) font units.N)r/�mover.rS)r7r�r?r�rZr8r8r9r�Ks


�z
Glyph.move�penr
cCst|�}|�|�dS)zDraws glyph into given pen.N)rr�)r7r�r�r8r8r9�drawXsz
Glyph.drawr�rcCs0|jD]}|�|�q|jD]}|�|�qdS)z+Draws points of glyph into given point pen.N)r/r�r.)r7r�r?r�r8r8r9r�^s


�zGlyph.drawPointscCst|���}|S)z+Returns a pen for others to draw into self.)rr�)r7r�r8r8r9�getPeneszGlyph.getPencCst|�}|S)z8Returns a point pen for others to draw points into self.r)r7r�r8r8r9r�jszGlyph.getPointPencC�ttt|j�d��S)a5The color assigned to the glyph.

        See http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#publicmarkcolor.

        Getter:
            Returns the mark color or None.

        Setter:
            Sets the mark color. If value is None, deletes the key from the lib if
            present.
        �public.markColor)r	rrFr{rxr6r8r8r9�	markColorq�
zGlyph.markColorcC�0|dur||jd<dSd|jvr|jd=dSdS)Nr��r{rjr8r8r9r���

��float | NonecCr�)aEThe vertical origin of the glyph.

        See http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#publicverticalorigin.

        Getter:
            Returns the vertical origin or None.

        Setter:
            Sets the vertical origin. If value is None, deletes the key from the lib if
            present.
        �public.verticalOrigin)r	rr$r{rxr6r8r8r9�verticalOrigin�r�zGlyph.verticalOrigincCr�)Nr�r�rjr8r8r9r��r��layer�GlyphSet | None�BoundingBox | NonecC� |dur|jrtd��t||�S)aReturns the (xMin, yMin, xMax, yMax) bounding box of the glyph,
        taking the actual contours into account.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N�1layer is required to compute bounds of components)r.r�r�r7r�r8r8r9r��
zGlyph.getBoundscCr�)a	Returns the (xMin, yMin, xMax, yMax) bounding box of the glyph,
        taking only the control points into account.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        Nr�)r.r�rr�r8r8r9r�r�zGlyph.getControlBoundscCs|�|�}|durdS|jS)z�Returns the the space in font units from the point of origin to the
        left side of the glyph.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N)r�xMin�r7r��boundsr8r8r9�
getLeftMargin�s
zGlyph.getLeftMargincCsH|�|�}|durdS||j}|r"|j|7_|�|df�dSdS)a/Sets the the space in font units from the point of origin to the
        left side of the glyph.

        Args:
            value: The desired left margin in font units.
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        Nr)rr�r%r�)r7rUr�r��diffr8r8r9�
setLeftMargin�s
	
�zGlyph.setLeftMargincCs"|�|�}|durdS|j|jS)z�Returns the the space in font units from the glyph's advance width
        to the right side of the glyph.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N)rr%�xMaxr�r8r8r9�getRightMargin�s
zGlyph.getRightMargincCs&|�|�}|durdS|j||_dS)a7Sets the the space in font units from the glyph's advance width to
        the right side of the glyph.

        Args:
            value: The desired right margin in font units.
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N)rr�r%)r7rUr�r�r8r8r9�setRightMargin�s
	zGlyph.setRightMargincCs8|�|�}|durdS|jdur|jS|j|j|jS)z�Returns the the space in font units from the bottom of the canvas to
        the bottom of the glyph.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N�rr��yMinr&r�r8r8r9�getBottomMargin�s

zGlyph.getBottomMargincCsd|�|�}|durdS|jdur|j}|j|_n	|j|j|j}||}|r0|j|7_dSdS)a3Sets the the space in font units from the bottom of the canvas to
        the bottom of the glyph.

        Args:
            value: The desired bottom margin in font units.
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        Nr��r7rUr�r��oldValuer�r8r8r9�setBottomMargins
	

�zGlyph.setBottomMargincCs8|�|�}|durdS|jdur|j|jS|j|jS)z�Returns the the space in font units from the top of the canvas to
        the top of the glyph.

        Args:
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        N�rr�r&�yMaxr�r8r8r9�getTopMargins

zGlyph.getTopMargincCsl|�|�}|durdS|jdur|j|j}n|j|j}||}||kr4|j||_|j|7_dSdS)a*Sets the the space in font units from the top of the canvas to the
        top of the glyph.

        Args:
            value: The desired top margin in font units.
            layer: The layer of the glyph to look up components, if any. Not needed for
                pure-contour glyphs.
        Nr�r�r8r8r9�setTopMargin(s
	
�zGlyph.setTopMargin)r1r2)r<r2r1r)r?rr1r@)r1rC)r1rF)r1rP)rUrPr1rV)r1r\)rUr\r1rV)r1rb)r1rd)rUrdr1rV)r1r)rkrlr1rV)ryr!r1rz)r1rV)r�rr1rV)rZr�r1rV)rar�r1rV)r?rr1rVr4)rcrbr1r")r�r"r1rV)r�r�r1rV)r�r
r1rV)r�rr1rV)r1r
)r1r)rUrbr1rV)r1r�)rUr�r1rV)r�r�r1r�)r�r�r1r�)rUr$r�r�r1rV)ArLrK�__qualname__�__doc__r#�__annotations__r%r&rr�r(rr)rrr+r,r-r.r/r0r:r>rBrErO�propertyrrr{rS�setterr^rcrerkr|rvrXrr�r_r�rYr`r�r�r�r�r�r�r�r�r�r�rrr�r�r�r�r�r�r�r�r8r8r8r9r"s�










	
















r"N)0�
__future__rr�r�typingrrrrrr	�attrr
r�fontTools.misc.transformr�fontTools.pens.basePenr
�fontTools.pens.pointPenrrr�ufoLib2.objects.anchorr�ufoLib2.objects.componentr�ufoLib2.objects.contourr�ufoLib2.objects.guideliner�ufoLib2.objects.imager�ufoLib2.objects.librrrr�ufoLib2.objects.miscrrrr�ufoLib2.pointPens.glyphPointPenr�ufoLib2.typingr r!r"r8r8r8r9�<module>s$ 

Youez - 2016 - github.com/yon3zu
LinuXploit