
    g                     f    d dl mZ d dlmZ d dlZ ej                  d      Zd Zd Z	d Z
d Zd	 Zy)
    )otTables)deepcopyNzfontTools.varLib.instancerc                 V   g }| j                   | j                   j                  ng }|D ]E  }|j                  dk7  r y|j                  |j                  |j
                  |j                  f       G t        | j                  j                  g|z         }||v ry|j                  |       y)N   TF)ConditionSetConditionTableFormatappend	AxisIndexFilterRangeMinValueFilterRangeMaxValue	frozensetFeatureTableSubstitutionVersionadd)recseenconditionSetconditionSetscond	recordKeys         ~/home/viktor/gitlab-persoonlijk/factuur-applicatie/venv/lib/python3.12/site-packages/fontTools/varLib/instancer/featureVars.py_featureVariationRecordIsUniquer   	   s    L+.+;+;+G''R   
;;!^^T55t7O7OP	
	
 377??@<OPID    c                     | j                   }| j                  }||kD  s|j                  kD  s|j                  k  ry t	        fd||fD              S )Nc              3   D   K   | ]  }j                  |d         yw)F)extrapolateN)renormalizeValue).0v	axisLimits     r   	<genexpr>z7_limitFeatureVariationConditionRange.<locals>.<genexpr>.   s&      =>	""1%"8s    )r   r   maximumminimumtuple)	conditionr!   minValuemaxValues    `  r   $_limitFeatureVariationConditionRanger)   "   sc    ,,H,,H 	8i'''i''' 	 CKXBV  r   c                    d}d}g }ddl m}  |ddd      }	| j                  ;t        j                         | _        g | j                  _        d| j                  _        t        | j                  j                        D ]+  \  }
}|j                  dk(  r|j                  }||   j                  }|j                  }|j                  }|j                  ||	      }||j                  cxk  r|k  sn d}|j                  |kD  s|j                  |k  rd } n||v s||   |_        t!        ||      }|r2|\  }}||_
        ||_        d}|dk7  s|dk7  s|j#                  |       d } nFt$        j'                  dj)                  |
||j                               d}|j#                  |       . ||r|| j                  _        |sd | _        d}nd}|xr | }|||fS )NTFr   ) NormalizedAxisTripleAndDistancesr   zWCondition table {0} of FeatureVariationRecord {1} has unsupported format ({2}); ignored)fontTools.varLib.instancerr+   r   otr   ConditionCount	enumerater	   r   axisTagr   r   getdefaultr$   r#   r)   r
   logwarningformat)recordrecIdx
axisLimitsfvarAxesaxisIndexMapapplies
shouldKeepnewConditionsr+   default_tripleir&   axisIdxr1   r'   r(   triplenewRanger$   r#   	universals                        r   "_instantiateFeatureVariationRecordrE   3   s    GJMK5b!R@N" oo/-/*-.*!&"5"5"D"DE *,9q ))Gw'//G 44H 44H^^G^<F:(: ~~(FNNX,E $,&&27&;	# @	6R'/$GW4;I14;I1!%J"}2%,,Y7 %)M KK44:F1fiFVFV4W G  +U*,X  Z-:*"&F

 0=0IJ	))r   c                    t        |j                               }|D cg c]  }|j                  |vs|j                   }}|D ci c]  }||j                  |       }}d}t               }	g }
d }t	        | j
                  j                        D ]  \  }}t        |||||      \  }}}|rt        ||	      r|
j                  |       |r|s|j                  j                  dk(  sJ t        |j                        }t        |j                  |j                  j                        D ]{  \  }}t        | j                  j                   |j"                     j$                        |_        t        |j$                        | j                  j                   |j"                     _        } d}|s n |rk|
risgt'        j                         }t'        j(                         |_        g |j(                  _        d|j(                  _        ||_
        |
j                  |       |
r,|
| j
                  _        t/        |
      | j
                  _        y | `d| _        y c c}w c c}w )NFi   Tr   )setpinnedLocationr1   indexr0   FeatureVariationsFeatureVariationRecordrE   r   r
   r   r   r   zipSubstitutionRecordFeatureListFeatureRecordFeatureIndexFeaturer.   r   r   r/   lenFeatureVariationCount)tabler:   r9   
pinnedAxesaxis	axisOrderr1   r;   featureVariationApplieduniqueRecords
newRecordsdefaultsSubstsr@   r7   r<   r=   rD   r3   r   defaultRecords                       r   _instantiateFeatureVariationsr]   z   s,   Z..01J*2U$dll*6TUIUENO'GY__W55OLO#EMJNu66MMN 	6)KAz8\*
&Y 9&-Pf%222::jHHH%f&E&EFN #11//BB! 	 #+%%33C4D4DEMM# MUKKM!!//0@0@AI	 '+# 5: :i113%'__%6"46""145""11?.-(9C68;J5#"i VOs   IIIc                     dD ]q  }|| vst        | |   j                  dd       s"t        j                  d|       t	        | |   j                  | d   j
                  |       | |   j                          s y )N)GPOSGSUBrJ   z+Instantiating FeatureVariations of %s tablefvar)getattrrT   r4   infor]   axesprune_lookups)varfontr9   tableTags      r   instantiateFeatureVariationsrh      s~    $ 
*7"'H##%8$+
 >I%H##WV_%9%9:	
 	'')
*r   )fontTools.ttLib.tablesr   r.   copyr   logging	getLoggerr4   r   r)   rE   r]   rh    r   r   <module>rn      s?    1   g452"D*N6#r*r   