
    ]Mh                        d dl Z  G d de          Z G d de          Z G d de          Z G d d	e          Z G d
 de          Z G d de          Z G d de          Z G d de          Z	 G d de          Z
 G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Z G d" d#e          Z G 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__     W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/fontTools/varLib/errors.pyr   r      s        ////r   r   c                       e Zd ZdZdS )VarLibValidationErrorz>Raised when input data is invalid from varLib's point of view.Nr   r
   r   r   r   r      s        HHHHr   r   c                   h    e Zd ZdZd	dZed             Zd Zed             Zed             Z	d Z
dS )
VarLibMergeErrorz=Raised when input data cannot be merged into a variable font.Nc                 b    || _         |si }d|v r|d         | _        |d= ng | _        || _        d S )Nstack)mergerr   cause)selfr   kwargss      r   __init__zVarLibMergeError.__init__   sG     	FfDJwDJ


r   c                     | j         S N)r	   )r   s    r   reasonzVarLibMergeError.reason   s
    |r   c                 .   | j         | j         j        |         }d|v r4|d                                         r|d                                         S t          |j        d          r+t          |j        j        d          r|j        j        j        S d| S )Nnamefilezmaster number )r   ttfsgetBestFullNamehasattrreaderr   r   )r   ixttfs      r   _master_namezVarLibMergeError._master_name   s    ;"+"2&C}}V!<!<!>!>}6{22444V,, ,&1Q1Q ,z++$$$$r   c                      d j         v rjd j         v ra fd j         d         D                                 d          }                     |          }d j         v r| d j         d          d}||fS dS )	Nexpectedgotc                 2    g | ]}|j         d          k    S )r&   )r   ).0xr   s     r   
<listcomp>z-VarLibMergeError.offender.<locals>.<listcomp>*   s%    LLLQQ$*Z00LLLr   Flocation ())NNr   indexr$   )r   r0   master_names   `  r   offenderzVarLibMergeError.offender'   s    ##(;(;LLLL$*U:KLLLRR E ++E22KTZ''!,II
:0FIII+%%zr   c                     d| j         v rHd| 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   r2   r   )r   offender_indexr2   r'   s       r   detailszVarLibMergeError.details3   sl    ##(;(;'+}$NH*U#N3Chdjmhhtz*7Mhh_bhhhhrr   c                     | j         \  }}d}|rd| d}d                    t          | j                            }t	          j        d| j         d| d          }d|z   |z   | j        z   S )	Nr6   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

)r2   joinreversedr   textwrapfillr   r8   )r   r7   r2   r,   contextbasics         r   __str__zVarLibMergeError.__str__;   s    #'=  	KJXJJJH''(4:..//Q Q QGNQ Q
 
 

 ~(4<77r   r   )r   r   r   r	   r   propertyr   r$   r2   r8   rB   r
   r   r   r   r      s        GG	 	 	 	   X% % % 	 	 X	   X8 8 8 8 8r   r   c                   2     e Zd ZdZe fd            Z xZS )ShouldBeConstantz9some values were different, but should have been the samec                     t                      j        } j        d         dk    s j        |S  j        d         dk    sJ  j        \  }} j        j        |         }t           fd j        j        D                       }d | j        d                  j        j        j	        D             }d | j        d                  j        j        j	        D             }|dd
                    |           d	d
                    |           d
z   S )Nr   z.FeatureCountc              3      K   | ]F}j         d          |v r5|j         d                   j        j        j        j        d         k    B|V  GdS )r&   N)r   tableFeatureListFeatureCountr   )r)   r#   r   s     r   	<genexpr>z+ShouldBeConstant.details.<locals>.<genexpr>V   ss       
 
z"~$$DJrN#)5Bz*%& & & & & &	
 
r   c                     g | ]	}|j         
S r
   
FeatureTagr)   r*   s     r   r+   z,ShouldBeConstant.details.<locals>.<listcomp>^   s*     
 
 
 L
 
 
r   rH   c                     g | ]	}|j         
S r
   rN   rP   s     r   r+   z,ShouldBeConstant.details.<locals>.<listcomp>b   s*     
 
 
 L
 
 
r   z2
Incompatible features between masters.
Expected: z, z.
Got: z.
)superr8   r   r   r2   r   nextrI   rJ   FeatureRecordr<   )	r   basic_messager7   _bad_ttfgood_ttfgood_featuresbad_features	__class__s	   `       r   r8   zShouldBeConstant.detailsL   sH   :a=O++t{/B  z!}//// M+">2 
 
 
 
{'
 
 
 
 

 
djn-3?M
 
 

 
TZ^,2>L
 
 
 1=111 1IIl++1 1 1
 	
r   )r   r   r   r	   rC   r8   __classcell__r[   s   @r   rE   rE   I   sH        CC
 
 
 
 X
 
 
 
 
r   rE   c                   >    e Zd ZdZed             Zed             ZdS )
FoundANonezAone of the values in a list was empty when it shouldn't have beenc                     d | j         d         D                                 d          }||                     |          fS )Nc                     g | ]}|d u S r   r
   rP   s     r   r+   z'FoundANone.offender.<locals>.<listcomp>r   s    666qd666r   r'   Tr/   r   r0   s     r   r2   zFoundANone.offenderp   sC    66DJu$5666<<TBBd''....r   c                 F    | j         | j        }}|d          d|d          dS Nr   r4   r'   r5   r   r   r   r   r   s      r   r8   zFoundANone.detailsu   .    z4:u(..eEl....r   Nr   r   r   r	   rC   r2   r8   r
   r   r   r_   r_   m   sN        KK/ / X/ / / X/ / /r   r_   c                   >    e Zd ZdZed             Zed             ZdS )NotANonezBone of the values in a list was not empty when it should have beenc                     d | j         d         D                                 d          }||                     |          fS )Nc                     g | ]}|d uS r   r
   rP   s     r   r+   z%NotANone.offender.<locals>.<listcomp>   s    :::1$:::r   r'   Tr/   rb   s     r   r2   zNotANone.offender~   sC    ::
5(9:::@@FFd''....r   c                 F    | j         | j        }}|d          d|d          dS rd   re   rf   s      r   r8   zNotANone.details   rg   r   Nrh   r
   r   r   rj   rj   {   sN        LL/ / X/ / / X/ / /r   rj   c                       e Zd ZdZdS )MismatchedTypeszdata had inconsistent typesNr   r
   r   r   ro   ro      s        %%%%r   ro   c                       e Zd ZdZdS )LengthsDifferz*a list of objects had inconsistent lengthsNr   r
   r   r   rq   rq      s        4444r   rq   c                       e Zd ZdZdS )
KeysDifferz$a list of objects had different keysNr   r
   r   r   rs   rs      s        ....r   rs   c                       e Zd ZdZdS )InconsistentGlyphOrderz0the glyph order was inconsistent between mastersNr   r
   r   r   ru   ru      s        ::::r   ru   c                       e Zd ZdZdS )InconsistentExtensionsz6the masters use extension lookups in inconsistent waysNr   r
   r   r   rw   rw      s        @@@@r   rw   c                   :     e Zd ZdZd fd	Zed             Z xZS )UnsupportedFormatz6an OpenType subtable (%s) had a format I didn't expectNc                 ^     t                      j        |fi | | j        s
dg| _        d S d S )Nz.Format)rR   r   r   )r   r   r   r[   s      r   r   zUnsupportedFormat.__init__   sC    **6***z 	%#DJJJ	% 	%r   c                 j    | j         | j        d         z  }d| j        v r|d| j        d         dz  }|S )Nsubtablevaluer-   r.   )r	   r   )r   ss     r   r   zUnsupportedFormat.reason   sD    L4:j11dj  .dj)....Ar   r   )r   r   r   r	   r   rC   r   r\   r]   s   @r   ry   ry      s^        @@% % % % % %
   X    r   ry   c                       e Zd ZdZdS )InconsistentFormatszBan OpenType subtable (%s) had inconsistent formats between mastersNr   r
   r   r   r   r      s        LLLLr   r   c                       e Zd ZdS )VarLibCFFMergeErrorN)r   r   r   r
   r   r   r   r      s        Dr   r   c                       e Zd ZdZd ZdS )VarLibCFFDictMergeErrorz/Raised when a CFF PrivateDict cannot be merged.c                 B    d| d| d}|D ]
}|d| z  }|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   keyr}   values	error_msgregion_values         r   r   z VarLibCFFDictMergeError.__init__   sc    Q Q QQ Q Q 	 # 	/ 	/L....IIL			r   Nr   r   r   r	   r   r
   r   r   r   r      s)        99! ! ! ! !r   r   c                       e Zd ZdZd ZdS )VarLibCFFPointTypeMergeErrorzKRaised when a CFF glyph cannot be merged because of point type differences.c                 :    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 ''r   )r   
point_typept_indexm_indexdefault_type
glyph_namer   s          r   r   z%VarLibCFFPointTypeMergeError.__init__   s^     j    j    8    #         	
 L			r   Nr   r
   r   r   r   r      s)        UU! ! ! ! !r   r   c                       e Zd ZdZd ZdS )VarLibCFFHintTypeMergeErrorzJRaised when a CFF glyph cannot be merged because of hint type differences.c                 :    d| d| d| d| d| d}|f| _         d S )Nr   r   z' at index r   z* differs from the default font hint type 'r   r   )r   	hint_type	cmd_indexr   r   r   r   s          r   r   z$VarLibCFFHintTypeMergeError.__init__   s^     j    i    I    #         	
 L			r   Nr   r
   r   r   r   r      s)        TT! ! ! ! !r   r   c                       e Zd ZdZdS )VariationModelErrorz(Raised when a variation model is faulty.Nr   r
   r   r   r   r      s        2222r   r   )r>   	Exceptionr   r   r   rE   r_   rj   ro   rq   rs   ru   rw   ry   r   r   r   r   r   r   r
   r   r   <module>r      s3   0 0 0 0 0) 0 0 0I I I I IK I I I:8 :8 :8 :8 :8{ :8 :8 :8z!
 !
 !
 !
 !
' !
 !
 !
H/ / / / /! / / // / / / / / / /& & & & && & & &5 5 5 5 5$ 5 5 5/ / / / /! / / /; ; ; ; ;- ; ; ;A A A A A- A A A    (    M M M M M+ M M M	 	 	 	 	+ 	 	 	
! 
! 
! 
! 
!1 
! 
! 
!	! 	! 	! 	! 	!#6 	! 	! 	!	! 	! 	! 	! 	!"5 	! 	! 	!3 3 3 3 3+ 3 3 3 3 3r   