a
    w=ic
2                     @   sp  d ddddZ G dd deZG dd deZG d	d
 d
eZG dd deZG dd deZG dd deZg dZg dZ	g dZ
dd Zdd Zdd ZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZG d&d' d'eZG d(d) d)eZG d*d+ d+eZG d,d- d-eZG d.d/ d/eZd0Zd1d2lmZ eeeeZd3S )4 readonlyZexecuteonlyZnoaccess)             c                   @   s(   e Zd ZdZdZdZdd Zdd ZdS )	ps_objectr   r   Nc                 C   s    || _ | jjdd  d | _d S Nr   typevalue	__class____name__r	   )selfr    r   k/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/fontTools/misc/psOperators.py__init__
   s    zps_object.__init__c                 C   s   d| j jdd  t| jf S )Nz<%s %s>r   )r   r   reprr   r   r   r   r   __repr__   s    zps_object.__repr__)r   
__module____qualname__literalaccessr   r   r   r   r   r   r   r      s
   r   c                   @   s    e Zd ZdZdd Zdd ZdS )ps_operatorr   c                 C   s&   || _ || _| jjdd  d | _d S r   )namefunctionr   r   r	   )r   r   r   r   r   r   r      s    zps_operator.__init__c                 C   s
   d| j  S )Nz<operator %s>)r   r   r   r   r   r      s    zps_operator.__repr__N)r   r   r   r   r   r   r   r   r   r   r      s   r   c                   @   s    e Zd ZdZdd Zdd ZdS )ps_procedurer   c                 C   s   dS )Nz<procedure>r   r   r   r   r   r      s    zps_procedure.__repr__c                 C   sN   d}t t| jD ]2}|r2|d t| j|  }q|t| j|  }q|d S )N{ })rangelenr   str)r   psstringir   r   r   __str__!   s    zps_procedure.__str__N)r   r   r   r   r   r%   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdd ZdS )ps_namer   c                 C   s   | j rd| j S | jS d S N/)r   r   r   r   r   r   r%   ,   s    
zps_name.__str__N)r   r   r   r   r%   r   r   r   r   r&   *   s   r&   c                   @   s   e Zd Zdd ZdS )
ps_literalc                 C   s
   d| j  S r'   r   r   r   r   r   r%   3   s    zps_literal.__str__Nr   r   r   r%   r   r   r   r   r)   2   s   r)   c                   @   s   e Zd Zdd Zdd ZdS )ps_arrayc                 C   sj   d}t t| jD ]N}| j| }t|j }|r6d| }|rP|d t| | }q|t| | }q|d S )N[r   ])r    r!   r   _accessstringsr   r"   )r   r#   r$   itemr   r   r   r   r%   7   s    

zps_array.__str__c                 C   s   dS )Nz<array>r   r   r   r   r   r   C   s    zps_array.__repr__Nr   r   r   r%   r   r   r   r   r   r,   6   s   r,   )
ZFontInfoZFontNameEncodingZ	PaintTypeZFontTypeZ
FontMatrixZFontBBoxZUniqueIDZMetricsZStrokeWidth)	versionZNoticeZFullNameZ
FamilyNameZWeightZItalicAngleZisFixedPitchZUnderlinePositionZUnderlineThickness)ZPrivateCharStringsZFIDc                 C   sp   d}t |j }|r|d }| dkr:|d| t|jf  }n2| dkrR|t|| }n|dt| t||f  }|S )Nr   r   r4   z/%s %s def
r2   /%s %s %sdef
)r/   r   _type1_CharString_reprr   _type1_Encoding_reprr"   )keyr   r#   r   r   r   r   _type1_item_repre   s    
r9   c                 C   sF   | j } d}tdD ]&}| | j }|dkr|d||f  }q|| d S )Nz</Encoding 256 array
0 1 255 {1 index exch /.notdef put} for
   .notdefzdup %d /%s put
zdef
)r   r    )encodingr   r#   r$   r   r   r   r   r7   r   s    
r7   c                 C   s   t |  }dS )NZxxx)sorteditems)Zcharstringsr>   r   r   r   r6   {   s    r6   c                   @   s   e Zd Zdd Zdd ZdS )ps_fontc              	   C   s   dt | j }tD ]4}z| j| }W n ty6   Y q0 |t|| }qt| j }|D ]"\}}|tt vrZ|t|| }qZ|d }tD ]4}z| j| }W n ty   Y q0 |t|| }q|d d d d S )N%d dict dup begin
z&currentdict end
currentfile eexec
dup z@dup/FontName get exch definefont pop
mark currentfile closefile
a  0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
Zcleartomark
)r!   r   _type1_pre_eexec_orderKeyErrorr9   r=   r>   _type1_post_eexec_order)r   r#   r8   r   r>   r   r   r   r%      s2    zps_font.__str__c                 C   s   dS )Nz<font>r   r   r   r   r   r      s    zps_font.__repr__Nr1   r   r   r   r   r?      s   r?   c                   @   s   e Zd ZdS )ps_fileN)r   r   r   r   r   r   r   rE      s   rE   c                   @   s   e Zd Zdd Zdd ZdS )ps_dictc                 C   sb   dt | j }t| j }|D ]8\}}t|j }|r>|d }|dt|t||f  }q |d S )Nr@   r   r5   zend )r!   r   r=   r>   r/   r   r"   )r   r#   r>   r8   r   r   r   r   r   r%      s    
zps_dict.__str__c                 C   s   dS )Nz<dict>r   r   r   r   r   r      s    zps_dict.__repr__Nr1   r   r   r   r   rF      s   	rF   c                   @   s   e Zd Zdd ZdS )ps_markc                 C   s    d| _ | jjdd  d | _d S )Nmarkr   r	   r
   r   r   r   r   r      s    zps_mark.__init__Nr   r   r   r   r   r   r   r   rG      s   rG   c                   @   s   e Zd Zdd ZdS )ps_procmarkc                 C   s    d| _ | jjdd  d | _d S )NZprocmarkr   r	   r
   r   r   r   r   r      s    zps_procmark.__init__NrI   r   r   r   r   rJ      s   rJ   c                   @   s   e Zd Zdd ZdS )ps_nullc                 C   s   | j jdd  d | _d S r   )r   r   r	   r   r   r   r   r      s    zps_null.__init__NrI   r   r   r   r   rK      s   rK   c                   @   s   e Zd Zdd ZdS )
ps_booleanc                 C   s   | j r
dS dS d S )Ntruefalser*   r   r   r   r   r%      s    zps_boolean.__str__Nr+   r   r   r   r   rL      s   rL   c                   @   s   e Zd Zdd ZdS )	ps_stringc                 C   s   dt | jdd  S )Nz(%s)r   r   r   r   r   r   r   r%      s    zps_string.__str__Nr+   r   r   r   r   rO      s   rO   c                   @   s   e Zd Zdd ZdS )
ps_integerc                 C   s
   t | jS NrQ   r   r   r   r   r%      s    zps_integer.__str__Nr+   r   r   r   r   rR      s   rR   c                   @   s   e Zd Zdd ZdS )ps_realc                 C   s
   t | jS rS   rQ   r   r   r   r   r%      s    zps_real.__str__Nr+   r   r   r   r   rT      s   rT   c                   @   s  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zeefd-d.Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Z d9d: Z!d;d< Z"d=d> Z#d?d@ Z$dAdB Z%dCdD Z&dEdF Z'dGdH Z(dIdJ Z)dKdL Z*dMdN Z+dOdP Z,dQdR Z-dSdT Z.dUdV Z/dWdX Z0dYdZ Z1d[d\ Z2d]d^ Z3d_d` Z4dadb Z5dcS )dPSOperatorsc                 C   s$   |   }|   }|| jd |j< d S NrP   )pop	dictstackr   )r   objr   r   r   r   ps_def   s    zPSOperators.ps_defc                 C   s"   |  d}| | | | d S Nproceduretype)rW   	proc_bindpushr   procr   r   r   ps_bind   s    

zPSOperators.ps_bindc                 C   sp   t t|jD ]\}|j| }|jdkr2| | q|jsz| |j}W n   Y q0 |jdkr||j|< qd S )Nr\   Zoperatortype)r    r!   r   r	   r]   r   resolve_name)r   r`   r$   r0   rY   r   r   r   r]      s    


zPSOperators.proc_bindc                 C   s>   t | jdk rtd|  }|  }| | | | d S )Nr   stack underflow)r!   stackRuntimeErrorrW   r^   )r   obj1obj2r   r   r   ps_exch   s    
zPSOperators.ps_exchc                 C   s"   | j std| | j d  d S )Nrc   rP   )rd   re   r^   r   r   r   r   ps_dup   s    zPSOperators.ps_dupc                 C   s,   |   }|jdkr| | n
| | d S r[   )rW   r	   call_procedureZhandle_objectr   rY   r   r   r   ps_exec   s    
zPSOperators.ps_execc                 C   s   |  tt| j d S rS   )r^   rR   r!   rd   r   r   r   r   ps_count   s    zPSOperators.ps_countc                 C   s*   |   }|   }| t|j|jk d S rS   rW   r^   rL   r   r   Zany1Zany2r   r   r   ps_eq   s    zPSOperators.ps_eqc                 C   s*   |   }|   }| t|j|jk d S rS   rn   ro   r   r   r   ps_ne  s    zPSOperators.ps_nec                 C   s   |   }d|_| | d S Nr   )rW   r   r^   rk   r   r   r   ps_cvx  s    zPSOperators.ps_cvxc                 C   s:   t dtdtdt dtdtdg}| t| d S )Ng      ?r   )rT   rR   r^   r,   )r   matrixr   r   r   	ps_matrix  s    (zPSOperators.ps_matrixc                 C   s"   |  dj}| td|  d S )Nintegertype )rW   r   r^   rO   )r   numr   r   r   rO     s    zPSOperators.ps_stringc                 C   s   |   }| t|j d S rS   )rW   r^   rO   r	   rk   r   r   r   ps_type  s    zPSOperators.ps_typec                 C   sd   |   }|   }|j}tt| jd ddD ]$}|| j| v r,|| j| |<  qRq,|| jd |< d S )Nr   rP   )rW   r   r    r!   rX   )r   r   r8   r   r$   r   r   r   ps_store  s    zPSOperators.ps_storec                 C   s   |   }| td d S rr   )rW   r^   rL   r   r   r   r   r   ps_where#  s    zPSOperators.ps_wherec                 C   s   |  t| jd  d S rr   r^   rF   rX   r   r   r   r   ps_systemdict(  s    zPSOperators.ps_systemdictc                 C   s   |  t| jd  d S Nr   r}   r   r   r   r   ps_userdict+  s    zPSOperators.ps_userdictc                 C   s   |  t| jd  d S rV   r}   r   r   r   r   ps_currentdict.  s    zPSOperators.ps_currentdictc                 C   s   |  t| j d S rS   )r^   rE   Z	tokenizerr   r   r   r   ps_currentfile1  s    zPSOperators.ps_currentfilec                 C   s   |  dj}|  d S Nfiletype)rW   r   Z
starteexecr   fr   r   r   ps_eexec4  s    zPSOperators.ps_eexecc                 C   s    |  dj}|  |  d S r   )rW   r   Z	skipwhiteZ	stopeexecr   r   r   r   ps_closefile8  s    zPSOperators.ps_closefilec                 C   s    |   }|| jkr|   }qd S rS   )rW   rH   rk   r   r   r   ps_cleartomark=  s    
zPSOperators.ps_cleartomarkc                 C   sh   |  d}|j}|  d}|jjd |j_|j||}||_| | | |||||k d S )N
stringtyper   r   )rW   r   posreadr^   )r   rL   r!   sZoldstrr   newstrr   r   r   ps_readstringB  s    


zPSOperators.ps_readstringc                 C   s.   |   }|  dd}| t|j|jv  d S )Ndicttypefonttypern   )r   r8   dr   r   r   ps_knownP  s    zPSOperators.ps_knownc                 C   s$   |  d}|  djr | | d S Nr\   booleantyperW   r   rj   r_   r   r   r   ps_ifU  s    
zPSOperators.ps_ifc                 C   s:   |  d}|  d}|  djr,| | n
| | d S r   r   )r   Zproc2Zproc1r   r   r   	ps_ifelseZ  s
    

zPSOperators.ps_ifelsec                 C   s&   |   }|jdk rd|_| | d S r   rW   r   r^   rk   r   r   r   ps_readonlyb  s    
zPSOperators.ps_readonlyc                 C   s&   |   }|jdk rd|_| | d S )Nr   r   rk   r   r   r   ps_executeonlyh  s    
zPSOperators.ps_executeonlyc                 C   s&   |   }|jdk rd|_| | d S )Nr   r   rk   r   r   r   ps_noaccessn  s    
zPSOperators.ps_noaccessc                 C   s@   |  dd}|jdkr*| t|j  n| t|j  d S )Nr   rv   )rW   r	   r^   rL   r   rR   rk   r   r   r   ps_nott  s    
zPSOperators.ps_notc                 C   s   |  d}td|j d S )Nr   zPS output --->)rW   printr   )r   r"   r   r   r   ps_print{  s    
zPSOperators.ps_printc                 C   s   |  d}|  d}t|j}|jd | |jkrd| t|j|d   | | | td n| | | td d S )Nr   r   r   )rW   r!   r   r^   rO   rL   )r   seekr   Zseeklenr   r   r   ps_anchorsearch  s    




zPSOperators.ps_anchorsearchc                 C   s(   |  d}td g|j }| | d S Nrv   )rW   r,   r   r^   )r   rx   arrayr   r   r   r,     s    
zPSOperators.ps_arrayc                 C   sB   |  d}tt|jd ddD ]}|   |j|< q | | d S )N	arraytyper   rP   )rW   r    r!   r   r^   )r   r   r$   r   r   r   	ps_astore  s    
zPSOperators.ps_astorec                 C   s   |   }| | |j d S rS   )rW   r^   rb   r   r{   r   r   r   ps_load  s    zPSOperators.ps_loadc                 C   s   |   }|   }|  dddd}|j}|dks6|dkrD||j|j< nP|dkrZ||j|j< n:|dkr|j}|jd | t|j |j|d d   |_d S )Nr   r   r   r\   r   )rW   r	   r   chr)r   rf   rg   obj3tpindexr   r   r   ps_put  s    zPSOperators.ps_putc                 C   s   |   }|jdkr|  ddddd}|j}|dv rF| |j|j  nL|dv rb| |j|j  n0|dkr| tt|j|j  nd	sJ d
d S )Nr2   r   r   r   r\   r   )r   r\   )r   r   Fzshouldn't get here)rW   r   r	   r^   rR   ord)r   rf   rg   r   r   r   r   ps_get  s    
zPSOperators.ps_getc                 C   s   |  d}|  d}|  dd}|j}|dkrR| t|j|j|j|j   n*|dkr|| t|j|j|j|j   d S )Nrv   r   r   )rW   r	   r^   r,   r   rO   )r   rf   rg   r   r   r   r   r   ps_getinterval  s    

$zPSOperators.ps_getintervalc                 C   s   |  dd}|  d}|  dd}|j}|dkrP|j|j|j|jt|j < nF|dkr|jd |j }||j }||j|jt|j d   }||_d S )Nr   r   rv   )rW   r	   r   r!   )r   rf   rg   r   r   r   r   r   r   ps_putinterval  s    
 
zPSOperators.ps_putintervalc                 C   s   |  t| dj d S )Nr   )r^   r&   rW   r   r   r   r   r   ps_cvn  s    zPSOperators.ps_cvnc                 C   s4   |  dj}|dk rtd| | jd|   d S )Nrv   r   zindex may not be negativerP   )rW   r   re   r^   rd   )r   nr   r   r   ps_index  s    zPSOperators.ps_indexc                 C   s   |  d}|  ddj}|  ddj}|  ddj}|dkrH||krRqn
||k rRqt|tdkrr| t| n| t| | | || }q4d S )Nr\   rv   Zrealtyper   g        )rW   r   r	   r^   rT   rR   rj   )r   r`   limit	incrementr$   r   r   r   ps_for  s    

zPSOperators.ps_forc                 C   s   |  d}|  ddd}|j}|dkrH|jD ]}| | | | q,np|dkrz|jD ] }| tt| | | qVn>|dkr|j D ]*\}}| t| | | | | qd S )Nr\   r   r   r   )	rW   r	   r   r^   rj   rR   r   r>   r&   )r   r`   rY   r   r0   r8   r   r   r   r   	ps_forall  s     




zPSOperators.ps_forallc                 C   s@   |  d}|   }t|j}|| jd d j|j< | | d S )Nr   r   FontDirectory)rW   r?   r   rX   r^   )r   fontr   r   r   r   ps_definefont  s
    

zPSOperators.ps_definefontc                 C   s,   |   }| jd d j|j }| | d S )Nr   r   )rW   rX   r   r^   )r   r   r   r   r   r   ps_findfont  s    zPSOperators.ps_findfontc                 C   s   |    d S rS   )rW   r   r   r   r   ps_pop  s    zPSOperators.ps_popc                 C   s   |  d | ti  d S r   )rW   r^   rF   r   r   r   r   rF   
  s    
zPSOperators.ps_dictc                 C   s   | j | dj d S )Nr   )rX   appendrW   r   r   r   r   r   ps_begin  s    zPSOperators.ps_beginc                 C   s$   t | jdkr| jd= ntdd S )Nr   rP   zdictstack underflow)r!   rX   re   r   r   r   r   ps_end  s    
zPSOperators.ps_endN)6r   r   r   rZ   ra   r]   rh   ri   rl   rm   rp   rq   rs   ru   rO   ry   rz   r|   r~   r   r   r   r   r   r   rL   r!   r   r   r   r   r   r   r   r   r   r   r,   r   r   r   r   r   r   r   r   r   r   r   r   r   rF   r   r   r   r   r   r   rU      sf   


rU   r;   r   )StandardEncodingN)r/   objectr   r   r   r&   r)   r,   rB   Z_type1_fontinfo_orderrD   r9   r7   r6   r?   rE   rF   rG   rJ   rK   rL   rO   rR   rT   rU   ZnotdefZ$fontTools.encodings.StandardEncodingr   listmapZps_StandardEncodingr   r   r   r   <module>   s8   	  M