+
    f7iY  c                   s   R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
HtHtHtHtHtHt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 ^ R	IHt ^ R
IHt ^ RIH t! ^ RI"H#t#H$t$ ^RI%H&t& ^RI'H(t( ^RI)H*t*H+t+ ]! R4      t,]]-]
3,          t.]]/].]!P`                  ]]-R3,          3,          t1]]1,          t2]]-]]2]13,          3,          t3]]-]]]-]/3,          ,          3,          t4]]]/]/]/]/]/3,          ]]/]/]/]/3,          ]!Pj                  3,          t6^t7Rt8^ t9R t:R t;R t<R t=R t>R t?R t@R>R R lltAR>RRRRRRRRR R!/R" R# llltBR$ R% ltCR& R' ltD ! R( R)]P                  4      tF]R]-]]-]-3,          3,          tGR* R+ ltHR?R, R- lltIR. R/ ltJR0 R1 ltKR2 R3 ltL ! R4 R54      tM ! R6 R74      tNR8 R9 ltOR: R; ltPR>R R!/R< R= llltQR# )@z8
colorLib.builder: Build COLR/CPAL tables from scratch

N)partial)ceillog)AnyDict	GeneratorIterableListMappingOptionalSequenceTupleTypeTypeVarUnion)intRect)fixedToFloat)build_n_ary_tree)C_O_L_R_)C_P_A_L_)_n_a_m_e)otTables)
ExtendModeCompositeMode)ColorLibError)%round_start_circle_stable_containment)BuildCallbackTableBuilderT_PaintInputg      ?c                 s    VR ,          pVR,          pVR,          pVR,          pVR,          pVR,          p\        W#3WEV3V4      pVP                  w  r#VP                  pW!R &   W1R&   WAR&   WQR&   WaR&   WqR&   W3# )x0y0r0x1y1r1)r   ZcentreZradius)	paintsourcer   r   r    r!   r"   r#   Zcs	   &&       A/usr/lib64/python3.14/site-packages/fontTools/colorLib/builder.py_beforeBuildPaintRadialGradientr'   9   s    	B	B	B	B	B	B
 	.rhHbIAXXFB	
B 4L4L4L4L4L4L=    c                  F    \         P                  ! 4       p \        V n        V # N)ot	ColorStop_DEFAULT_ALPHAAlphaZ	colorStop    r&   _defaultColorStopr1   S   s    I$IOr(   c                  r)   r*   )r+   VarColorStopr-   r.   r/   r0   r&   _defaultVarColorStopr3   Y   s    !I$IOr(   c                  Z    \         P                  ! 4       p \        P                  V n        V # r*   )r+   	ColorLiner   PADExtendZ	colorLiner0   r&   _defaultColorLiner9   _   s    I!~~Ir(   c                  r4   r*   )r+   VarColorLiner   r6   r7   r8   r0   r&   _defaultVarColorLiner;   e   s     !I!~~Ir(   c                  r)   r*   )r+   Paintr-   r.   )r$   r0   r&   _defaultPaintSolidr=   k   s    HHJE EKLr(   c                  s   \         P                  \        P                  \        P                  P
                  3\        \         P                  \        P                  \        P                  P                  3\        \         P                  \        P                  3\        \         P                  \        P                  3\        \         P                  \        P                  3\        \         P                  \        P                  3\         \         P                  \        P                  \        P                  P"                  3\$        \         P                  \        P                  \        P                  P&                  3\$        /# r*   )r   BEFORE_BUILDr+   r<   PaintFormatZPaintRadialGradientr'   ZPaintVarRadialGradientZCREATE_DEFAULTr,   r1   r2   r3   r5   r9   r:   r;   Z
PaintSolidr=   ZPaintVarSolid r(   r&   _buildPaintCallbacksrA   q   s     &&HHNN..	
 +&&HHNN11	
 +		%	%r||46G		%	%r79M		%	%r||46G		%	%r79M((HHNN%%	
 ((HHNN((	
 1 r(   c          	      s    V ^8  d   QhR\         P                  R\        R\        \        \
        \        3,          ,          /# )   tablecolorGlyphsV0glyphMap)r+   COLR_ColorGlyphsV0Dictr	   r   strintformat   "r&   __annotate__rM      s8     +/ +/77+/%+/ wsCx()+/r(   c                s  a Se!   \        VP                  4       V3R lR7      pMVP                  4       p. p. pV F  w  rg\        P                  ! 4       pWhn        \        V4      Vn        \        V4      Vn        VP                  V4       V F7  w  r\        P                  ! 4       pWn
        Wn        VP                  V4       K9  	  K  	  R;V n        V n        V'       d+   \        P                  ! 4       V n        W@P                  n        V'       d+   \        P                  ! 4       V n        WPP                  n	        \        V4      V n        \        V4      V n        R# )a  Build v0 color layers and add to existing COLR table.

Args:
    table: a raw ``otTables.COLR()`` object (not ttLib's ``table_C_O_L_R_``).
    colorGlyphsV0: map of base glyph names to lists of (layer glyph names,
        color palette index) tuples. Can be empty.
    glyphMap: a map from glyph names to glyph indices, as returned from
        ``TTFont.getReverseGlyphMap()``, to optionally sort base records by GID.
Nc                 $   < SV ^ ,          ,          #     r@   ZitemrE      &r&   <lambda>Z populateCOLRv0.<locals>.<lambda>   s    HT!W4Er(   key)sorteditemsr+   ZBaseGlyphRecord	BaseGlyphlenFirstLayerIndex	NumLayersappendZLayerRecordZ
LayerGlyphZPaletteIndexZBaseGlyphRecordArrayZLayerRecordArrayZBaseGlyphRecordCountZLayerRecordCount)rC   rD   rE   colorGlyphItemsZbaseGlyphRecordsZlayerRecords	baseGlyphlayersZbaseRec
layerGlyphpaletteIndexZlayerRecs   &&f         r&   populateCOLRv0rb      s'     !'E
 (--/L,	$$&%"%l"3K((.$J~~'H",$0!)	 )/ - ;?>E!7%'%<%<%>"5E""2!#!4!4!6-9*!$%5!6E .Er(   rE   varStorevarIndexMap	clipBoxesallowLayerReuseTc                sf   V ^8  d   QhR\         R\        \        ,          R\        \        \        \        3,          ,          R\        \
        P                  ,          R\        \
        P                  ,          R\        \        \        \        3,          ,          R\        R\        P                  /# )	rB   colorGlyphsversionrE   rc   rd   re   rf   return)_ColorGlyphsDictr	   rI   r   rH   r+   VarStoreZDeltaSetIndexMapr   _ClipBoxInputboolr   table_C_O_L_R_rJ   rL   r&   rM   rM      s     F F!Fc]F wsCx()	F
 r{{#F "--.F S-/01F F Fr(   c               sP   \         P                  ! 4       pVe   V^ 8X  d   \        R4      hVR9   d1   V'       g)   \        V 4      w  rV^ 8X  d   V	'       d   \        R4      hM/ T r\        P
                  ! 4       p
\        WV4       \        V	VVR7      w  V
n        V
n	        Vf   V'       g	   V	'       d   ^M^ pMVR9  d   \        V4      hV;Vn        V
n        V^ 8X  d   VP                  V
4      Vn        V# V'       d   \        V4      MRV
n        WJn        W:n        Wn        V# )a  Build COLR table from color layers mapping.

Args:

    colorGlyphs: map of base glyph name to, either list of (layer glyph name,
        color palette index) tuples for COLRv0; or a single ``Paint`` (dict) or
        list of ``Paint`` for COLRv1.
    version: the version of COLR table. If None, the version is determined
        by the presence of COLRv1 paints or variation data (varStore), which
        require version 1; otherwise, if all base glyphs use only simple color
        layers, version 0 is used.
    glyphMap: a map from glyph names to glyph indices, as returned from
        TTFont.getReverseGlyphMap(), to optionally sort base records by GID.
    varStore: Optional ItemVarationStore for deltas associated with v1 layer.
    varIndexMap: Optional DeltaSetIndexMap for deltas associated with v1 layer.
    clipBoxes: Optional map of base glyph name to clip box 4- or 5-tuples:
        (xMin, yMin, xMax, yMax) or (xMin, yMin, xMax, yMax, varIndexBase).

Returns:
    A new COLR table.
NzCan't add VarStore to COLRv0z$Can't encode COLRv1 glyphs in COLRv0rf   )NrP   )rP      )r   rn   
ValueError_split_color_glyphs_by_versionr+   rF   rb   buildColrV1	LayerListBaseGlyphListZNotImplementedErrorrh   ZVersionZ_decompileColorLayersV0ZColorLayersbuildClipListClipListZVarIndexMaprk   rC   )rg   rh   rE   rc   rd   re   rf   selfrD   colorGlyphsV1Zcolrs   &&$$$$$    r&   	buildCOLRrz      s   > ""$D1788)H'Ek'R$a<MCDD (*;}779D41)4'*&DND&  M!		!'**"))DL4<!|77= K 5>i04& 
Kr(   c                sf    V ^8  d   QhR\         \        \        3,          R\        P                  /# )rB   re   ri   )r   rH   rl   r+   rw   rJ   rL   r&   rM   rM     s(      T#}"45 "++ r(   c                 s    \         P                  ! 4       p^Vn        V P                  4        UUu/ uF  w  r#V\	        V4      bK  	  uppVn        V# u uppi rp   )r+   rw   FormatrW   buildClipBoxZclips)re   ZclipListZnameZbox   &   r&   rv   rv     sJ    {{}HHO?H?PQ?P)$dL--?PQHNO Rs   Ac                sD    V ^8  d   QhR\         R\        P                  /# )rB   clipBoxri   )rl   r+   ClipBoxrJ   rL   r&   rM   rM     s      - BJJ r(   c                 sz   \        V \        P                  4      '       d   V # \        V 4      p\        P                  ! 4       pVR9  d   \	        RV 24      h\        V R,          4      w  Vn        Vn        Vn        Vn	        \        V^8H  4      ^,           Vn        V^8X  d   \        V ^,          4      Vn        V# )   z/Invalid ClipBox: expected 4 or 5 values, found :Nr   N)r   i   )
isinstancer+   r   rY   rq   r   ZxMinZyMinZxMaxZyMaxrI   r|   ZVarIndexBase)r   nZclip   &  r&   r}   r}     s    '2::&&GA::<DJ1#NOO181E.DIty$)TYa1f+/DKAv
OKr(   c                   sD   a a ] tR tRt o^t^t]V 3R l4       tRtVt	V ;t
# )ColorPaletteTypei  c                s   < \        V\        4      '       d0   V^ 8  g   VR,          ^ 8w  d   \        V RV P                   24      h\        SV `  V4      # )rP   i  z is not a valid )r   rI   rq   __name__Zsuper	_missing_)Zclsvalue	__class__s   &&r&   r   ZColorPaletteType._missing_  sN     eS!!uqyEFNa4Gw&6s||nEFFw ''r(   r@   )r   
__module____qualname____firstlineno__ZUSABLE_WITH_LIGHT_BACKGROUNDZUSABLE_WITH_DARK_BACKGROUNDZclassmethodr   __static_attributes____classdictcell__Z__classcell__)r   __classdict__s   @@r&   r   r     s(     #) "(( ( (r(   r   c                s    V ^8  d   QhR\         \        ,          R\        P                  R\        \
        \        ,          ,          /# )rB   labels	nameTableri   )r   _OptionalLocalizedStringr   table__n_a_m_er   r	   rI   rJ   rL   r&   rM   rM   *  s9      -.;C;R;R	(3-r(   c                 s    V  Uu. uF_  p\        V\        4      '       d   VP                  VR R7      M2Vf   \        P                  P
                  MVP                  RV/R R7      NKa  	  up# u upi )F)ZmacZen)r   ZdictZaddMultilingualNamer   table_C_P_A_L_
NO_NAME_ID)r   r   ls   && r&   buildPaletteLabelsr   *  s      A !T"" ))!)7 9 ''2222D!9%2H   s   A%A-c                s   V ^8  d   QhR\         \         \        \        \        \        \        3,          ,          ,          R\        \         \        ,          ,          R\        \         \
        ,          ,          R\        \         \
        ,          ,          R\        \        P                  ,          R\        P                  /# )rB   palettespaletteTypespaletteLabelspaletteEntryLabelsr   ri   )
r
   r   Zfloatr	   r   r   r   r   r   r   rJ   rL   r&   rM   rM   ;  s     [ [xeUE5&@ ABC[8$456[ H%=>?[ !*B!CD	[
 //0[ [r(   c                s   \        V  Uu0 uF  p\        V4      kK  	  up4      ^8w  d   \        R4      hV'       g	   V'       d   V'       g   \        R4      h\        P                  ! 4       p\        V ^ ,          4      Vn        . Vn        \        V 4       F  w  rx. p	\        V4       F  w  r\        V\        4      '       d   \        V4      ^8w  d   \        RV RV
 RV: 24      h\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   \        R	V RV
 R
V: 24      hVw  rrV	P                  \        P                  ! R WW3 4       !  4       K  	  VP                  P                  V	4       K  	  \        ;QJ d    R WV3 4       F  '       g   K   RM	  RM! R WV3 4       4      '       Ed   ^Vn        Veh   \        V4      \        V 4      8w  d$   \        R\        V 4       R\        V4       24      hV Uu. uF  p\        V4      P                  NK  	  upVn        M0\        P                  P"                  .\        V 4      ,          Vn        VeN   \        V4      \        V 4      8w  d$   \        R\        V 4       R\        V4       24      h\%        W$4      Vn        M0\        P                  P(                  .\        V 4      ,          Vn        VeQ   \        V4      VP
                  8w  d%   \        RVP
                   R\        V4       24      h\%        W44      Vn        V# \        P                  P(                  .VP
                  ,          Vn         V# ^ Vn        V# u upi u upi )a4  Build CPAL table from list of color palettes.

Args:
    palettes: list of lists of colors encoded as tuples of (R, G, B, A) floats
        in the range [0..1].
    paletteTypes: optional list of ColorPaletteType, one for each palette.
    paletteLabels: optional list of palette labels. Each lable can be either:
        None (no label), a string (for for default English labels), or a
        localized string (as a dict keyed with BCP47 language codes).
    paletteEntryLabels: optional list of palette entry labels, one for each
        palette entry (see paletteLabels).
    nameTable: optional name table where to store palette and palette entry
        labels. Required if either paletteLabels or paletteEntryLabels is set.

Return:
    A new CPAL v0 or v1 table, if custom palette types or labels are specified.
z%color palettes have different lengthsz?nameTable is required if palette or palette entries have labelszIn palette[z][z$]: expected (R, G, B, A) tuple, got c              3   sD   "   T F  q^8  ;'       g    V^ 8  x  K  	  R# 5i)rp   Nr@   .0v   & r&   	<genexpr>buildCPAL.<locals>.<genexpr>f  s     15aq5>>AE>5s     TFzpalette[z)] has invalid out-of-range [0..1] color: c              3   sF   "   T F  p\        V^,          4      x  K  	  R# 5i)i   N)Zroundr   r   r&   r   r   m  s      S9RAq3w9Rs   !c              3   s(   "   T F  qR Jx  K
  	  R # 5ir*   r@   r   r   r&   r   r   q  s     
T"SQD="Ss   z	Expected z paletteTypes, got z paletteLabels, got z paletteEntryLabels, got )rY   r   	TypeErrorr   r   ZnumPaletteEntriesr   Z	enumerater   tupleZanyr\   ZColorrh   r   r   r   ZDEFAULT_PALETTE_TYPEr   r   r   r   )r   r   r   r   r   pZcpalZiZpaletteZcolorsZjZcolorZredZgreenZblueZalphats   &&&&&            r&   	buildCPALr   ;  s>   0 H%HqCFH%&!+CDD+YM
 	
 ""$D !-DDM)
!'*HAeU++s5zQ#!!Bqc)MeYW  s151sss15111#qcA3&OPUyY  ',#CMM S$s9R ST + 	V$! *$ s
T<@R"S
Tsss
T<@R"S
TTT#< CM1#H.A#lBSATU  EQ QLq!1!!4!:!:L QD!)!8!8!M!M NQTR !D $=!S]2#H.B3}CUBVW  "4M!MD"*"9"9"D"D!EH!UD)%&$*@*@@# 6 67 81235  '99K&WD# K ''22'&&''D# K KG &L !Rs   M>Nc                s0    V ^8  d   QhR\         R\        /# )rB   layerri   )r   rm   rJ   rL   r&   rM   rM     s     
M 
MC 
MD 
Mr(   c                 s     V w  r\        V\        4      ;'       d    \        V\        4      #   \        \        3 d     R # i ; i)F)r   rH   rI   r   rq   )r   r`   ra   r   r&   _is_colrv0_layerr     sG    
M#( 
 *c*LLz,/LL z" s   . AAc                sR    V ^8  d   QhR\         R\        \        \         3,          /# )rB   rg   ri   )rj   r   rG   rJ   rL   r&   rM   rM     s(     ( (!(
//0(r(   c                 s    / p/ pV P                  4        FI  w  r4\        ;QJ d    R  V 4       F  '       d   K   RM	  RM! R  V 4       4      '       d   WAV&   KE  WBV&   KK  	  \        V 4      \        V4      \        V4      ,          8X  g   Q hW3# )c              3   s8   "   T F  p\        V4      x  K  	  R # 5ir*   )r   )r   r   r   r&   r   Z1_split_color_glyphs_by_version.<locals>.<genexpr>  s     3Fq""Fs   FT)rW   ZallZset)rg   rD   ry   r^   r_   s   &    r&   rr   rr     s     MM(..0	33F33333F333'-)$'-)$	 1 {M 2S5G GHHH''r(   c                sn    V ^8  d   QhR\         R\        \        \         \         3,          RR3,          /# )rB   
num_layersri   N)rI   r   r   rJ   rL   r&   rM   rM     s.     	# 	#c 	#ic3ht0K&L 	#r(   c           	   #   s   "   \        V 4       FE  p\        V^,           \        V ^,           V^,           \        ,           4      4       F  pW3x  K
  	  KG  	  R# 5i)rB   N)ZrangeZmin_MAX_REUSE_LEN)r   lbounduboundr   r&   _reuse_rangesr     sM     
# QJJNFQJ,GH
F ""
	 $s   AAc                   sz   a  ] tR tRt o R tV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lt	Rt
V tR# )LayerReuseCachei  c                s0    / V n         / V n        . V n        R # r*   )	reusePooltuples	keepAlive)rx      &r&   __init__ZLayerReuseCache.__init__  s    r(   c                s4   < V ^8  d   QhRS[ P                  /# )rB   r$   )r+   r<   rK   r      "r&   rM   LayerReuseCache.__annotate__  s      "(( r(   c                s   a V3R  loV P                   P                  \        V4      R4      pVf;   S! V4      pW P                   \        V4      &   V P                  P	                  V4       V# )c                 s  < \        V \        P                  4      '       d   V # \        V R 4      '       du   \        ;QJ d8    . V3R l\        V P                  P                  4       4       4       F  NK  	  5# ! V3R l\        V P                  P                  4       4       4       4      # \        V \        P                  P                  4      '       d3   \        ;QJ d    . V3R lV  4       F  NK  	  5# ! V3R lV  4       4      # V # )__dict__c              3   s<   <"   T F  w  rVS! V4      3x  K  	  R # 5ir*   r@   )r   Zkr   _tuple_safes   &  r&   r   DLayerReuseCache._paint_tuple.<locals>._tuple_safe.<locals>.<genexpr>  s       4RDAQA'4Rs   c              3   s4   <"   T F  pS! V4      x  K  	  R # 5ir*   r@   )r   er      & r&   r   r     s     ;U[^^Us   )r   enumZEnumZhasattrr   rV   r   rW   collectionsabcZMutableSequence)r   r   rR   r&   r   Z1LayerReuseCache._paint_tuple.<locals>._tuple_safe  s    %++
++u 4:5>>;O;O;Q4Ru u 4:5>>;O;O;Q4R   E;??#B#BCCu;U;u;u;U;;;Lr(   N)r   getZidr   r\   )rx   r$   Zresultr   s   && @r&   _paint_tupleZLayerReuseCache._paint_tuple  sX    		 ED1> 'F%+KK5	"NN!!%(r(   c                s^   < V ^8  d   QhRS[ S[P                  ,          RS[S[R3,          /# )rB   paintsri   .)r
   r+   r<   r   r   r   r   r&   rM   r     s,     ; ; 2 ;uS#X ;r(   c                sh   a  \         ;QJ d    . V 3R  lV 4       F  NK  	  5# ! V 3R  lV 4       4      # )c              3   sF   <"   T F  pSP                  V4      x  K  	  R # 5ir*   )r   )r   r   rx   r   r&   r   Z,LayerReuseCache._as_tuple.<locals>.<genexpr>  s     :6aT&&q))6s   !)r   )rx   r   s   f&r&   	_as_tupleZLayerReuseCache._as_tuple  s%    u:6:u:u:6:::r(   c                sn   < V ^8  d   QhRS[ S[P                  ,          RS[ S[P                  ,          /# )rB   r_   ri   )r   r+   r<   r   r   r&   rM   r     s+      RXX 4> r(   c                s   R pV'       d   Rp\        \        \        V4      4      R R R7      pV F  w  rEV P                  P	                  V P                  WV 4      R4      pVR8X  d   K;  \        P                  ! 4       p\        \        P                  P                  4      Vn        WT,
          Vn        Wgn        VRV V.,           WR ,           pR p K  	  K  V# )TFc                 sR    V ^,          V ^ ,          ,
          V ^,          V ^ ,          3# r{   r@   )r   r   r&   rS   Z+LayerReuseCache.try_reuse.<locals>.<lambda>  s    qtad{AaD!A$7r(   )rU   ZreverseNi)rV   r   rY   r   r   r   r+   r<   rI   r?   PaintColrLayersr|   r[   rZ   )rx   r_   Zfound_reuseZrangesr   r   Zreuse_lboundZ	new_slices   &&      r&   	try_reuseZLayerReuseCache.try_reuse  s    Kc&k*7F
 #)#~~11NN6#892   2%HHJ	#&r~~'E'E#F	 &,o	#,8)I;6H" #) r(   c                sJ   < V ^8  d   QhRS[ S[P                  ,          RS[/# )rB   r_   first_layer_index)r   r+   r<   rI   r   r   r&   rM   r     s#      $rxx. S r(   c                s    \        \        V4      4       F+  w  r4W2,           V P                  V P                  WV 4      &   K-  	  R # r*   )r   rY   r   r   )rx   r_   r   r   r   s   &&&  r&   addZLayerReuseCache.add  s9    +CK8NF* NN4>>&*?@A 9r(   c                s   < V ^8  d   Qh/ S[ S[S[R3,          S[3,          ;R&   S[ S[S[S[R3,          3,          ;R&   S[S[P                  ,          ;R&   # )rB   .r   r   r   )r   r   r   rI   r   r+   r<   r   r   r&   rM   r     sT     uS#X+,, CsCx())  BHH~ r(   )r   r   r   N)r   r   r   r   r   r   r   r   r   __annotate_func__r   r   r      @r&   r   r     s:     

 ,; ; 2 y  r(   r   c                   sd   a  ] tR tRt o RR/R ltR tV 3R lR ltV 3R lR	 ltV 3R
 ltRt	V t
R# )LayerListBuilderi
  rf   Tc               s   . V n         V'       d   \        4       V n        MR V n        \        4       pV P                  V\
        P                  \        P                  \        P                  P                  3&   \        V4      V n        R # r*   )r_   r   cacherA   _beforeBuildPaintColrLayersr   r>   r+   r<   r?   r   r   tableBuilder)rx   rf   Z	callbackss   &$ r&   r   ZLayerListBuilder.__init__  sm    (*DJDJ )*	 ,, 	**..	
 )3r(   c                s  a a \        VP                  R R4      \        P                  P                  4      '       d   VR ,          pM	VR,          pV Uu. uF  pS P                  V4      NK  	  pp\        V4      ^8X  d   V^ ,          / 3# S P                  e   S P                  P                  V4      p\        V4      \        8  p\        V\        R7      pVV 3R loV Uu. uF  pS! V4      NK  	  pp\        V4      ^8X  d   V^ ,          / 3# \        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.   V'       g&   S P                  P+                  W6P&                  4       V/ 3# u upi u upi )r[   NLayers)r   c                 s   < \        V \        P                  P                  4      '       dD   SP	                  R \
        P                  P                  RV  Uu. uF  pS! V4      NK  	  up/4      # V # u upi )r|   r   )r   r   r   r
   
buildPaintr+   r?   r   )r   r   listToColrLayersrx   s   & r&   r   ZFLayerListBuilder._beforeBuildPaintColrLayers.<locals>.listToColrLayers=  sf    %!9!9:: ".."@"@ "F1#3A#6"F  L #Gs   A1)r   r   r   r   r
   r   rY   r   r   MAX_PAINT_COLR_LAYER_COUNTr   r+   r<   rI   r?   r   r|   r[   r_   rZ   Zextendr   )rx   Zdestr%   r_   r   Zis_treer$   r   s   f&&    @r&   r   Z,LayerListBuilder._beforeBuildPaintColrLayers#  s{    fjjd3[__5M5MNNK(FH%F /55f$//!$f5 v;!!9b= ::! ZZ))&1F f+ ::!&,FG	 066v!"1%v6 v;!!9b= 
2>>99:f+ #DKK 06" ::!'JJNN6#8#89 by[ 66 7s   G"Gc                s:   < V ^8  d   QhRS[ RS[P                  /# )rB   r$   ri   )r   r+   r<   r   r   r&   rM   LayerListBuilder.__annotate__[  s     8 8 8 8r(   c                sV    V P                   P                  \        P                  V4      # r*   )r   buildr+   r<   )rx   r$   s   &&r&   r   ZLayerListBuilder.buildPaint[  s      &&rxx77r(   c                sD   < V ^8  d   QhRS[ S[P                  ,          /# )rB   ri   )r	   r+   rt   r   r   r&   rM   r   ^  s      x- r(   c                s    V P                   '       g   R # \        P                  ! 4       p\        V P                   4      Vn        V P                   Vn        V# r*   )r_   r+   rt   rY   Z
LayerCountr<   )rx   r_   r   r&   r   ZLayerListBuilder.build^  s:    {{{,{{r(   c                sb   < V ^8  d   Qh/ S[ S[P                  ,          ;R&   S[;R&   S[;R&   # )rB   r_   r   rf   )r   r+   r<   r   rm   r   r   r&   rM   r   
  s0     N    r(   )r   r_   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r&   r   r   
  s3     
4$ 4(6p8 8 i  r(   r   c                s\    V ^8  d   QhR\         R\        R\        R\        P                  /# )rB   r^   layerBuilderr$   ri   )rH   r   r   r+   ru   rJ   rL   r&   rM   rM   g  s2      "2;Fr(   c                 sh    \         P                  ! 4       pWn        VP                  V4      Vn        V# r*   )r+   BaseGlyphPaintRecordrX   r   r<   )r^   r   r$   rx   s   &&& r&   buildBaseGlyphPaintRecordr   g  s.     ""$DN((/DJKr(   c                sR    V ^8  d   QhR\         \        \        3,          R\        /# )rB   errorsri   )r   rH   Z	ExceptionrJ   rL   r&   rM   rM   p  s#      i!8 S r(   c           	      s    . p\        V P                  4       4       F2  w  r#VP                  R V R\        V4      P                   RV 24       K4  	  RP                  V4      # )z    z => z: Z
)rV   rW   r\   Ztyper   Zjoin)r   Zlinesr^   Zerrorr~   r&   _format_glyph_errorsr   p  sX    E"6<<>2	tI;d4;+?+?*@5'JK 399Ur(   c          
      s    V ^8  d   QhR\         R\        \        \        \        3,          ,          R\
        R\        \        \        P                  ,          \        P                  3,          /# )rB   rg   rE   rf   ri   )
rj   r	   r   rH   rI   rm   r   r+   rt   ru   rJ   rL   r&   rM   rM   w  sW     ! !!!wsCx()! 	!
 8BLL!2#3#334!r(   c                sD  a Se!   \        V P                  4       V3R lR7      pMV P                  4       p/ p. p\        VR7      pV F!  w  rx VP                  \	        WvV4      4       K#  	  V'       dC   \        V4      p
\        RV
 24      pWKn
        V\        \        VP                  4       4      4      hVP                  4       p\        P                   ! 4       p\#        V4      Vn        W]n        W3#   \
        \        \        \        3 d   p	YT&    R p	?	K  R p	?	ii ; i)Nc                 rN   rO   r@   rQ   rR   r&   rS   ZbuildColrV1.<locals>.<lambda>  s    (472Cr(   rT   ro   zFailed to build BaseGlyphList:
)rV   rW   r   r\   r   r   ZOverflowErrorrq   r   r   r   ZnextZiterZvaluesr   r+   ru   rY   ZBaseGlyphCountr   )rg   rE   rf   r]   r   Z
baseGlyphsr   r^   r$   r   Zfailed_glyphsZexcr_   Zglyphss   &f$           r&   rs   rs   w  s	     %C
 &++-FJ#ODL+		"7	QVWX , ,V4>}oNO
tD122!FF
OF", }j)D 	" !9	"s   C55DDDr*   )NNNN)RZ__doc__r   Zcopyr   Z	functoolsr    Zmathr   r   Ztypingr   r   r   r   r   r   r	   r
   r   r   r   r   ZfontTools.misc.arrayToolsr   ZfontTools.misc.fixedToolsr   ZfontTools.misc.treeToolsr   ZfontTools.ttLib.tablesr   r   r   r   r+   ZfontTools.ttLib.tables.otTablesr   r   r   r   Zgeometryr   Ztable_builderr   r   r   rH   Z_KwargsrI   r<   r   Z_PaintInputListrj   rG   r   rl   r   r-   r   r'   r1   r3   r9   r;   r=   rA   rb   rz   rv   r}   ZIntFlagr   r   r   r   r   rr   r   r   r   r   r   rs   r@   r(   r&   <module>r      s  
         . 2 5 + + + 1 E ! ; 6 CL
#s(
C"((E#}2D,EEF;'U?K#?@@A #xc3h889 	#sCc
!"	#sC
JJ ! 4:+/\F -1	F
 '+F 26F 59F !F FR	(t|| 	( !sDcN!:; "[D
M("	#@ @FZ Zz! !	! !r(   