
    +g                        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y)&    Nc                       e Zd ZdZy)VarLibErrorz%Base exception for the varLib module.N__name__
__module____qualname____doc__     o/home/viktor/gitlab-persoonlijk/factuur-applicatie/venv/lib/python3.12/site-packages/fontTools/varLib/errors.pyr   r      s    /r   r   c                       e Zd ZdZy)VarLibValidationErrorz>Raised when input data is invalid from varLib's point of view.Nr   r
   r   r   r   r      s    Hr   r   c                   T    e Zd ZdZd	dZed        Zd Zed        Zed        Z	d Z
y)
VarLibMergeErrorz=Raised when input data cannot be merged into a variable font.Nc                 h    || _         |si }d|v r|d   | _        |d= || _        y g | _        || _        y )Nstack)mergerr   cause)selfr   kwargss      r   __init__zVarLibMergeError.__init__   sD    FfDJw 
 DJ
r   c                     | j                   S N)r	   )r   s    r   reasonzVarLibMergeError.reason   s    ||r   c                 V   | j                   | j                   j                  |   }d|v r&|d   j                         r|d   j                         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V,&1Qzz+++t$$r   c                 .   d| j                   v rd| j                   v rt| j                   d   D cg c]  }|| j                   d   k(   c}j                  d      }| j                  |      }d| j                   v r| d| j                   d    d}||fS yc c}w )NexpectedgotFlocation ())NNr   indexr$   )r   xr,   master_names       r   offenderzVarLibMergeError.offender'   s    #(;:>**U:KLQQ$**Z00LRRE ++E2KTZZ'!,R

:0F/GqI+%% Ms   Bc                     d| j                   v rUd| j                   v rG| j                  \  }}| j                   d   |   }d| j                  d    d| j                   d   d|dS y)	Nr&   r'   zExpected to see r   ==z, instead saw 
 )r   r/   r   )r   offender_indexr/   r'   s       r   detailszVarLibMergeError.details3   sn    #(;'+}}$NH**U#N3C%djjm_Btzz*7M6PP^_b^eeghhr   c                     | j                   \  }}d}|rd| d}dj                  t        | j                              }t	        j
                  d| j                   d| d      }d|z   |z   | j                  z   S )	Nr3   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   r5   )r   r4   r/   r(   contextbasics         r   __str__zVarLibMergeError.__str__;   s    #'== <XJcJH''(4::./0 >GGNiQ

 ~(4<<77r   r   )r   r   r   r	   r   propertyr   r$   r/   r5   r?   r
   r   r   r   r      sP    G	  % 	 	  8r   r   c                   ,     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                  d   dk7  s j                  |S  j                  d   dk(  sJ  j                  \  }} j                  j
                  |   }t         fd j                  j
                  D              }| j                  d      j                  j                  j                  D cg c]  }|j                   }}| j                  d      j                  j                  j                  D cg c]  }|j                   }}|ddj                  |       ddj                  |       dz   S c c}w c c}w )	Nr   z.FeatureCountc              3      K   | ]W  }j                   d    |v rD|j                   d       j                  j                  j                  j                  d   k(  r| Y yw)r&   N)r   tableFeatureListFeatureCountr   ).0r#   r   s     r   	<genexpr>z+ShouldBeConstant.details.<locals>.<genexpr>V   s\      
zz"~$DJJrN#))55BBzz*%& 
s   AA rE   z2
Incompatible features between masters.
Expected: z, z.
Got: z.
)superr5   r   r   r/   r   nextrF   rG   FeatureRecord
FeatureTagr9   )
r   basic_messager4   _bad_ttfgood_ttfr-   good_featuresbad_features	__class__s
   `        r   r5   zShouldBeConstant.detailsL   sP   ::a=O+t{{/B  zz!}/// MM++"">2 
{{''
 
 djjn-33??MM
 LL
 
 TZZ^,22>>LL
 LL
 
 =12 3IIl+,C1
 	


s   E	
E)r   r   r   r	   r@   r5   __classcell__rU   s   @r   rB   rB   I   s    C
 
r   rB   c                   0    e Zd ZdZed        Zed        Zy)
FoundANonezAone of the values in a list was empty when it shouldn't have beenc                     | j                   d   D cg c]  }|d u  c}j                  d      }|| j                  |      fS c c}w Nr'   Tr+   r   r-   r,   s      r   r/   zFoundANone.offenderp   sE    $(JJu$56qd6<<TBd''... 7   Ac                 N    | j                   | j                  }}|d    d|d    dS Nr   r1   r'   r2   r   r   r   r   r   s      r   r5   zFoundANone.detailsu   .    zz4::u(2eEl^2..r   Nr   r   r   r	   r@   r/   r5   r
   r   r   rY   rY   m   s+    K/ / / /r   rY   c                   0    e Zd ZdZed        Zed        Zy)NotANonezBone of the values in a list was not empty when it should have beenc                     | j                   d   D cg c]  }|d u c}j                  d      }|| j                  |      fS c c}w r[   r+   r\   s      r   r/   zNotANone.offender~   sE    (,

5(9:1$:@@Fd''... ;r]   c                 N    | j                   | j                  }}|d    d|d    dS r_   r`   ra   s      r   r5   zNotANone.details   rb   r   Nrc   r
   r   r   re   re   {   s+    L/ / / /r   re   c                       e Zd ZdZy)MismatchedTypeszdata had inconsistent typesNr   r
   r   r   ri   ri      s    %r   ri   c                       e Zd ZdZy)LengthsDifferz*a list of objects had inconsistent lengthsNr   r
   r   r   rk   rk      s    4r   rk   c                       e Zd ZdZy)
KeysDifferz$a list of objects had different keysNr   r
   r   r   rm   rm      s    .r   rm   c                       e Zd ZdZy)InconsistentGlyphOrderz0the glyph order was inconsistent between mastersNr   r
   r   r   ro   ro      s    :r   ro   c                       e Zd ZdZy)InconsistentExtensionsz6the masters use extension lookups in inconsistent waysNr   r
   r   r   rq   rq      s    @r   rq   c                   4     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 expectc                 P    t        |   |fi | | j                  s	dg| _        y y )Nz.Format)rK   r   r   )r   r   r   rU   s      r   r   zUnsupportedFormat.__init__   s*    *6*zz#DJ r   c                     | 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   sG    LL4::j11djj 2djj),A..Ar   r   )r   r   r   r	   r   r@   r   rV   rW   s   @r   rs   rs      s    @%
  r   rs   c                       e Zd ZdZy)InconsistentFormatszBan OpenType subtable (%s) had inconsistent formats between mastersNr   r
   r   r   rz   rz      s    Lr   rz   c                       e Zd Zy)VarLibCFFMergeErrorN)r   r   r   r
   r   r   r|   r|      s    r   r|   c                       e Zd ZdZd Zy)VarLibCFFDictMergeErrorz/Raised when a CFF PrivateDict cannot be merged.c                 D    d| d| d}|D ]
  }|d| z  } |f| _         y )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   keyrw   values	error_msgregion_values         r   r   z VarLibCFFDictMergeError.__init__   sL    ( .'OQ 	 # 	/L4~..I	/L	r   Nr   r   r   r	   r   r
   r   r   r~   r~      s
    9!r   r~   c                       e Zd ZdZd Zy)VarLibCFFPointTypeMergeErrorzKRaised when a CFF glyph cannot be merged because of point type differences.c                 8    d| d| d| d| d| d}|f| _         y )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__   sB    j\j\1B8* M#9 %~Q  	
 L	r   Nr   r
   r   r   r   r      s
    U!r   r   c                       e Zd ZdZd Zy)VarLibCFFHintTypeMergeErrorzJRaised when a CFF glyph cannot be merged because of hint type differences.c                 8    d| d| d| d| d| d}|f| _         y )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__   sA    j\i[I; G#9 %~Q  	
 L	r   Nr   r
   r   r   r   r      s
    T!r   r   c                       e Zd ZdZy)VariationModelErrorz(Raised when a variation model is faulty.Nr   r
   r   r   r   r      s    2r   r   )r;   	Exceptionr   r   r   rB   rY   re   ri   rk   rm   ro   rq   rs   rz   r|   r~   r   r   r   r
   r   r   <module>r      s    0) 0IK I:8{ :8z!
' !
H/! // /&& &5$ 5/! /;- ;A- A(  M+ M	+ 	
!1 
!	!#6 	!	!"5 	!3+ 3r   