a
    —ÆàgW	  ã                   @   sL   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	 G dd„ deƒZ
dS )é    )ÚotRoundÚ	roundFunc)ÚT2CharString)ÚBasePen)ÚspecializeCommandsÚcommandsToProgramc                       s\   e Zd ZdZd‡ fdd„	Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dd„ Z
ddd„Z‡  ZS )ÚT2CharStringPenaÉ  Pen to draw Type 2 CharStrings.

    The 'roundTolerance' argument controls the rounding of point coordinates.
    It is defined as the maximum absolute difference between the original
    float and the rounded integer value.
    The default tolerance of 0.5 means that all floats are rounded to integer;
    a value of 0 disables rounding; values in between will only round floats
    which are close to their integral part within the tolerated range.
    ç      à?Fc                    s6   t t| ƒ |¡ t|ƒ| _|| _|| _g | _d| _d S )N)r   r   )	Úsuperr   Ú__init__r   ÚroundÚ_CFF2Ú_widthÚ	_commandsÚ_p0)ÚselfÚwidthZglyphSetZroundToleranceZCFF2©Ú	__class__© úW/var/www/sistema_ama/venv/lib/python3.9/site-packages/fontTools/pens/t2CharStringPen.pyr      s    
zT2CharStringPen.__init__c                 C   sH   | j }|  |d ¡|  |d ¡f }| _ |d |d  |d |d  gS )Nr   é   )r   r   )r   ÚptZp0r   r   r   Ú_p   s    "zT2CharStringPen._pc                 C   s   | j  d|  |¡f¡ d S )NZrmoveto©r   Úappendr   ©r   r   r   r   r   Ú_moveTo"   s    zT2CharStringPen._moveToc                 C   s   | j  d|  |¡f¡ d S )NZrlinetor   r   r   r   r   Ú_lineTo%   s    zT2CharStringPen._lineToc                 C   s.   | j }| j d||ƒ||ƒ ||ƒ f¡ d S )NZ	rrcurveto)r   r   r   )r   Zpt1Zpt2Zpt3r   r   r   r   Ú_curveToOne(   s    zT2CharStringPen._curveToOnec                 C   s   d S ©Nr   ©r   r   r   r   Ú
_closePath,   s    zT2CharStringPen._closePathc                 C   s   d S r    r   r!   r   r   r   Ú_endPath/   s    zT2CharStringPen._endPathNTc                 C   sz   | j }|r&| jsdnd}t|d|d�}t|ƒ}| jd urX| jrFJ dƒ‚| dt| jƒ¡ | jsh| d¡ t|||d�}|S )	Né0   i  F)ZgeneralizeFirstÚmaxstackz7CFF2 does not allow encoding glyph width in CharString.r   Úendchar)ÚprogramÚprivateÚglobalSubrs)	r   r   r   r   r   Úinsertr   r   r   )r   r(   r)   ÚoptimizeÚcommandsr%   r'   Z
charStringr   r   r   ÚgetCharString2   s&    ÿ
ÿþ
ÿzT2CharStringPen.getCharString)r	   F)NNT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r"   r#   r-   Ú__classcell__r   r   r   r   r   
   s   
r   N)ZfontTools.misc.roundToolsr   r   ZfontTools.misc.psCharStringsr   ZfontTools.pens.basePenr   ZfontTools.cffLib.specializerr   r   r   r   r   r   r   Ú<module>   s   