o
    tBhZ                     @   s  d dl 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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dS )#    Nc                   @      e Zd ZdZdS )VarLibErrorz%Base exception for the varLib module.N__name__
__module____qualname____doc__ r	   r	   n/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/fontTools/varLib/errors.pyr          r   c                   @   r   )VarLibValidationErrorz>Raised when input data is invalid from varLib's point of view.Nr   r	   r	   r	   r
   r      r   r   c                   @   sN   e Zd ZdZdddZedd Zdd Zed	d
 Zedd Z	dd Z
dS )VarLibMergeErrorz=Raised when input data cannot be merged into a variable font.Nc                 K   s8   || _ |si }d|v r|d | _|d= ng | _|| _d S )Nstack)mergerr   cause)selfr   kwargsr	   r	   r
   __init__   s   

zVarLibMergeError.__init__c                 C   s   | j S N)r   r   r	   r	   r
   reason   s   zVarLibMergeError.reasonc                 C   s   | j d ur?| j j| }d|v r-|d dr-|d dr-|d dd |d d S t|jdr?t|jjdr?|jjjS d| S )Nname       filezmaster number )r   ttfsgetDebugNamehasattrreaderr   r   )r   ixttfr	   r	   r
   _master_name   s   
 

zVarLibMergeError._master_namec                    sD   d j v r d j v r  fdd j d D d}| |fS dS )Nexpectedgotc                    s   g | ]	}| j d  kqS )r#   )r   .0xr   r	   r
   
<listcomp>.   s    z-VarLibMergeError.offender.<locals>.<listcomp>F)NNr   indexr"   r   r*   r	   r   r
   offender+   s   zVarLibMergeError.offenderc                 C   sT   d| j v r(d| j v r(| j\}}| j d | }d| jd  d| j d  d| dS dS )	Nr#   r$   zExpected to see r   ==z, instead saw 
 )r   r,   r   )r   offender_indexr,   r$   r	   r	   r
   details4   s
   
$zVarLibMergeError.detailsc                 C   s\   | j \}}d}|rd| d}dt| j}tjd| j d| dd}d| | | j S )	Nr/   z!

The problem is likely to be in z:
z"Couldn't merge the fonts, because z:. This happened while performing the following operation: N   )widthz

)r,   joinreversedr   textwrapfillr   r1   )r   r0   r,   locationcontextbasicr	   r	   r
   __str__<   s   

zVarLibMergeError.__str__r   )r   r   r   r   r   propertyr   r"   r,   r1   r;   r	   r	   r	   r
   r      s    



r   c                       s$   e Zd ZdZe fddZ  ZS )ShouldBeConstantz9some values were different, but should have been the samec                    s   | j d dks| jd u rt jS | j\}}| jj| }| jj|d  }dd || j d  jjjD }dd || j d  jjjD }dd		| d
d		| dS )Nr   z.FeatureCountr   c                 S      g | ]}|j qS r	   
FeatureTagr%   r	   r	   r
   r(   U       z,ShouldBeConstant.details.<locals>.<listcomp>c                 S   r>   r	   r?   r%   r	   r	   r
   r(   Y   rA   z2
Incompatible features between masters.
Expected: z, z.
Got: z.
)
r   r   superr1   r,   r   tableFeatureListFeatureRecordr4   )r   r0   r,   bad_ttfgood_ttfgood_featuresbad_features	__class__r	   r
   r1   M   s"   
zShouldBeConstant.details)r   r   r   r   r<   r1   __classcell__r	   r	   rK   r
   r=   J   s    r=   c                   @   s(   e Zd ZdZedd Zedd ZdS )
FoundANonezAone of the values in a list was empty when it shouldn't have beenc                 C   s(   dd | j d D d}|| |fS )Nc                 S   s   g | ]}|d u qS r   r	   r%   r	   r	   r
   r(   i   s    z'FoundANone.offender.<locals>.<listcomp>r$   Tr)   r+   r	   r	   r
   r,   g   s   zFoundANone.offenderc                 C   s&   | j | j}}|d  d|d  dS )Nr   r-   r$   r.   )r   r   )r   r   r   r	   r	   r
   r1   l   s   zFoundANone.detailsN)r   r   r   r   r<   r,   r1   r	   r	   r	   r
   rN   d   s    
rN   c                   @   r   )MismatchedTypeszdata had inconsistent typesNr   r	   r	   r	   r
   rO   r   r   rO   c                   @   r   )LengthsDifferz*a list of objects had inconsistent lengthsNr   r	   r	   r	   r
   rP   v   r   rP   c                   @   r   )
KeysDifferz$a list of objects had different keysNr   r	   r	   r	   r
   rQ   z   r   rQ   c                   @   r   )InconsistentGlyphOrderz0the glyph order was inconsistent between mastersNr   r	   r	   r	   r
   rR   ~   r   rR   c                   @   r   )InconsistentExtensionsz6the masters use extension lookups in inconsistent waysNr   r	   r	   r	   r
   rS      r   rS   c                   @   s   e Zd ZdZedd ZdS )UnsupportedFormatz6an OpenType subtable (%s) had a format I didn't expectc                 C   s   | j | jd  S )Nsubtable)r   r   r   r	   r	   r
   r      s   zUnsupportedFormat.reasonN)r   r   r   r   r<   r   r	   r	   r	   r
   rT      s    rT   c                   @   r   )rT   zBan OpenType subtable (%s) had inconsistent formats between mastersNr   r	   r	   r	   r
   rT      r   c                   @   s   e Zd ZdS )VarLibCFFMergeErrorN)r   r   r   r	   r	   r	   r
   rV      s    rV   c                   @      e Zd ZdZdd ZdS )VarLibCFFDictMergeErrorz/Raised when a CFF PrivateDict cannot be merged.c                 C   s6   d| d| d}|D ]	}|d| 7 }q|f| _ d S )NzFor the Private Dict key 'z!', the default font value list:
	z5
had a different number of values than a region font:z
	args)r   keyvaluevalues	error_msgregion_valuer	   r	   r
   r      s   z VarLibCFFDictMergeError.__init__Nr   r   r   r   r   r	   r	   r	   r
   rX          rX   c                   @   rW   )VarLibCFFPointTypeMergeErrorzKRaised when a CFF glyph cannot be merged because of point type differences.c                 C   0   d| d| d| d| d| d}|f| _ d S )NGlyph '': 'z' at point index  in master index z+ differs from the default font point type ''rY   )r   
point_typept_indexm_indexdefault_type
glyph_namer^   r	   r	   r
   r         z%VarLibCFFPointTypeMergeError.__init__Nr`   r	   r	   r	   r
   rb      ra   rb   c                   @   rW   )VarLibCFFHintTypeMergeErrorzJRaised when a CFF glyph cannot be merged because of hint type differences.c                 C   rc   )Nrd   re   z' at index rf   z* differs from the default font hint type 'rg   rY   )r   	hint_type	cmd_indexrj   rk   rl   r^   r	   r	   r
   r      rm   z$VarLibCFFHintTypeMergeError.__init__Nr`   r	   r	   r	   r
   rn      ra   rn   c                   @   r   )VariationModelErrorz(Raised when a variation model is faulty.Nr   r	   r	   r	   r
   rq      r   rq   )r6   	Exceptionr   r   r   r=   rN   rO   rP   rQ   rR   rS   rT   rV   rX   rb   rn   rq   r	   r	   r	   r
   <module>   s$    >