+
    K<i                     	   R t ^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHtHtHt ^ RIHtH t H!t!H"t"H#t# ^ RI$H%t% ^ RI&H't' ^ RI(H)t) ^ RI*H+t+H,t, ]PZ                  ! R4      t.^RI/H0t0H1t1H2t2H3t3H4t4H5t5H6t6H7t7H8t8H9t9H:t:  ! R R];4      t< ! R R]<4      t=]=P}                  ]P~                  R4      R 4       t@R tAROR ltB]=P}                  ]P                  4      R 4       t@]=P}                  ]P                  4      R 4       t@R tER tF]=P}                  ]P                  4      R  4       t@]=P}                  ]P                  4      R! 4       t@R" tIRPR# ltJRPR$ ltKRQR% ltLR& tM]=P}                  ]P                  4      R' 4       t@RRR( ltO]=P}                  ]P                  4      R) 4       t@]=P}                  ]P                  4      R* 4       t@R+ tRR, tSR- tTR. tUR/ tV]=P}                  ]P                  4      R0 4       t@]=P}                  ]P                  4      R1 4       t@]=P}                  ]P                  4      R2 4       t@ ! R3 R4]=4      tZ]ZP}                  ]P                  4      R5 4       t@]ZP}                  ]P                  4      R6 4       t@]ZP}                  ]P                  4      R7 4       t@ ! R8 R9]=4      t\]\P}                  ]P                  4      R: 4       t@]\P}                  ]P                  4      R; 4       t@]\P}                  ]P                  4      R< 4       t@ ! R= R>]=4      t]R? t^]]P}                  ]P                  4      R@ 4       t@]]P}                  ]P                  4      RA 4       t@]]P}                  ]P                  4      RB 4       t@]]P}                  ]P                  4      RC 4       t@ ! RD RE]]4      t`]`P}                  ]P                  4      RF 4       t@]`P}                  ]P                  4      RG 4       t@RH tcRI td]`P}                  ]P                  ]P                  34      RJ 4       t@]`P}                  ]P                  ]P                  34      RK 4       t@]`P}                  ]P                  4      RL 4       t@]`P}                  ]P                  RM4      RN 4       t@R# )Sz4
Merge OpenType Layout tables (GDEF / GPOS / GSUB).
N)ior)MAX_PAINT_COLR_LAYER_COUNTLayerReuseCache)classifyTools)otRound)build_n_ary_tree)otTables)otBase)BaseFixedValue)dfs_base_table)DefaultTable)buildermodelsvarStore)nonNoneallNoneallEqual
allEqualTosubList)VarStoreInstancer)reduce)buildSinglePos)_compression_level_from_envcompact_pair_poszfontTools.varLib.merger)ShouldBeConstant
FoundANoneMismatchedTypesNotANoneLengthsDiffer
KeysDifferInconsistentGlyphOrderInconsistentExtensionsInconsistentFormatsUnsupportedFormatVarLibMergeErrorc                   p   a  ] tR t^.t o R
R lt]RR l4       t]/ 3R l4       tRR ltR t	R t
R tR	tV tR# )MergerNc                     Wn         R V n        R # Nfontttfs)selfr*   s   &&9/usr/lib/python3/dist-packages/fontTools/varLib/merger.py__init__Merger.__init__/   s    		    c                   a aa S \         8w  g   Q R 4       hRS P                  9  d   / S n        \        S4      \        \        P
                  39   d   S3o\        S4      \        8X  d   S3oVV V3R lpV# )zSubclass Merger instead.mergersc                   < V P                   R 8X  g   Q h. pS Fe  pW!9   d   K  VP                  V4       SP                  P                  V/ 4      pS F'  pWC9  g   Q RVP                   : RV: R24       hWV&   K)  	  Kg  	  R# )mergezOops, class 'z' has merge function for 'z' defined already.N)__name__appendr2   
setdefault)methoddoneclazzr2   attrattrscelfclazzess   &    r-   wrapperMerger.merger.<locals>.wrapper>   s    ??g---D =E",,11%<!D.  >>41. %+DM " ! r0   )r&   __dict__r2   typeenumEnumMetastr)r=   r>   r<   r?   s   fff r-   mergerMerger.merger4   sc    v~999~DMM)DL=T4==11jG;#HE	  r0   c                    \        V4      pV P                  4        F;  p \        V R R4      pVf    V# V P                  P	                  VR4      pVf   K9  Vu # 	  V# )r2   N)rB   mrogetattrr2   get)r=   thing_defaulttypr2   ms   &&&   r-   
mergersForMerger.mergersForP   sa    5kHHJDdIt4G 	   d+A}  r0   c                ~  a \        VR 4      '       d   VP                  RR7       V F)  p\        VR 4      '       g   K  VP                  RR7       K+  	  \        \        V4      P	                  4       4      o\
        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       g?   \        T SV Uu. uF%  p\        \        V4      P	                  4       4      NK'  	  upR7      hV P                  V4      pVP                  RV P                  P                  4      p S FJ  pW9   d   K  \        W4      p	V U
u. uF  p
\        W4      NK  	  pp
VP                  W4      pV! W	V4       KL  	  R# u upi u up
i   \         d)   pTP                  P                  RX,           4       h Rp?ii ; i)	ensureDecompiledF)recursec              3   n   <"   T F*  pS\        \        V4      P                  4       4      8H  x  K,  	  R # 5ir(   )sortedvarskeys).0vrX   s   & r-   	<genexpr>&Merger.mergeObjects.<locals>.<genexpr>f   s%     ?3a46$q',,.113s   25Texpectedgot*.N)hasattrrS   rV   rW   rX   allr   rP   rK   	__class__mergeThingsrJ   r$   stackr6   )r,   outlstexcludeitemrZ   r2   defaultMergerkeyvaluetablevalues
mergerFuncerX   s   &&&&          @r-   mergeObjectsMerger.mergeObjects_   sf   3*++   /Dt/00%%e%4  d3inn&'s?3?sss?3???t#)N#Q&a*@#)N  //#&C)C)CD
	>);>?3%'%-3?$[[<
4/  *O @   	GGNN39%	s0   +E?-F	 	F F	 F	 	F<#F77F<c           
     |   \        W\        4      '       g1   \        T \        V4      V Uu. uF  p\        V4      NK  	  upR 7      h\        \	        V\	        V!  4      4       F  w  pw  rV V P                  WV4       K  	  R# u upi   \         d)   pTP                  P                  RT,          4       h Rp?ii ; i)r]   z[%d]N)	r   lenr   	enumeratezipre   r$   rf   r6   )r,   rg   rh   xirm   ro   rq   s   &&&     r-   
mergeListsMerger.mergeListsx   s    #C((s3xc=Rcc!fc=RSS"+CS#Y,?"@A  / #A >S $ vz*s   B,BB;#B66B;c           
     |   \        W\        4      '       gE   \        T \        V4      P                  V Uu. uF  p\        V4      P                  NK  	  upR 7      hV P	                  V4      P                  RR4      pVe   V! WV4       R# \        V\        P                  4      '       d!   \        W4      '       g   \        WVR 7      hR# \        VR4      '       d   V P                  W4       R# \        V\        4      '       d   V P                  W4       R# \        W4      '       g   \        WVR 7      hR# u upi )r]   NrA   )r   rB   r   r5   rP   rK   
isinstancerC   Enumr   rb   rr   listrz   )r,   rg   rh   rx   rp   s   &&&  r-   re   Merger.mergeThings   s    #D))!tCy11RU7VRUQQ8H8HRU7V  __S)--dD9
!t#&TYY'' c''&tsCC (S*%%c'T""OOC%c''&tsCC ( 8Ws   D9c           
     
   V FH  pWA9  d   K   W n         T P                  W,          V Uu. uF  qUP                  V4      NK  	  up4       KJ  	  R # u upi   \         d"   pTP                  P                  T4       h R p?ii ; ir(   )r+   re   rK   r$   rf   r6   )r,   r*   master_ttfs	tableTagstagrO   rq   s   &&&&   r-   mergeTablesMerger.mergeTables   sn    C'	  ,MAUU3Z,MN 
 -N# s#s(   AAAAB!A==Br)   r(   )r(   ) )r5   
__module____qualname____firstlineno__r.   classmethodrF   rP   rr   rz   re   r   __static_attributes____classdictcell____classdict__s   @r-   r&   r&   .   sO     
  6 )+  2D*	 	r0   r&   c                       ] tR t^tRtR# )AligningMergerr   N)r5   r   r   r   r   r   r0   r-   r   r      s    r0   r   GlyphClassDefc                   a Vf"   \        V4      '       g   \        V R VR7      hR # V Uu. uF  q3P                  NK  	  pp/ Vn        VP                  p\        4       pVP                  ! V Uu. uF  q3P                  4       NK  	  up!   V Fa  o\        V3R lV 4       4      p\        V4      '       g   \        W^ ,          VRS,           .R7      hV'       g   R VS&   KU  V^ ,          VS&   Kc  	  R # u upi u upi )Nr]   c              3   D   <"   T F  qP                  S4      x  K  	  R # 5ir(   )rK   )rY   lks   & r-   r[   merge.<locals>.<genexpr>   s     2cEE!HHc    ra   )r^   r_   rf   )	r   r   	classDefssetupdaterX   r   r   r   )rF   r,   rh   r   allKeys	allValuesr   s   &&&   @r-   r4   r4      s    |s||6Dc:: #
$1;;C
$DN>>DeGNNs+s!VVXs+,2c22		"""13sQwi  DGlDG  % ,s   C4.C9c                 N   V P                   ^8X  d   V # \        P                  ! 4       p^Vn         V P                  Vn        V P                  Vn        VP                  P
                   Uu. uF  q P                  NK  	  upVn        \        VP                  4      Vn        V# u upi )   )	Formatot	SinglePosCoverageValueFormatglyphsValueru   
ValueCount)r,   ret_s   &  r-   _SinglePosUpgradeToFormat2r      sz    {{a
,,.CCJ==CL&&CO%(\\%8%89%8%89CI^CNJ :s   *B"c                0  a Vf   V Uu. uF  p\        V4      NK  	  ppM?\        W4       UUUUu. uF$  w  rF\        WF4       UUu/ uF  w  rxWxbK	  	  uppNK&  	  ppppp\        4       p	V	P                  ! V!   V P                  4       P                  o\        V	SR7      p
\        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       g   \        4       h?	RpVf/   V UUu. uF  pV
 Uu. uF  qV9   d   TMTNK  	  upNK  	  pppW3# \        V4      \        V4      8X  g   Q hV UUu. uF#  pV
 Uu. uF  qV9   d	   W,          MTNK  	  upNK%  	  pppW3# u upi u uppi u uppppi u upi u uppi u upi u uppi )a<  Takes font and list of glyph lists (must be sorted by glyph id), and returns
two things:
- Combined glyph list,
- If values_lst is None, return input glyph lists, but padded with None when a glyph
  was missing in a list.  Otherwise, return values_lst list-of-list, padded with None
  to match combined glyph lists.
Nrl   c              3   D   <"   T F  p\        VSR 7      V8H  x  K  	  R# 5i)r   N)rV   )rY   vssortKeys   & r-   r[   %_merge_GlyphOrders.<locals>.<genexpr>   s     ;svbg&",sr   FT)	r   rw   r   getReverseGlyphMap__getitem__rV   rc   r    ru   )r*   rh   
values_lstdefaultr   	dict_setsr   grZ   combinedorderpaddedValuesdict_setglyphpaddedr   s   &&&&           @r-   _merge_GlyphOrdersr      s    %()SSVS	)	@CC@TU@Tuqs1z2ztqadz2@T	UuHOOY%%'33G8)E3;s;333;s;;;$&&L &
% CHH%x'UW4%H% 	 
 = 3x3z?*** &
% MRRE5 1X_w>ER% 	 
 =3 *2U I
 S
sL   E/E:
E4E:
7	F FF 	F	F"F4E:
FFc                 t    V^ ,          P                   P                  4       Vn         V P                  W4       R#     NrA   copyrr   rF   r,   rh   s   &&&r-   r4   r4      *     FOO((*DM
"r0   c                 t    V^ ,          P                   P                  4       Vn         V P                  W4       R# r   r   r   s   &&&r-   r4   r4      r   r0   c                    V F  pVeG   \        V4      \        P                  8w  g)   VP                  e   W#P                  P                  9  d   KO  VP
                  ^8X  d   VP                  u # VP
                  ^8X  d9   VP                  VP                  P                  P                  V4      ,          u # \        V RR7      h	  R # )Nsingle positioning lookupsubtable)	rB   r   r   r   r   r   r   indexr#   )rF   	subtablesr   r,   s   &&& r-   %_Lookup_SinglePos_get_effective_valuer     s    LDzR\\)}}$MM000;;!::[[A::dmm2288?@@#F5PQQ  r0   c                    V EFR  pVeG   \        V4      \        P                  8w  g)   VP                  e   W$P                  P                  9  d   KP  VP
                  ^8X  de   VP                  VP                  P                  P                  V4      ,          pVP                  pV F  pVP                  V8X  g   K  Vu u # 	  K  VP
                  ^8X  ds   VP                  P                  P                  V^ 4      pVP                  P                  P                  V^ 4      p	VP                  V,          P                  V	,          u # \!        V RR7      h	  R # )Npair positioning lookupr   )rB   r   PairPosr   r   r   PairSetr   PairValueRecordSecondGlyph	ClassDef1r   rK   	ClassDef2Class1RecordClass2Recordr#   )
rF   r   
firstGlyphsecondGlyphr,   pspvrrecklass1klass2s
   &&&&      r-   (_Lookup_PairPos_get_effective_value_pairr     s    LDzRZZ'}}$!5!55;;!dmm2288DEB$$C??k1J  [[A^^--11*a@F^^--11+qAF$$V,99&AA#F5NOO) * r0   c                   a \        \        P                  V Uu. uF  q3P                  NK  	  up^ 4      ;Vn        p\	        V4      ^8X  g   VR	,          ^ 8X  g   \        V RR7      hVP                  P                  o\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   \        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       d   \        P                  ! WAP                  4      Vn        V^ 8w  dY   T P                  VP                  V Uu. uF1  qUP                  e   VP                  M\        P                  ! 4       NK3  	  up4       VP                  P                  4       Vn        R# ^Vn        V Uu. uF  p\        V4      NK  	  pp\!        V P"                  V Uu. uF  qUP                  P                  NK  	  upV Uu. uF  qUP                  NK  	  up4      w  rgWaP                  n        V Uu. uF  p\        P                  ! V4      NK  	  upVn        \	        VP                  4      Vn        \'        V4       F`  w  r\'        V4       FL  w  rW,          e   K  \)        W P*                  V	,          V4      pVf   \        P                  ! V4      pWZV&   KN  	  Kb  	  V P-                  VP                  V4       V P/                  WR
R7       \        \        P                  VP                   Uu. uF  qUP1                  4       NK  	  up^ 4      Vn        R# u upi u upi u upi u upi u upi u upi u upi )r   r   r   c              3   >   "   T F  qP                   ^8H  x  K  	  R# 5i   Nr   rY   rZ   s   & r-   r[   r   <  s     
&#Q88q=#s   FTc              3   V   <"   T F  pSVP                   P                  8H  x  K   	  R # 5ir(   )r   r   )rY   rZ   coverageGlyphss   & r-   r[   r   <  s#      /58!**+++Ss   &)Nri   i)r   r   r   r   r   )r   int__or__r   ru   r#   r   r   rc   r	   ValueRecordr   re   	getFormatr   r   r   r*   r   rv   r   lookup_subtablesrz   rr   getEffectiveFormat)rF   r,   rh   r   valueFormatrZ   r   r   r   ry   ro   jr   r   s   &&&          @r-   r4   r4   4  s   %+CJJPS8TPS1PS8TVW%XXD{HMkD0A51LMM ]]))N
s
&#
&sss
&#
&&&33 /58/333 /58/ , , ''ZZ@
! 

SVWSVaGG/V5G5G5IISVW  :://1 DK25
6#Q%a(#C
6 (5Ajj''57MA7MNF "MM;AB6a&$$[16BDJ$**oDOv&	!&)HAy$
 6//2EA y&&{31I * ' djj&) W   

TZZ@Z))+Z@!Do 9U  X 7 67M C2 As)   M
>7M
(MM
6M#'M((M-
c                    \        V P                  V UUu. uF'  q3P                   Uu. uF  qDP                  NK  	  upNK)  	  uppV Uu. uF  q3P                  NK  	  up4      w  rV. ;Vn        pV F  p\        P                  ! 4       p	Wn        V P
                  '       d!   \        P                  ! V P
                  4      MR V	n        V P                  '       d!   \        P                  ! V P                  4      MR V	n
        VP                  V	4       K  	  \        VP                  4      Vn        \        V4       EF  w  r\        V4       F  w  r\        P                  ! 4       pWn        W,          e
   W,          pM(\        W P                   V
,          VP"                  V4      pVf   R R rM\%        VRR 4      p\%        VRR 4      pV P
                  '       d#   \        P                  ! V P
                  VR7      MR Vn        V P                  '       d#   \        P                  ! V P                  VR7      MR Vn
        WKV&   K  	  EK  	  V=V P'                  VP                  V4       R # u upi u uppi u upi )NValue1Value2)src)r   r*   r   r   r   valueFormat1r	   r   r   valueFormat2r   r6   ru   PairValueCountrv   r   r   _firstGlyphrJ   rz   )rF   r,   rh   r   rZ   r   r   pvrsr   r   ry   ro   r   vpairv1v2s   &&&             r-   r4   r4   r  s    (?BCs!3!3	4!3A--!3	4sC&)*c		c*NF #%$D4  "7=7J7J7JFv223PT 	
 8>7J7J7JFv223PT 	
 	C  d223Dv&	!&)HA""$A!My$	@33A68H8H% }tBUHd3UHd3 &&& ""6#6#6B? H &&& ""6#6#6B? H
 1I3 * '6 	
d**F3] 
5C*s   I2I-I2
I8-I2c                    \        V Uu. uF%  q3P                  '       g   K  VP                  ^ 8H  NK'  	  up4      '       g   Q R4       hVP                  V VRR7       \        P                  ! 4       p. Vn        ^ Vn        \        VP                  V Uu. uF  qUP                  P                  NK  	  upV Uu. uF  qUP                  NK  	  upVR7      w  rgW`P                  n
        V Uu. uF  p\        P                  ! 4       NK  	  upV n        \        V P                  4      V n        \        W`P                  4       F  w  rWn        K  	  VP                  V P                  V4       R# u upi u upi u upi u upi )r   Report bug against fonttools.r   r   N)r   r   PairSetCountValueFormat1ValueFormat2)r   r   r  rr   r   r   r   r   r*   r   r   ru   r   rw   r   rz   )r,   rh   rF   r   emptyrZ   r   r   r   r   r   s   &&&        r-   _PairPosFormat1_merger    s?   &)7cYY	1	c7  '&' 
 W   JJLEEE ($'(Cq		C( CqC 	NF "MM*01&QBJJL&1DLDLL)D.	 / dllF+9 	8" 	) 
 2s   E-E-E2
8E7+E<c                 0   \        V \        4      '       d   T pM(V '       d   V P                  '       d   V P                  M/ pV'       d   \        VP	                  4       4      M^ p. p\        V^,           4       F  pVP                  \        4       4       K  	  VP                  4        F  w  rgWG,          P                  V4       K  	  Vf   RV^ &   V# \        V4      ;V^ &   pVR,           F%  p	V	P                  V4       VP                  V	4       K'  	  V# )r   Nr   NN)r}   dictr   maxro   ranger6   r   itemsaddintersection_updatedifference_update)
r,   	allGlyphsr   rO   r   r   r   rZ   class0ss
   &&        r-   _ClassDef_invertr    s    $	&*t~~~DNN2	#,I!A
C1q5\

35  !

1 " A J i.(ARA!!&)$$Q'  Jr0   c                    \         P                  ! 4       p/ ;Vn        pVR J pV'       d   R .\        V 4      ,          p\        P
                  ! 4       p\        W4       F.  w  rg\        Wg4      pVf
   VR,          pVP                  V4       K0  	  VP                  4       p	V'       d   V	P                  ^ \        4       4       \        V	4       F  w  rV
^ 8X  d   K  V F  pWV&   K	  	  K  	  W)3# )Nr  )r   ClassDefr   ru   r   
Classifierrw   r  r   
getClassesinsertr   rv   )rh   allGlyphsesr,   r   allGlyphsesWasNone
classifierclassDefr  setsclassesry   classSetr   s   &&           r-   _ClassDef_merge_classifyr    s    ;;=D!##DNY$,fs3x'))+J"3448D$	  5
 ##%Gq#%  )6AaL  * =r0   c                    V Uu. uF  qDP                   NK  	  pp\        V Uu. uF  qDP                  NK  	  upV Uu. uF  qDP                  P                  NK  	  up4      w  V n        p\        V4      V n        . p\        W4       EF  w  rHR p	\        VP                  P                  4      p
VP                  P                  p. pV EF/  p\        \        V4      4      pW9  d   R p	V	f   \        P                   ! 4       p	. ;qn        \        VP                  4       F  pV'       d   R pM\        P                  ! 4       pV P                   '       d!   \"        P$                  ! V P                   4      MR Vn        V P(                  '       d!   \"        P$                  ! V P(                  4      MR Vn        VP-                  V4       K  	  T	pMVP/                  V^ 4      pVV,          pVP-                  V4       EK2  	  VP-                  V4       EK  	  Tp?\        V Uu. uF  qDP0                  NK  	  up4      w  V n        p\        V4      V n        . p\        W4       F  w  rHVP0                  P                  p. pV F  pVP                  p\        P                   ! 4       p. ;pVn        V Fi  pV'       g   V^ ,          pM/\        \        V4      4      pVP/                  V^ 4      pVV,          pVP-                  \2        P4                  ! V4      4       Kk  	  VP-                  V4       K  	  VP-                  V4       K  	  Tp?V# u upi u upi u upi u upi r(   )r   r  r   r   r   ru   Class1Countrw   r   r   nextiterr   r   r  Class2Countr   r	   r   r   r  r   r6   rK   r   r   deepcopy)r,   rh   r*   transparentr   matricesr  new_matricesmatrixnullRowcoverage	classDef1class1Recordsr  exemplarGlyphclass2recordsr   rec2rec1klass	classDef2rec1oldoldClass2Recordsrec1newclass2Recordss   &&&&                     r-   _PairPosFormat2_align_matricesr6     s   (+,1H, 7!"cc"$D1ZZ%6%6$DDNG 7|DL'	qzz(()KK))	H h0M,
 ? oo/G;==M$8"1==1&#'D#%??#4D $(#4#4#4 !' 2 243D3D E%) !K $(#4#4#4 !' 2 243D3D E%) !K
 &,,T2 2  !mQ7e}  &A  B 	M*M (N H 7S7QSS7QRDNG7|DL'	KK))	G&33oo'G355MG0#+A.D$(h$8M%MM-;E+E2D$$T]]4%89 $   )  	M*! (" HOU - 	#$D^ 8Rs   M	MM
Mc                    \        V Uu. uF%  q3P                  '       g   K  VP                  ^ 8H  NK'  	  up4      '       g   Q R4       hVP                  V VRR7       \	        VP
                  V Uu. uF  qDP                  P                  NK  	  up4      w  rVWPP                  n        \        WP                  4       F1  w  r7VP                  P                  V8w  g   K"  W7R,          8X  d   K1  Q h	  \        WVP
                  4      p\        V^ ,          4      V n        VP                  V P                  V4       R# u upi u upi )r   r   r   N)r   r   r  r   r"  r   r   r  )r   r   r  rr   r   r*   r   r   rw   r   r6  r   rz   )	r,   rh   rF   r   rZ   r   r   r   r%  s	   &&&      r-   _PairPosFormat2_merger9  N  s   &)<c^^	1	c<  '&'  	
    #6;;C0PCq1B1BC0PQIF!MM C!8!89::&"%%% : .dEHXa[)D
d''2I 	=& 1Qs   D=D=1E
c                    \        \        P                  V Uu. uF  q3P                  NK  	  up^ 4      ;V n        Vn        \        \        P                  V Uu. uF  q3P
                  NK  	  up^ 4      ;V n        Vn        VP                  ^8X  d   \        WV 4       M+VP                  ^8X  d   \        WV 4       M\        V RR7      hV =V =^ p^ pVP                  ^8X  dx   VP                   Ff  pVP                   FS  p\        VRR4      pVe   WHP                  4       ,          p\        VRR4      p	V	f   K=  WYP                  4       ,          pKU  	  Kh  	  MVP                  ^8X  dw   VP                   Ff  p
V
P                    FS  p\        VRR4      pVe   WHP                  4       ,          p\        VRR4      p	V	f   K=  WYP                  4       ,          pKU  	  Kh  	  WAn        WQn        R# u upi u upi )r   r   r   r   Nr   )r   r   r   r   r   r  r   r   r  r9  r#   r   r   rJ   r   r   r   )rF   r,   rh   r   vf1vf2pairSetpairValueRecordpv1pv2class1Recordclass2Records   &&&         r-   r4   r4   w  s   .4

S1S^^S11/ F$+ /5

S1S^^S11/ F$+ {{ad0		d01JKKV0 C
C{{a||G#*#:#:ox>?==?*Cox>?==?*C $; $ 
	 --L , 9 9lHd;?==?*ClHd;?==?*C !: . M 2 2s   G/
G4
c                 L   \        R  V 4       4      V n        \        VP                  V Uu. uF  p\	        WSR,           4      P
                  NK!  	  upV Uu. uF  p\	        WSR,           4      P                  NK!  	  up4      w  rgV\	        WR,           4      n        \        VP                  V Uu. uF  p\	        WTR,           4      P
                  NK!  	  upV Uu. uF&  p\	        \	        WTR,           4      VR,           4      NK(  	  up4      w  rV\	        WR,           4      n        . p
\        V\        V!  4       F  w  rV Uu. uF  qf   K  VP                  NK  	  pp\        V4      '       g   \        W.^ ,          VR7      h\        P                  ! 4       pV^ ,          Vn        V Uu. uF  qf   RMVP                  NK  	  pp\        V4      '       d   RpM.\        P                  ! 4       p^Vn        VP!                  VV4       VVn        V
P#                  V4       K  	  \        P$                  ! 4       pV
Vn        \'        V
4      Vn        \+        WR,           V4       . p
\        V\        V	!  4       EF!  w  r\        V4      '       d   RpM\	        \        VR,           4      ! 4       p. p\+        WR,           V4       V Uu. uF  qf   . M\	        WR,           4      NK  	  ppV F6  pVP-                  R.V P                  \'        V4      ,
          ,          4       K8  	  \        V!   FV  p\        V4      '       d   RpM.\        P                  ! 4       p^Vn        VP!                  VV4       VP#                  V4       KX  	  V
P#                  V4       EK$  	  \	        \        VR,           4      ! 4       p\+        VVR,           V
4       \+        VVR,           \'        V
4      4       \+        WR,           V4       R# u upi u upi u upi u upi u upi u upi u upi )c              3   8   "   T F  qP                   x  K  	  R # 5ir(   )
ClassCountrY   r   s   & r-   r[   ,_MarkBasePosFormat1_merge.<locals>.<genexpr>  s     41,,   r   ArrayRecordNr]   AnchorCount)r  rE  r   r*   rJ   r   
MarkRecordrw   Classr   r   r   
MarkAnchorr   rK  r   re   r6   	MarkArrayru   	MarkCountsetattrextend)r,   rh   rF   MarkBaser   MarkCoverageGlyphsMarkRecordsBaseCoverageGlyphsBaseRecordsrecordsr   glyphRecordsr
allClassesr   
allAnchorsanchorarrayanchorsglyphAnchorss   &&&&&                r-   _MarkBasePosFormat1_mergerc    si   444DO&87:;s!:%	&	-	-s;8;<17N	#	.	.<'#
 /AGD#$+&87:;s!:%	&	-	-s;GJKs!7N+TH_	=sK'#
 /AGD#$+ G133DE'3E|!gagg|
E$ 
##"6qMzRR--/C"1CIGST|!)$=|JTz"" !""6:6#CNsA FB LLNEE'lEOD.%( G133DE<  C"dXo.0CGC'2JVJVQiWQx%@@,   "$4??SV#;<= "!<0
:&&!FYY[F$%FM&&vz:v& 1 	s) F* Bw')EE4(?G,E4'>3w<0D.%(] 	<< 	<K F. U.s/   %P
%P0%P
,PPP-P
 P!c           	         \        VP                  R  V 4       4      '       g3   \        T RVP                  V Uu. uF  q3P                  NK  	  upR7      hVP                  ^8X  d   \        WV 4       R# \	        V RR7      hu upi )c              3   8   "   T F  qP                   x  K  	  R # 5ir(   r   rF  s   & r-   r[   r          #:cHHcrH  zmark-to-base positioning lookupr   r^   r_   r   Nr   r   r"   rc  r#   rF   r,   rh   r   s   &&& r-   r4   r4     sr    dkk#:c#:;;!6[[#&'3a3'	
 	
 {{a!$V41RSS (s   Bc           	         \        VP                  R  V 4       4      '       g3   \        T RVP                  V Uu. uF  q3P                  NK  	  upR7      hVP                  ^8X  d   \        WV RR4       R# \	        V RR7      hu upi )c              3   8   "   T F  qP                   x  K  	  R # 5ir(   r   rF  s   & r-   r[   r   
  rf  rH  zmark-to-mark positioning lookuprg  Mark1Mark2r   Nrh  ri  s   &&& r-   r4   r4     sv    dkk#:c#:;;!6[[#&'3a3'	
 	
 {{a!$VWgF1RSS (s   Bc                    \         P                  ! 4       p\         P                  ! 4       Vn        \        TV  UUu. uF'  q3P                   Uu. uF  qDP
                  NK  	  upNK)  	  uppV  Uu. uF  q3P                  NK  	  up4      w  rVWRP                  n        . ;Vn        p\        V!   F$  pV F  pVf   K	  VP                  V4        K"  	  Q h	  \        VP                  4      Vn
        V# u upi u uppi u upi r(   )r   r   r   r   r   r   r   rw   r6   ru   r   )	rh   r*   r,   r   rZ   r   r   r   ro   s	   &&       r-   _PairSet_flattenro    s    ::<DKKMDM (?BCs!3!3	4!3A--!3	4sC&)*c		c*NF "MM"$$D4v,A}A 
 5  d223DK 
5C*s   C7C2!C7/C=2C7c           
         \        V  Uu. uF%  q"P                  '       g   K  VP                  ^ 8H  NK'  	  up4      '       g   Q R4       h\        P                  ! 4       p^Vn        \        P                  ! 4       Vn        \        \        P                  V  Uu. uF  q"P                  NK  	  up^ 4      Vn
        \        \        P                  V  Uu. uF  q"P                  NK  	  up^ 4      Vn        \        Y Uu. uF  qDP                  P                  NK  	  upV  Uu. uF  qDP                  NK  	  up4      w  rVWSP                  n        \        V!   UUu. uF$  p\        V Uu. uF
  qDf   K  VNK  	  upV4      NK&  	  uppVn        \        VP                  4      Vn        V# u upi u upi u upi u upi u upi u upi u uppi )r   r   )r   r   r  r   r   r   r   r   r   r   r   r   r   rw   ro  ru   r   )rh   r*   r   r,   rZ   r   r   ro   s   &&      r-   (_Lookup_PairPosFormat1_subtables_flattenrq  0  sn   &)7cYY	1	c7  '&'  ::<DDKKKMDMszzC+HCqNNC+H!LDszzC+HCqNNC+H!LD (#.#Qzz  #.C0HCqC0HNF "MM 6l"F 	V=V!!V=tD"DL DLL)DK) 	8 ,I+H /0H
 >s@   F&F&F+
F0
:F5
F:G%F?/F?5G?Gc                    \        V  Uu. uF%  q"P                  '       g   K  VP                  ^ 8H  NK'  	  up4      '       g   Q R4       h\        P                  ! 4       p^Vn        \        P                  ! 4       Vn        \        \        P                  V  Uu. uF  q"P                  NK  	  up^ 4      Vn
        \        \        P                  V  Uu. uF  q"P                  NK  	  up^ 4      Vn        \        Y Uu. uF  qDP                  P                  NK  	  up4      w  rVWSP                  n        \        W0VRR7      p. ;qn        \        V!   F  p	\        P                  ! 4       p
VP                  V
4       . V
n        V
P                   p
\        \#        R V	 4       4      !   F/  p\%        \'        R V 4       4      4      pV
P                  V4       K1  	  K  	  V# u upi u upi u upi u upi )r   r   T)r$  c              3   8   "   T F  qP                   x  K  	  R # 5ir(   )r   )rY   r\  s   & r-   r[   ;_Lookup_PairPosFormat2_subtables_flatten.<locals>.<genexpr>`  s     ;dnndrH  c              3   0   "   T F  qf   K  Vx  K  	  R # 5ir(   r   rY   cs   & r-   r[   rt  a  s     =t!AAts   
)r   r   r  r   r   r   r   r   r   r   r   r   r   r6  rw   r6   r   r   r   r!  )rh   r*   r   r,   rZ   r   r   r%  r'  rowsrowcolscols   &&           r-   (_Lookup_PairPosFormat2_subtables_flattenr|  I  s   &)<c^^	1	c<  '&'  ::<DDKKKMDMszzC+HCqNNC+H!LDszzC+HCqNNC+H!LD #4S)IS***;*;S)IJIF!MM-d4PH!##FXooc;d;;<Dt=t==>CJJsO =  K3 	= ,I+H *Js   GGG#
G(
:G-
c                H   \        V 4      p \        V 4      p^ pW28  d#   W,          P                  ^8X  d   V^,          pK(  \        V RV V4      .V RV% \        V 4      pTpV^ 8  d*   W^,
          ,          P                  ^8X  d   V^,          pK0  \	        WR V4      .WR% V # )zMerge multiple Format1 subtables at the beginning of lst,
and merge multiple consecutive Format2 subtables that have the same
Class2 (ie. were split because of offset overflows).  Returns new list.N)r   ru   r   rq  r|  )rh   r*   r   ry   s   &&  r-   &_Lookup_PairPos_subtables_canonicalizer~  g  s     s)CCA	A
%CFMMQ&	Q7BQFGCGCA	A
a%CAJ%%*	Q7BFGCGJr0   c                 B   \        Y Uu. uF  q3P                  P                  NK  	  upR 4      w  rE\        V4      p\        P
                  ! 4       p^Vn        W'n        \        P                  ! 4       Vn        WGP                  n        Wgn        R .V,          Vn	        V  F  pVP                  ^8X  d`   VP                  p	VP                  P                   F7  p
VP                  V
4      p\        P                  ! V	4      VP                  V&   K9  	  Ks  VP                  ^8X  g   K  \        VP                  P                  4       FL  w  rVP                  V,          p	VP                  V
4      p\        P                  ! V	4      VP                  V&   KN  	  K  	  V.# u upi r(   )r   r   r   ru   r   r   r   r   r   r   r   r   r#  rv   )rh   r*   min_inclusive_rec_formatrZ   r   r   
num_glyphsnew	singlePosval_recgnamery   r   s   &&&          r-   #_Lookup_SinglePos_subtables_flattenr  |  s=   "4S)IS***;*;S)I4PIFVJ
,,.CCJ.O;;=CL LLN#CI	q ooG"++22LL'#}}W5		! 3 "%i&8&8&?&?@#//!,LL'#}}W5		! A  5L) *Js   F
c                    \        V P                  V Uu. uF  q3P                  P                  NK  	  upV Uu. uF  q3P                  NK  	  up4      w  rE^Vn        \        P                  ! 4       Vn        WAP                  n        . Vn        V F  p\        P                  ! 4       p\        P                  ! 4       Vn        ^VP                  n        \        P                  ! 4       Vn	        ^VP                  n        VP                  P                  V4       K  	  V P                  VP                  V4       \        VP                  4      Vn        R# u upi u upi r   )r   r*   r   r   EntryExitRecordr   r   rK  EntryAnchor
ExitAnchorr6   rz   ru   EntryExitCount)rF   r,   rh   r   r   r   r   r   s   &&&     r-   r4   r4     s     ($'(Cq		C($'(Cq		C(NF DKKKMDM!MMD  "))+!" !##C(  d**F3d223D! 	)(s
   E
Ec                 ,   \         ;QJ d    R  V 4       F  '       d   K   RM	  RM! R  V 4       4      '       d   RVn        \         ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   RVn        V P                  W4       R# )c              3   <   "   T F  qP                   R J x  K  	  R # 5ir(   )r  rY   masters   & r-   r[   r     s     
8C&%C   FTNc              3   <   "   T F  qP                   R J x  K  	  R # 5ir(   )r  r  s   & r-   r[   r     s     
73$3r  )rc   r  r  rr   r   s   &&&r-   r4   r4     sa    
s
8C
8sss
8C
888
s
73
7sss
73
777
"r0   c           	         V Uu. uF  q3P                   NK  	  up;q@n        \        \        W$4      4      WP                   3.,            EF  w  r5V'       g   K  V^ ,          P                  P
                  P                  R4      '       g   KD  \        V Uu. uF  qfP                  NK  	  up4      '       g2   \        T RV Uu. uF  qfP                  P
                  NK  	  upR7      h\        V Uu. uF  qfP                  NK  	  up4      '       g   \        V 4      hV^ ,          P                  Vn
        V Uu. uF  qfP                  NK  	  ppVR VP                  V4       EK  	  VP                   ;'       d,    \        VP                   ^ ,          \        P                  4      pV'       dS   \!        VP                   V P"                  4      Vn         V Uu. uF  p\!        W`P"                  4      NK  	  up;q@n        EMVP                   ;'       d,    \        VP                   ^ ,          \        P$                  4      p	V	'       d   V Uu. uF  p\'        V4      NK  	  p
p\)        V
 Uu. uF  qV
^ ,          8H  NK  	  up4      '       g   V UUu. uF  qf F  qP*                  NK  	  K  	  ppp\-        \.        V4      p\1        VP                   V P"                  V4      Vn         V Uu. uF  p\1        W`P"                  V4      NK  	  up;q@n        RpMRpV P3                  VP                   V4       \'        VP                   4      Vn        V'       Ed   \'        VP                   4      ^8  d#   VP                   ^ ,          P6                  ^8X  g   Q hVP                   ^ ,          P8                  P:                  '       g5   VP                   P=                  ^ 4       V;P4                  ^,          un        \'        VP                   4      ^8  d#   VP                   R,          P6                  ^8X  g   Q hVP                   R,          P8                  P:                  '       g5   VP                   P=                  R4       V;P4                  ^,          un        V P"                  P>                  PA                  R\C        4       R7      pV^ 8w  dV   \D        PG                  R4       \I        V P"                  VVP                   4      Vn         \'        VP                   4      Vn        MX	'       d   X'       d~   VP                   ^ ,          pVP8                  P:                  p\        VVPJ                  4       UUu/ uF	  w  ppVVbK  	  ppp\M        VV P"                  PO                  4       4      Vn         V PQ                  WR	R
.R7       V =R# u upi u upi u upi u upi u upi u upi u upi u upi u uppi u upi u uppi )r   	Extensionr]   :NNNTFz0fontTools.otlLib.optimize.gpos:COMPRESSION_LEVELr   zCompacting GPOS...SubTableSubTableCountr   Nr8  ))r  r   r   rw   rd   r5   
startswithr   r!   ExtensionLookupType
LookupTypeExtSubTablerS  r}   r   r   r~  r*   r   ru   rc   r   r   r   r  rz   r  r   r   r   popcfgrK   r   loginfor   r   r   r   rr   )rF   r,   rh   r   r   stsstnew_sts	isPairPosisSinglePosnumSubtablesnumstvalueFormatListmirf	flattenedlevelsinglePosTabler   r  	valRecordsinglePosMappings   &&&                   r-   r4   r4     s   ?B*Cs!::s*CCI' s3*+mm/D.EEEq6$$//<<C8Cb\\C899,(9<=2..= 
 cBc33cBCC,V44q655AL034"~~G4AJJw F" JJ*T]]1-=rzz"JI ?MM6;;
 OX/
NW22{{Ci/
 	
	+ mmRR
4==3CR\\(R.78iCGiL8LILDQ/LIJJ <E"Q9Rb==b=9"Qc?3 CMM6;;!
 (7' 8KKN'7 	3 !	!	
dmmY/T]]+Dy4==!Q&4==+;+B+Ba+GGG}}Q((///MMa !# 4==!Q&4==+<+C+Cq+HHH}}R ))000MMb!!# ##>/1 $ 
 A:HH)*,V[[%ODM!$T]]!3D	q)((// 69AUAU5V
5V!1	E95V 	 
 'fkk<<>
 J+HIA +D 9 >B 5/
 9I #R7T
sA   WW
W1W
9WWW$+W)W.*W42W9c                   *   a  ] tR tRt o RtR tRtV tR# )InstancerMergeri  zHA merger that takes multiple master fonts, and instantiates
an instance.c                t    \         P                  W4       W n        W0n        VP	                  V4      V n        R # r(   )r&   r.   modellocationgetMasterScalarsmasterScalars)r,   r*   r  r  s   &&&&r-   r.   InstancerMerger.__init__#  s+    #
 "33H=r0   )r  r  r  Nr5   r   r   r   __doc__r.   r   r   r   s   @r-   r  r    s     > >r0   r  c                     VP                   ^8X  g   Q hV Uu. uF  q3P                  NK  	  ppV P                  pV P                  p\	        VP                  WF4      4      Vn        R# u upi r   )r   
Coordinater  r  r   interpolateFromValuesAndScalars)rF   r,   rh   aCoordsr  r  s   &&&    r-   r4   r4   *  s]    ;;!$'(CqllCF(LLE((M--fDDO )s   A'c                 T   VP                   ^8X  g   Q hV Uu. uF  q3P                  NK  	  ppV Uu. uF  q3P                  NK  	  ppV P                  pV P                  p\        VP                  WG4      4      Vn        \        VP                  WW4      4      Vn        R# u upi u upi r   )r   XCoordinateYCoordinater  r  r   r  )rF   r,   rh   r  XCoordsYCoordsr  r  s   &&&     r-   r4   r4   5  s    ;;!&)*c}}cG*&)*c}}cG*LLE((M--gED --gED +*s
   B B%c           	      $   V P                   pV P                  pR Fl  w  rV\        W4      '       d   Q h\        W4      '       g   K+  V Uu. uF  p\        Wu^ 4      NK  	  pp\	        VP                  W4      4      p	\        WV	4       Kn  	  R# u upi XAdvanceN)r  
XAdvDevice)YAdvance
YAdvDevice)
XPlacement
XPlaDevice)
YPlacement
YPlaDevice)r  r  rb   rJ   r   r  rR  )
rF   r,   rh   r  r  name	tableNamer  ro   rm   s
   &&&       r-   r4   r4   D  s    LLE((M 4++++43673agaq)3F755fLE D& 8s   
Bc                   .   a  ] tR tRt o RtRR ltRtV tR# )MutatorMergeri^  zA merger that takes a variable font, and instantiates
an instance.  While there's no "merging" to be done per se,
the operation can benefit from many operations that the
aligning merger does.c                H    \         P                  W4       W n        W0n        R # r(   )r&   r.   	instancerdeleteVariations)r,   r*   r  r  s   &&&&r-   r.   MutatorMerger.__init__d  s    #" 0r0   )r  r  NTr  r   s   @r-   r  r  ^  s     
1 1r0   r  c                    V^ ,          P                   P                  4       Vn         VP                  ^8w  d   R# V P                  pVP                  pV P
                  '       d   V=V'       db   VP                  R8X  g   Q hVP                  ^,          VP                  ,           p\        W5,          4      pV;P                  V,          un
        V P
                  '       d
   ^Vn        R# R# )r   N   )rA   r   r   r  DeviceTabler  DeltaFormat	StartSizeEndSizer   r  )rF   r,   rh   r  devvaridxdeltas   &&&    r-   r4   r4   j  s     FOO((*DM{{a  I


C
&(((--2%4	)*5  r0   c           	      F   V^ ,          P                   P                  4       Vn         VP                  ^8w  d   R# V P                  pR F  pVR,           p\	        W4      '       g   K  \        W4      pV P                  '       d   \        W4       Vf   KM  VP                  R8X  g   Q hVP                  ^,          VP                  ,           p\        W7,          4      pVR,           p	\        W\        W4      V,           4       K  	  V P                  '       d
   ^Vn        R# R# )r   NXYr  r  r  )rA   r   r   r  rb   rJ   r  delattrr  r  r  r   rR  )
rF   r,   rh   r  rZ   r  r  r  r  r;   s
   &&&       r-   r4   r4     s     FOO((*DM{{a  I%	t''d&"""D$;&(((--2%4	)*<GD/%78 "  r0   c           
         V^ ,          P                   P                  4       Vn         V P                  pR F  w  rE\        W4      '       g   K  \	        W4      pV P
                  '       d   \        W4       Vf   KF  VP                  R8X  g   Q hVP                  ^,          VP                  ,           p\        W7,          4      p\        W\	        W^ 4      V,           4       K  	  R# )r   Nr  r  )rA   r   r  rb   rJ   r  r  r  r  r  r   rR  )	rF   r,   rh   r  r  r  r  r  r  s	   &&&      r-   r4   r4     s     FOO((*DM  I t''d&"""D$;&(((--2%4	)*GD2U:;%r0   c                   B   a a ] tR tRt oRtR tR tV 3R ltRtVt	V ;t
# )VariationMergeri  zFA merger that takes multiple master fonts, and builds a
variable font.c                    \         P                  W4       \        P                  ! V4      V n        V P                  V4       R # r(   )r&   r.   r   OnlineVarStoreBuilderstore_buildersetModel)r,   r  axisTagsr*   s   &&&&r-   r.   VariationMerger.__init__  s-    #%;;HEer0   c                H    Wn         V P                  P                  V4       R # r(   )r  r  r  )r,   r  s   &&r-   r  VariationMerger.setModel  s    
##E*r0   c                  < R pR pR V9   d   \        V4      '       d   Ve   \        WR7      hR # V P                  pV P                  '       d-   \        V Uu. uF  qUR JNK  	  upV P                  4      V n        V P                  pVP                  V4      w  rbV P                  V4       \        \        V `'  W4       V'       d   V P                  V4       V'       d	   W@n        R # R # u upi )N)r_   )
r   r   r+   r   r  getSubModelr  superr  re   )r,   rg   rh   masterModelorigTTFsrZ   r  rd   s   &&&    r-   re   VariationMerger.mergeThings  s    3;s||?$T33 yyHyyy#C$@Cqd]C$@$))L	**K$005JEMM% ot0:MM+& I  %As   C()r  r  r+   )r5   r   r   r   r  r.   r  re   r   r   __classcell__)rd   r   s   @@r-   r  r    s     
+! !r0   r  c                     \        V4      '       d   V^ ,          R3# V P                  V4      w  r#V\        P                  ! V4      3# r   )r   storeMastersr   buildVarDevTable)r  master_valuesbasevarIdxs   &&  r-   r  r    sE    Q%% --m<LD))&111r0   c                     VP                   ^8w  d   \        V RR7      h\        V P                  V Uu. uF  q3P                  NK  	  up4      w  Vn        pV'       d   ^Vn         WAn        R# R# u upi )r   za baseline coordinater   Nr   r#   r  r  r  r  rF   r,   rh   r  r  s   &&&  r-   r4   r4     se    {{a1HII#3S9S||S9$ DO[ &  :   A/
c                     VP                   ^8w  d   \        V RR7      h\        V P                  V Uu. uF  q3P                  NK  	  up4      w  Vn        pV'       d   ^Vn         WAn        R# R# u upi )r   za caretr   Nr  r  s   &&&  r-   r4   r4     sd    {{a;;#3S9S||S9$ DO[ &  :r  c                 |   VP                   ^8w  d   \        V RR7      h\        V P                  V Uu. uF  q3P                  NK  	  up4      w  Vn        p\        V P                  V Uu. uF  q3P
                  NK  	  up4      w  Vn        pV'       g	   V'       d   ^Vn         WAn        WQn        R# R# u upi u upi )r   z	an anchorr   N)r   r#   r  r  r  r  XDeviceTableYDeviceTable)rF   r,   rh   r  r  r   s   &&&   r-   r4   r4     s    {{a==%5c:c}}c:&"Dl &6c:c}}c:&"Dl |(( $ ; ;s   B4
*B9
c                     R Fl  w  r4\        W4      '       g   K  \        V P                  V Uu. uF  p\        WS^ 4      NK  	  up4      w  rg\	        WV4       V'       g   K`  \	        WV4       Kn  	  R# u upi r  )rb   r  r  rJ   rR  )rF   r,   rh   r  r  r  rm   deviceTables   &&&     r-   r4   r4     sl     4!1$$C&HCqwq':C&H"E D&{5 'Is   A5c                      a  ] tR tRt o RtRR ltRR ltR 3R ltR tR t	R	 t
V 3R
 lR ltV 3R lR lt]R 4       t]R 4       tRtV tR# )COLRVariationMergeri&  a  A specialized VariationMerger that takes multiple master fonts containing
COLRv1 tables, and builds a variable COLR font.

COLR tables are special in that variable subtables can be associated with
multiple delta-set indices (via VarIndexBase).
They also contain tables that must change their type (not simply the Format)
as they become variable (e.g. Affine2x3 -> VarAffine2x3) so this merger takes
care of that too.
c                    \         P                  WW#4       / V n        . V n        \	        4       V n        . V n        R V n        V'       d   \        4       V n        RV n	        R # )NF)
r  r.   varIndexCachevarIdxesr   varTableIdslayerslayerReuseCacher   _doneBaseGlyphs)r,   r  r  r*   allowLayerReuses   &&&&&r-   r.   COLRVariationMerger.__init__1  sT      h=   5##2#4D $r0   c                    R V9   d*   R V9   d#   V P                  VR ,          P                  4       \        P                  WW#4       R# )COLRN)expandPaintColrLayersrn   r  r   )r,   r*   r   r   s   &&&&r-   r   COLRVariationMerger.mergeTablesC  s:    Y6T> &&tF|'9'9:##DGr0   c                    R # r  r   )r   s   &r-   <lambda>COLRVariationMerger.<lambda>P  s    4r0   c                   VP                   pVP                  pR p V! V4      pV! V4      pV'       g"   \        V \	        V4      P
                  VR7      hTp. pV F*  p	\        V	RR4      p V! V4      pVP                  V4       K,  	  \        Wx4      '       g#   \        V \	        V4      P
                  VVR7      hV#   \         d     Li ; i  \         d     Lhi ; i)F)r   rm   r   Nrg  )
r   
formatEnum
ValueErrorr#   rB   r5   rJ   r6   r   r"   )
r,   rg   rh   validatefmtr  okr^   r_   rZ   s
   &&&&      r-   checkFormatEnum#COLRVariationMerger.checkFormatEnumP  s    jj^^
	S/C #B#D493E3ESQQA!Xt,C o JJsO  (((%c++!	  -  		  s#   B> ,C>CCCCc           
        VP                  4        F:  p T P                  W,          V Uu. uF  qDP                  V4      NK  	  up4       K<  	  R# u upi   \         d'   pTP                  P                  R T: R24       h Rp?ii ; i)[]N)rX   re   rK   r$   rf   r6   )r,   rg   rh   r   rZ   rq   s   &&&   r-   mergeSparseDict#COLRVariationMerger.mergeSparseDictn  sl    A  C)@Cq%%(C)@A )@# 1%qz*s(   AAAAB!!BBc                    V F:  p\        W4      pV Uu. uF  p\        Wd4      NK  	  pp V P                  WW4       K<  	  R# u upi   \         d%   pTP                  P	                  R T 24       h Rp?ii ; i)ra   N)rJ   re   r$   rf   r6   )	r,   rg   rh   r<   r;   rm   rj   ro   rq   s	   &&&&     r-   
mergeAttrsCOLRVariationMerger.mergeAttrsv  sp    DC&E69:cdgd)cF:  /	 : $ 4&z*s   AAA7A22A7c                   V Uu. uF  p\        WC4      NK  	  ppR pVP                  V4      p\        V\        4      '       d"   RpV Uu. uF  qP	                  V4      NK  	  ppV^ ,          p	\
        P                  p
\        V4      '       g   V P                  P                  V4      w  rV'       d   VP                  V	4      p	W3# u upi u upi )FT)rJ   getConverterByNamer}   r
   toIntr   NO_VARIATION_INDEXr   r  r  fromInt)r,   rg   rh   r;   rj   r  is_fixed_size_floatconvrZ   	baseValuer  s   &&&&       r-   storeMastersForAttr'COLRVariationMerger.storeMastersForAttr  s    9<=,=
 $%%d+dN++"&4ABMqZZ]MMB!!$	&&&& $ 2 2 ? ? NIY/I  ' > Cs   C
Cc                    < V ^8  d   QhRS[ /# r   returnr   )formatr   s   "r-   __annotate__ COLRVariationMerger.__annotate__  s       r0   c                   \        V4      pV P                  P                  V4      pVfs   \        \	        V P
                  4      \	        V4      ,
          ^,           4       F9  pV P
                  WD\	        V4      ,            V8X  g   K(  T;V P                  V&   p M	  Vf   \        \	        V4      ^,
          ^ R4       Fd  pV P
                  V) R  VR V 8X  g   K  \	        V P
                  4      V,
          pW0P                  V&   V P
                  P                  WR  4        M	  Vf@   \	        V P
                  4      ;V P                  V&   pV P
                  P                  V4       V# )Nr8  )tupler  rK   r  ru   r  rS  )r,   r  rl   varIndexBasery   ns   &&    r-   storeVariationIndices)COLRVariationMerger.storeVariationIndices  s9    Ho))--c23t}}-H=AB==X%678C=>>D&&s+l C
 3x=1,a4==!%"15#&t}}#5#9L.:&&s+MM(("6 5 585GGDs#lMM  *r0   c                    < V ^8  d   QhRS[ /# r0  r2  )r3  r   s   "r-   r4  r5    s      S r0   c                4   \         P                  p. pV F4  pV P                  WV4      w  rx\        WV4       VP	                  V4       K6  	  \
        ;QJ d    R  V 4       F  '       g   K   RM	  RM! R  V 4       4      '       d   V P                  V4      pV# )c              3   F   "   T F  q\         P                  8g  x  K  	  R # 5ir(   )r   r(  r   s   & r-   r[   9COLRVariationMerger.mergeVariableAttrs.<locals>.<genexpr>  s     <8aB)))8s   !TF)r   r(  r-  rR  r6   anyr:  )	r,   rg   rh   r<   r8  r  r;   r,  r  s	   &&&&     r-   mergeVariableAttrs&COLRVariationMerger.mergeVariableAttrs  s    ,,D $ 8 84 HICy)OOF# 
 3<8<333<8<<<55h?Lr0   c                   \        VR R R7       F  pVR,          pVP                  p\        V4      P                  pV! 4       pVP                  P                  VP                  4       VP                  4        VR,          P                  pVP                  e%   V\        WsP                  4      VP                  &   K  \        WsP                  V4       K  	  R# )Tc                 T    \        \        V R,          P                  4      RR4      RJ# )r   VarTypeNr8  )rJ   rB   rm   )paths   &r-   r  ?COLRVariationMerger.convertSubTablesToVarType.<locals>.<lambda>  s     T"X^^,i>dJr0   )	skip_root	predicateNr8  )r   rm   rB   rE  rA   r   populateDefaultsr   rJ   r  rR  )clsrn   rF  r  subTablevarTypenewSubTableparents   &&      r-   convertSubTablesToVarType-COLRVariationMerger.convertSubTablesToVarType  s    "
D bBxxH8n,,G!)K  ''(9(9:((*"X^^Fxx#5@(25#
r0   c                   V P                   '       g   R# \        4       p. pV P                  P                   EFL  pVP                  .pV'       g   K  VP                  4       pVP                  \        P                  P                  8X  d   KE  VP                  \        P                  P                  8X  d   \        \        WP4      4      p\        V4      pV Ff  p\        V4      V9   d)   \        P                   ! V4      p\        V4      V9  g   Q hVP#                  V4       VP%                  \        V4      4       Kh  	  Wun        \        V4      Vn        MVP+                  V 4      pVP-                  \/        V4      4       EK>  	  \        V4      \        V4      8X  g   Q hW P                   n        \        V4      V P                   n        R# )a  Rebuild LayerList without PaintColrLayers reuse.

Each base paint graph is fully DFS-traversed (with exception of PaintColrGlyph
which are irrelevant for this); any layers referenced via PaintColrLayers are
collected into a new LayerList and duplicated when reuse is detected, to ensure
that all paints are distinct objects at the end of the process.
PaintColrLayers's FirstLayerIndex/NumLayers are updated so that no overlap
is left. Also, any consecutively nested PaintColrLayers are flattened.
The COLR table's LayerList is replaced with the new unique layers.
A side effect is also that any layer from the old LayerList which is not
referenced by any PaintColrLayers is dropped.
N)	LayerListr   BaseGlyphListBaseGlyphPaintRecordPaintr  r   r   PaintFormatPaintColrGlyphPaintColrLayersr   _flatten_layersru   idr   r#  r6   r
  FirstLayerIndex	NumLayersgetChildrenrS  reversed
LayerCount)	colruniqueLayerIDsnewLayerListr   frontierpaintchildrenfirst_layer_indexlayers	   &        r-   r  )COLRVariationMerger.expandPaintColrLayers  sW    ~~~%%::C		{H( <<2>>#@#@@\\R^^%C%CC  $OE$@AH(+L(9%!)e96$(MM%$8E#%e9N#BB#B$++E2&**2e95 "* ->)&)(mEO$006H 23- ;0 < C$7777+$'$5!r0   )r  r
  r	  r  r  r  Nr  ))r  )r5   r   r   r   r  r.   r   r  r   r#  r-  r:  rA  r   rQ  staticmethodr  r   r   r   s   @r-   r  r  &  sk     %$H 2@ <!, :  6 6( ,6 ,6r0   r  c           
      2   VP                    Uu/ uF  q3P                  VbK  	  ppV UUu. uF(  qUP                    Uu/ uF  q3P                  VbK  	  upNK*  	  ppp\        VP                  4       4       F<  w  rx T P	                  WH,          V U	u. uF  qP                  V4      NK  	  up	4       K>  	  RV n
        R# u upi u upi u uppi u up	i   \         d9   p
T
P                  P                  R T R24       RT: 2T
P                  R&   h Rp
?
ii ; i)z.BaseGlyphPaintRecord[r  zbase glyph r  NT)rV  	BaseGlyphrv   rX   re   rK   r$   rf   r6   causer  )rF   r,   rh   r   rg   rO   mastersry   r   rZ   rq   s   &&&        r-   r4   r4     s     *.)B)B
C)B#==#)BC
CORSs!.D.DE.Dss".DEsGS#((*%	sv''B'Qa''BC & "F DES
 (C 	GGNN3A3a89$/u"5AGGJ	sE   B>CCC;CC*CCCD3DDc                     V P                   '       g   Q R 4       h\        V P                  4      Vn        V P                  Vn        R# )z-BaseGlyphList must be merged before LayerListN)r  ru   r	  ra  rW  r   s   &&&r-   r4   r4     s7     !!!R#RR!&--(DODJr0   c              #     "   V P                   \        P                  P                  8X  g   Q hV P	                  V4       FE  pVP                   \        P                  P                  8X  d   \        W!4       R j  xL
  KA  Vx  KG  	  R #  L5ir(   )r   r   rX  rZ  r_  r[  )rootrb  rf  s   && r-   r[  r[  !  sb     ;;"..88888!!$'<<2>>999&u333K	 (3s   A7B9B
:Bc           
        a a	 \        \        VS P                  R ,          P                  4      4      p\	        S P
                  4      \	        V4      8X  g   Q h\        \	        V4      4       Uu. uF@  p\        \        W$,          S P
                  V,          R ,          P                  4      4      NKB  	  pp S P                  W54       S P                  e   S P                  P                  T4      p\	        T4      \        8  p\        T\        R7      pT	T 3R lo	T Uu. uF  pS	! T4      NK  	  pp\	        T4      ^8X  dc   T^ ,          P                  \         P"                  P$                  8X  d3   T^ ,          P&                  Tn        T^ ,          P(                  Tn        R# \	        T4      Tn        \	        S P*                  4      Tn        S P*                  P-                  T4       S P                  e2   T'       g(   S P                  P/                  Y1P(                  4       R# R# R# u upi   \         d"   pTP                  P                  R4       h Rp?ii ; iu upi )r  z.LayersN)r9  c                   < \        V \        4      '       d   V  Uu. uF  pS! V4      NK  	  pp\        P                  ! 4       p \	        \        P
                  P                  4      V n        \        V4      V n	        \        SP                  4      V n        SP                  P                  V4       SP                  e&   SP                  P                  W P                  4       V # u upi r(   )r}   r   r   rW  r   rX  rZ  r   ru   r^  r	  r]  rS  r
  r
  )rf  r   r	  listToColrLayersr,   s   &  r-   ru  0_merge_PaintColrLayers.<locals>.listToColrLayersM  s    eT""3895a&q)5F9HHJEr~~==>EL!&kEO$'$4E!KKv&##/$$((1F1FG :s   C&)r   r[  r*   rn   ru   r+   r  rz   r$   rf   r6   r
  	try_reuser   r   r   r   rX  rZ  r^  r]  r	  rS  r
  )
r,   rg   rh   
out_layersry   master_layersesrq   is_treer   ru  s
   f&&      @r-   _merge_PaintColrLayersr{  *  s    oc499V+<+B+BCDJ tyy>SX%%% s3x A 	_SVTYYq\&%9%?%?@A   

4 '))33J?
 *o ::G!*0JKJ
 0::z!"1%zJ:
:!
1 4 48V8V V
 #1//(m;;J!$++.:& +G  $$Z1D1DE 5<+o   	
y!	> ;s%   .AH*7H/ I/I:IIc                   a a
 S P                  WR  4      pV\        P                  P                  J d   \	        S W4       R# VP                  4       pRo
Ve!   \        P                  ! \        V4      V4      o
V
3R lVP                  4        4       pS P                  WV4       S P                  WS
4      pVP                  4        Uu. uF  qwP                  NK  	  ppV\        P                  8g  ;'       g;    \        ;QJ d    V 3R lV 4       F  '       g   K   RM	  RM! V 3R lV 4       4      p	V	'       d@   S
'       d   Wan        V'       d   S P#                  V4       Vf   Q h\%        V4      Vn        R# R# u upi )c                 ,    V P                  4       '       * # r(   )is_variable)r  s   &r-   r  merge.<locals>.<lambda>p  s    COO<M8Mr0   Nc              3   `   <"   T F#  qP                   S9  g   K  VP                   x  K%  	  R # 5ir(   r  rY   rw  varAttrss   & r-   r[   r   {  "     R#7a66;Q6166#7   ..c              3   T   <"   T F  p\        V4      SP                  9   x  K  	  R # 5ir(   r\  r  )rY   rn   rF   s   & r-   r[   r     s#      >5>E5	V'''Y   %(TFr   )r  r   rX  rZ  r{  as_variabler	   getVariableAttrsrB   getConvertersr#  rA  iterSubTablesrm   r(  r@  VarIndexBaserQ  r   r   )rF   r,   rh   r  	varFormatstaticAttrsr8  r  	subTables
isVariabler  s   f&&       @r-   r4   r4   n  s?   

 
 ,M
NC
bnn,,,vt1!IH**4:yAR4#5#5#7RK
d-,,TAL$($6$6$89$8b$8I9 !6!66  ## >5>>### >5>> ;J  !-,,T2$$$)n  :s   E<c                 \  a \        V4      P                  p\        P                  ! V4      oV3R  lVP	                  4        4       pV P                  WV4       V P                  WS4      pV\        P                  8w  d-   WQn	        V P                  P                  \        V4      4       R# R# )c              3   `   <"   T F#  qP                   S9  g   K  VP                   x  K%  	  R # 5ir(   r  r  s   & r-   r[   r     r  r  N)rB   rE  r	   r  r  r#  rA  r   r(  r  r  r
  r\  )rF   r,   rh   rN  r  r8  r  s   &&&   @r-   r4   r4     s    4j  G&&w/HR4#5#5#7RK
d-,,TALr,,,(r$x( -r0   c                 l  a  S P                  WR  VP                  4        4       4       \        ;QJ d)    V 3R lVP                   4       F  '       g   K   RM	  RM! V 3R lVP                   4       4      '       d8   S P	                  V4       S P
                  P                  \        V4      4       R# R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir(   r  rv  s   & r-   r[   r     s     !G2FQ&&2FrH  c              3   T   <"   T F  p\        V4      SP                  9   x  K  	  R # 5ir(   r  )rY   stoprF   s   & r-   r[   r     s      
End2d8v)))nr  TFN)r#  r  r@  	ColorStoprQ  r  r
  r\  r   s   f&&r-   r4   r4     sw    
d!G$2D2D2F!GH
s
Ednn
Esss
Ednn
EEE((.r$x( Fr0   clipsc                 (    V P                  W4       R # r(   )r   r   s   &&&r-   r4   r4     s     4%r0   )NNr(   )F)rT  rU  )kr  osr   rC   operatorr   loggingfontTools.colorLib.builderr   r   fontTools.miscr   fontTools.misc.roundToolsr   fontTools.misc.treeToolsr   fontTools.ttLib.tablesr   r   r	   #fontTools.ttLib.tables.otConvertersr
   !fontTools.ttLib.tables.otTraverser   #fontTools.ttLib.tables.DefaultTabler   fontTools.varLibr   r   r   fontTools.varLib.modelsr   r   r   r   r   fontTools.varLib.varStorer   	functoolsr   fontTools.otlLib.builderr   fontTools.otlLib.optimize.gposr   r   	getLoggerr  errorsr   r   r   r   r   r   r    r!   r"   r#   r$   objectr&   r   rF   GDEFr4   r   r   r   rK  r   r   r   r   r  r  r  r6  r9  r   rc  MarkBasePosMarkMarkPosro  rq  r|  r~  r  
CursivePosr  Lookupr  
CaretValuer  r  r  	BaseCoordr  rU  rT  r[  r{  rW  ClipBox	Affine2x3r  	ColorLineClipListr   r0   r-   <module>r     s   
     R ( - 5 1 3 > < < 6 6 S S 7  3
 12   rV rp	V 	 rww0# 1#2"J v))*# +# ryy!# "#$6 r||$: %:z rzz"24 #24j,B86K\&3R rzz"( #(VS)l r~~&T 'T r~~&T 'T22<*0 r}}%4 &4. r))*# +# ryy!a  "a R>n > & ' 		" # **+' ,'2	1N 	1 bmm$ %* bii  !: f(()< *<>%!n %!P2 %' &' &' '' 		") #) **+6 ,6 \6/ \6~ B,,-" ."" BLL) *AFH RXXrzz23%% 4%%P R\\2<<89) :)  BLL)) *) BKK1& 2&r0   