
    h                     f    S SK Jr  S SKJr  S SKr\R                  " S5      rS rS r	S r
S rS	 rg)
    )otTables)deepcopyNzfontTools.varLib.instancerc                 `   / nU R                   b  U R                   R                  O/ nU HG  nUR                  S:w  a    gUR                  UR                  UR
                  UR                  45        MI     [        U R                  R                  /U-   5      nXQ;   a  gUR                  U5        g)N   TF)ConditionSetConditionTableFormatappend	AxisIndexFilterRangeMinValueFilterRangeMaxValue	frozensetFeatureTableSubstitutionVersionadd)recseenconditionSetconditionSetscond	recordKeys         X/var/www/html/env/lib/python3.13/site-packages/fontTools/varLib/instancer/featureVars.py_featureVariationRecordIsUniquer   	   s    L+.+;+;+G''R  ;;!^^T55t7O7OP	
	  377??@<OPI    c                    ^ U R                   nU R                  nX#:  d   UTR                  :  d  UTR                  :  a  g [	        U4S jX#4 5       5      $ )Nc              3   D   >#    U  H  nTR                  US S9v   M     g7f)F)extrapolateN)renormalizeValue).0v	axisLimits     r   	<genexpr>7_limitFeatureVariationConditionRange.<locals>.<genexpr>.   s%      BVQ	""1%"8BVs    )r   r   maximumminimumtuple)	conditionr!   minValuemaxValues    `  r   $_limitFeatureVariationConditionRanger*   "   s_    ,,H,,H 	i'''i''' 	 CKBV  r   c                    SnSn/ nSSK Jn  U" SSS5      n	U R                  c<  [        R                  " 5       U l        / U R                  l        SU R                  l        [        U R                  R                  5       GH7  u  pUR                  S:X  a  UR                  nX<   R                  nUR                  nUR                  nUR                  X5      nUUR                  s=::  a  U::  d  O  SnUR                  U:  d  UR                  U:  a  S n  OX;   aV  XM   Ul        [!        UU5      nU(       a6  Uu  nnUUl
        UUl        SnUS:w  d  US:w  a  UR#                  U5        M  M  S n  OIM  [$        R'                  SR)                  XUR                  5      5        SnUR#                  U5        GM:     Ub(  U(       a!  XpR                  l        U(       d  S U l        SnOSnU=(       a    U(       + nXVU4$ )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'   axisIdxr2   r(   r)   triplenewRanger%   r$   	universals                        r   "_instantiateFeatureVariationRecordrF   3   s    GJMK5b!R@N" oo/-/*-.*!&"5"5"D"DEq ))G'//G 44H 44H^^G<F:(: ~~(FNNX,E $&&2&;	# @	6R'/$GW4;I14;I1!%J"}2%,,Y7 )6 %)M# '( KK44:F1iFVFV4W G  +U FX  Z-:*"&F

 0=0I	))r   c                 $   [        UR                  5       5      nU Vs/ s H   oDR                  U;  d  M  UR                  PM"     nnU Vs0 s H  ofUR                  U5      _M     nnSn[        5       n	/ n
S n[	        U R
                  R                  5       GH2  u  p[        XX!U5      u  pnU(       a!  [        X5      (       a  U
R                  U5        U(       a  U(       d  UR                  R                  S:X  d   e[        UR                  5      n[        UR                  UR                  R                  5       H|  u  nn[        U R                  R                   UR"                     R$                  5      Ul        [        UR$                  5      U R                  R                   UR"                     l        M~     SnU(       d  GM3    O   U(       aw  U
(       ap  W(       di  [&        R                  " 5       n[&        R(                  " 5       Ul        / UR(                  l        SUR(                  l        UUl
        U
R                  U5        U
(       a+  XR
                  l        [/        U
5      U R
                  l        g U ?SU l        g s  snf s  snf )NFi   Tr   )setpinnedLocationr2   indexr1   FeatureVariationsFeatureVariationRecordrF   r   r
   r   r   r   zipSubstitutionRecordFeatureListFeatureRecordFeatureIndexFeaturer/   r   r   r0   lenFeatureVariationCount)tabler;   r:   
pinnedAxesaxis	axisOrderr2   r<   featureVariationApplieduniqueRecords
newRecordsdefaultsSubstsrA   r8   r=   r>   rE   r4   r   defaultRecords                       r   _instantiateFeatureVariationsr^   z   s   Z..01J*2U($ll*6T(IUENOY'Y__W55YLO#EMJNu66MMN	)Kz\*
&Y 9&P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! '+# 95 O: :i113%'__%6"46""145""11?.-(9C68;J5#"i VOs   JJJc                     S Hv  nX ;  d  [        X   R                  SS 5      (       d  M(  [        R                  SU5        [	        X   R                  U S   R
                  U5        X   R                  5         Mx     g )N)GPOSGSUBrK   z+Instantiating FeatureVariations of %s tablefvar)getattrrU   r5   infor^   axesprune_lookups)varfontr:   tableTags      r   instantiateFeatureVariationsri      sv    $"'##%8$+
 +
 >I%##WV_%9%9:	
 	'') %r   )fontTools.ttLib.tablesr   r/   copyr   logging	getLoggerr5   r   r*   rF   r^   ri    r   r   <module>ro      s=    1   452"D*N6#r*r   