
    <`                        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dS )#    Nc                       e Zd ZdZdS )VarLibErrorz%Base exception for the varLib module.N__name__
__module____qualname____doc__     7lib/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 rp|d                             d          rU|d                             d          r:|d                             d          dz   |d                             d          z   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ttfs      r   _master_namezVarLibMergeError._master_name   s    ;"+"2&C#K,,Q// K,,Q//  6{//22S83v;;S;STU;V;VVVV,, ,&1Q1Q ,z++$$$$r   c                      d j         v rLd j         v rC fd j         d         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)NN)r   indexr'   )r   r/   s   ` r   offenderzVarLibMergeError.offender+   so    ##(;(;LLLL$*U:KLLLRR E $++E2222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   r0   r   )r   offender_indexr0   r*   s       r   detailszVarLibMergeError.details4   sl    ##(;(;'+}$NH*U#N3Cddjmddtz*7Mdd]`ddddrr   c                     | j         \  }}d}|rd| d}d                    t          | j                            }t	          j        d| j         d| d          }d|z   |z   | j        z   S )	Nr4   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

)r0   joinreversedr   textwrapfillr   r6   )r   r5   r0   location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'   r0   r6   rA   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                    | j         d         dk    s| j        t                      j        S | j        \  }}| j        j        |         }| j        j        |dz
           }d || j         d                  j        j        j        D             }d || j         d                  j        j        j        D             }dd	                    |           d	d	                    |           d
S )Nr   z.FeatureCountr   c                     g | ]	}|j         
S r
   
FeatureTagr,   r-   s     r   r.   z,ShouldBeConstant.details.<locals>.<listcomp>U   s*     
 
 
 L
 
 
r   c                     g | ]	}|j         
S r
   rG   rI   s     r   r.   z,ShouldBeConstant.details.<locals>.<listcomp>Y   s*     
 
 
 L
 
 
r   z2
Incompatible features between masters.
Expected: z, z.
Got: z.
)
r   r   superr6   r0   r!   tableFeatureListFeatureRecordr:   )r   r5   r0   bad_ttfgood_ttfgood_featuresbad_features	__class__s          r   r6   zShouldBeConstant.detailsM   s    :a=O++t{/B77?"#'= +">2;#NQ$67
 
djn-3?M
 
 

 
TZ^,2>L
 
 

1=111 1IIl++1 1 1	
r   )r   r   r   r	   rB   r6   __classcell__)rT   s   @r   rD   rD   J   sH        CC
 
 
 
 X
 
 
 
 
r   rD   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                     | j         d         }d |d         D                                 d          }||                     |          fS )Nr   c                     g | ]}|d u S r   r
   rI   s     r   r.   z'FoundANone.offender.<locals>.<listcomp>j   s    111qd111r   r*   T)argvr/   r'   )r   r   r/   s      r   r0   zFoundANone.offenderg   sK    	!11E%L11177==d''....r   c                 b    | j         d         | j         dd          }}|d          d|d          dS )Nr   r   r2   r*   r3   argsr   r   r   s      r   r6   zFoundANone.detailsm   s:    y|TYqrr]u(..eEl....r   N)r   r   r   r	   rB   r0   r6   r
   r   r   rW   rW   d   sN        KK/ / X/
 / / X/ / /r   rW   c                       e Zd ZdZdS )MismatchedTypeszdata had inconsistent typesNr   r
   r   r   r`   r`   s   s        %%%%r   r`   c                       e Zd ZdZdS )LengthsDifferz*a list of objects had inconsistent lengthsNr   r
   r   r   rb   rb   w   s        4444r   rb   c                       e Zd ZdZdS )
KeysDifferz$a list of objects had different keysNr   r
   r   r   rd   rd   {   s        ....r   rd   c                       e Zd ZdZdS )InconsistentGlyphOrderz0the glyph order was inconsistent between mastersNr   r
   r   r   rf   rf      s        ::::r   rf   c                       e Zd ZdZdS )InconsistentExtensionsz6the masters use extension lookups in inconsistent waysNr   r
   r   r   rh   rh      s        @@@@r   rh   c                   (    e Zd ZdZed             ZdS )UnsupportedFormatz6an OpenType subtable (%s) had a format I didn't expectc                 Z    | j         d         | j         dd          }}| j        |d         z  S )Nr   r   subtable)r]   r	   r^   s      r   r   zUnsupportedFormat.reason   s-    y|TYqrr]u|eJ///r   N)r   r   r   r	   rB   r   r
   r   r   rj   rj      s3        @@0 0 X0 0 0r   rj   c                       e Zd ZdZdS )rj   zBan OpenType subtable (%s) had inconsistent formats between mastersNr   r
   r   r   rj   rj      s        LLLLr   c                       e Zd ZdS )VarLibCFFMergeErrorN)r   r   r   r
   r   r   ro   ro      s        Dr   ro   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
	r\   )r   keyvalue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   rq   rq      s)        99! ! ! ! !r   rq   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_namerv   s          r   r   z%VarLibCFFPointTypeMergeError.__init__   s^     j    j    8    #         	
 L			r   Nrx   r
   r   r   rz   rz      s)        UU! ! ! ! !r   rz   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   rv   s          r   r   z$VarLibCFFHintTypeMergeError.__init__   s^     j    i    I    #         	
 L			r   Nrx   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   rD   rW   r`   rb   rd   rf   rh   rj   ro   rq   rz   r   r   r
   r   r   <module>r      s   0 0 0 0 0) 0 0 0I I I I IK I I I;8 ;8 ;8 ;8 ;8{ ;8 ;8 ;8|
 
 
 
 
' 
 
 
4/ / / / /! / / /& & & & && & & &5 5 5 5 5$ 5 5 5/ / / / /! / / /; ; ; ; ;- ; ; ;A A A A A- A A A0 0 0 0 0( 0 0 0M M M M M) M M M	 	 	 	 	+ 	 	 	
! 
! 
! 
! 
!1 
! 
! 
!	! 	! 	! 	! 	!#6 	! 	! 	!	! 	! 	! 	! 	!"5 	! 	! 	!3 3 3 3 3+ 3 3 3 3 3r   