
    }fP                        d Z ddlT ddlmZ ddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z"m#Z# ddl$Z$ddl%Z% e$j&        d          Z'dZ(dZ)dZ*dZ+ G d d          Z,	 	 	 d"de(e)e+dddZ- ee-          d             Z.d Z/d Z0d#d Z1e2d!k    r2ddl3Z3 e1            Z4 e3j5         e6 e7e4                               dS dS )$z
Tool to find wrong contour order between different masters, and
other interpolatability (or lack thereof) issues.

Call as:
$ fonttools varLib.interpolatable font1 font2 ...
   )*)test_contour_order)test_starting_point    )RecordingPenDecomposingRecordingPenlerpRecordings)TransformPen)StatisticsPenStatisticsControlPen)OpenContourError)piecewiseLinearMapnormalizeLocation)floatToFixedToStr)	Transform)defaultdict)SimpleNamespace)wraps)pformat)sqrtatan2piNzfontTools.varLib.interpolatablegffffff?g      ?gMb`?i  c                   ,    e Zd ZdZd Zd Zd ZddZdS )Glyph)	
recordings
greenStatscontrolStatsgreenVectorscontrolVectors	nodeTypesisomorphismspointsopenContoursc                 t    || _         | j        D ]}t          | |g            |                     |           d S N)nameITEMSsetattr	_populate)self	glyphnameglyphsetitems       X/var/www/rtfcompare/venv/lib/python3.11/site-packages/fontTools/varLib/interpolatable.py__init__zGlyph.__init__4   sG    	J 	$ 	$DD$####x         c                     | j         D ]F}t          t          | |                    |k    r#t          | |                              d            Gd S r%   )r'   lengetattrappend)r*   ixr-   s      r.   _fill_inzGlyph._fill_in:   sY    J 	1 	1D74&&''2--d##**4000	1 	1r0   c                    || j                  }|d u | _        | j        rd S t          t          |          }	 |                    |d           n%# t
          $ r |                    |           Y nw xY w|j        | _        ~t          | j                  D ]6\  }}d |j        D             }| j	        
                    |           t          |          }t          |          }	 |                    |           |                    |           | j        
                    d           nF# t          $ r9}	| j        
                    d           |                     |           Y d }	~	d }	~	ww xY w| j        
                    |           | j        
                    |           | j        
                    t)          |                     | j        
                    t)          |                     |d         dk    r|                     |           |d         dk    sJ |d	         d
v sJ t-                      }
t/          |
d          }|                    |           | j        
                    |
j                   g }| j        
                    |           t5          |
j        |d           t5          |
j        |d           8d S )Nr,   T)outputImpliedClosingLinec                     g | ]\  }}|S  r;   ).0opargs      r.   
<listcomp>z#Glyph._populate.<locals>.<listcomp>N   s    999C999r0   Fr   addComponentmoveTo)	closePathendPath)r&   doesnt_existPerContourOrComponentPenr   draw	TypeErrorvaluer   	enumerater    r4   r   r   replayr#   r   r6   r   r   r   contour_vector_from_statsr   SimpleRecordingPointPenSegmentToPointPenr"   r!   add_isomorphisms)r*   r,   glyphperContourPenr5   contourr    r   r   er"   	converterr!   s                r.   r)   zGlyph._populate?   s   #!TM 	F0QQQ	&JJ}tJDDDD 	& 	& 	&JJ}%%%%%	&'-$T_55 (	? (	?KB997=999IN!!),,,&999J/BBBLz***|,,,!((////#   !((...b!!! O"":...$$\222$$%>z%J%JKKK&&'@'N'NOOO |~--b!!!Q<8++++R=$<<<<<,..F)&%88INN9%%% Kv|,,,L$$\222 V\<???V\<>>>>Q(	? (	?s*   A A10A1'AD,,
E/6/E**E/Nc                     |!| j         D ]}|                    |           d S | j         |                             |           d S r%   )r   rG   )r*   pencountor_idxrR   s       r.   rG   z
Glyph.draww   s[    ? " "S!!!!" " OK(--c22222r0   r%   )__name__
__module____qualname__r'   r/   r6   r)   rG   r;   r0   r.   r   r   '   s]        
E! ! !1 1 1
6? 6? 6?p3 3 3 3 3 3r0   r   F)	locations	tolerance	kinkinessupemshow_allc             #   h   UVWXYZK   |dk    r|dz  }d|cxk    rdk    sn J |dk    r|dz  }d|k    sJ |pd  D             }|d  D             }t           |          \  Y}	 Yfd}
|D 
]Ut                              dU           Ufd	 D             }t          d
 |D                       dk    rJt	          t          | |                    D ]`\  }\  }}}|j        r|sUt          j        ||dfV  'd}t	          |j	                  D ]\  }}|sd}Ut          j
        |||dfV   |r`ad gt                     z  }|	D 	]}||         }||j        s |
|U          }|$||         }||j        s6|j        V|j        }t          |          t          V          k    r?Ut          j        ||         ||         ||t          |          t          V          dfV  |Vk    rt	          t          |V                    D ]\  }\  }}||k    rt          |          t          |          k    r@Ut          j        |||         ||         ||t          |          t          |          dfV  ot	          t          ||                    D ]5\  }\  }}||k    r'Ut          j        ||||         ||         ||||d	fV  56t          ||          \  }} ||k     rQUt          j        ||         ||         ||t#          t%          t          |                               | |dfV  | ||<   |j        }!|j        W|j        }"|j        X|j        }#|j        Z||         } | ,Wr*Wfd| D             WXfd| D             XZfd| D             Zg }$t          |#Z          D ]z\  }%}&	 t-                      }'t#          t/          |%j        |&j                            |'_        |$                    |'           V# t4          $ r |$                    d            Y ww xY wt	          t          |!W                    D ]\  }\  }(})|(5|)3t          |(          dk    s t          |(          t          |)          k    rAt7          |||||           \  }}*}+||k     r'Ut          j        |||         ||         ||d|*|+|d
fV  |$|         },|,r|"|         d         dk     X|         d         dk     k    rXt;          d           }-|,                    |-           t?          |-          }.|"|         }/X|         }0|/d         |/d         z  }1|0d         |0d         z  }2|.d         |.d         z  }3t	          t          j         t          j!        f          D ]\  }4}5|4rtE          |1|2          }6tG          |1|2z            }6t          $                    d|5|3|6|1|2           |4s|6|z  |3dz   k    s|4rbd|6|z  z   |3k     rV	 |4r|6|3z  }n|3|6z  }n# tJ          $ r d}Y nw xY wt          $                    d|           U|5|||         ||         |||dfV  |j&        }|j&        V||         VrVfd||         D             Vd}7|tN          z  tP          z  |z  }8t	          t          |V                    D ]L\  }\  }(})|(5|)3t          |(          dk    s t          |(          t          |)          k    rAt%          t          |(                    D ]}9|(|9         }:|)|9         };|:d         r|;d         s$|(|9dz
           }<|)|9dz
           }=|(|9dz   t          |(          z           }>|)|9dz   t          |)          z           }?|<d         r	|=d         r|<d         r	|=d         rtS          |:d          }:tS          |;d          };tS          |<d          }<tS          |=d          }=tS          |>d          }>tS          |?d          }?|:|<z
  }@|>|:z
  }A|;|=z
  }B|?|;z
  }C|@j*        |Aj+        z  |@j+        |Aj*        z  z
  }D|Bj*        |Cj+        z  |Bj+        |Cj*        z  z
  }E	 |DtY          |@          tY          |A          z  z  }D|EtY          |B          tY          |C          z  z  }En# tJ          $ r Y w xY wtY          |D          |7k    stY          |E          |7k    r|@j*        |Aj*        z  |@j+        |Aj+        z  z   }F|Bj*        |Cj*        z  |Bj+        |Cj+        z  z   }G|Fdk     s|Gdk     r	tY          |@          tY          |@          tY          |A          z   z  }HtY          |B          tY          |B          tY          |C          z   z  }ItY          |H|Iz
            }JtY          |J          |7k     r|:|;z   dz  }K|<|=z   dz  }L|>|?z   dz  }M|K|Lz
  }N|M|Kz
  }O|Nj*        |Oj+        z  |Nj+        |Oj*        z  z
  }P	 |PtY          |N          tY          |O          z  z  }Pn# tJ          $ r Y  w xY wtY          |P          ||z  z  |7k    r|PtY          |N          z  tY          |O          z  }QtY          |N|Oz             }RtY          |Q|Rz            }S|S|8k     rm|S|Rz  }T|T|7k    rz|7tY          |P          |z  z  }t          $                    d|S|T|P|J           t          $                    d|           Ut          j-        |||         ||         |||9|d fV  N|r"Ut          j.        ||         ||         ||d!fV  	
d S )"N
   g{Gz?r   r   c                 ,    g | ]}t          |          S r;   )repr)r<   gs     r.   r?   ztest_gen.<locals>.<listcomp>   s    111!d1gg111r0   c                 @    h | ]}|                                 D ]}|S r;   keys)r<   r,   rd   s      r.   	<setcomp>ztest_gen.<locals>.<setcomp>   s-    GGGx}}GG!!GGGGr0   c                     | d S |          } | d S |          ,|          |         |          } |          |          |         | S r%   r;   )ir+   	glyphsetsparentss     r.   grand_parentztest_gen.<locals>.grand_parent   s`    94AJ94aj$1i)@)H
A aj$1i)@)Hr0   zTesting glyph %sc                 0    g | ]}t          |          S r;   )r   )r<   r,   
glyph_names     r.   r?   ztest_gen.<locals>.<listcomp>   s#    KKKXU:x00KKKr0   c                     g | ]}|dS )Nr   r;   )r<   rP   s     r.   r?   ztest_gen.<locals>.<listcomp>   s    >>>eE,=,=,=,=r0   )typemaster
master_idxFT)rq   rr   rs   rR   )rq   master_1master_2master_1_idxmaster_2_idxvalue_1value_2)rq   pathrt   ru   rv   rw   rx   ry   )	rq   rz   nodert   ru   rv   rw   rx   ry   )rq   rt   ru   rv   rw   rx   ry   r\   c                      g | ]
}|         S r;   r;   )r<   rj   m1Isomorphismss     r.   r?   ztest_gen.<locals>.<listcomp>6  s    !F!F!F."3!F!F!Fr0   c                      g | ]
}|         S r;   r;   )r<   rj   	m1Vectorss     r.   r?   ztest_gen.<locals>.<listcomp>7  s    <<<aYq\<<<r0   c                      g | ]
}|         S r;   r;   )r<   rj   
recording1s     r.   r?   ztest_gen.<locals>.<listcomp>8  s    >>>jm>>>r0   )
rq   rR   rt   ru   rv   rw   rx   ry   reversedr\   r8   z;%s: actual size %g; threshold size %g, master sizes: %g, %ggh㈵>ztolerance %g)rq   rR   rt   ru   rv   rw   r\   c                      g | ]
}|         S r;   r;   )r<   rj   m1s     r.   r?   ztest_gen.<locals>.<listcomp>  s    666be666r0   g?   z=kink: deviation %g; deviation_ratio %g; sin_mid %g; r_diff %g)rq   rR   rt   ru   rv   rw   rI   r\   )rq   rt   ru   rv   rw   )/find_parents_and_orderloginfor2   rJ   ziprE   InterpolatableProblemMISSINGr#   	OPEN_PATHr    
PATH_COUNT
NODE_COUNTNODE_INCOMPATIBILITYr   CONTOUR_ORDERlistranger!   r   r   r   r	   rI   r4   
ValueErrorr   WRONG_START_POINTr   rK   rL   UNDERWEIGHT
OVERWEIGHTmaxr   debugZeroDivisionErrorr"   DEFAULT_KINKINESS_LENGTHDEFAULT_KINKINESScomplexrealimagabsKINKNOTHING)[rk   glyphsnamesignore_missingr[   r\   r]   r^   r_   orderrm   	allGlyphsrs   rP   r,   r&   has_openr5   open	matchingsm1idxglyph1m0idxglyph0m0pathIxnodes1nodes2nodeIxn1n2this_tolerancematchingm0Isomorphisms	m0Vectors
recording0midRecordingc0c1rcontour0contour1proposed_pointreverserR   midStats	midVectorm0Vecm1Vecsize0size1midSize
overweightproblem_typeexpectedSizetdeviation_thresholdrj   pt0pt1pt0_prevpt1_prevpt0_nextpt1_nextd0_prevd0_nextd1_prevd1_nextsin0sin1dot0dot1r0r1r_diffmidmid_prevmid_nextmid_d0mid_d1sin_midcrossarc_len	deviationdeviation_ratioro   r   r}   r   rl   r   s[   `                                                                                    @@@@@@r.   test_genr      s      BT		QBT		>>>>111y111E~ HGIGGG+IyAANGU       ^ ^
#Z000KKKKKKK	>>y>>>??1DD3<	9e,,4
 4
 	 	/J/$ ! 
% "$9$A&**4     H%e&899  D  5 ?"&&0#%	        FS^^+	 w	 w	Eu%F~V%5~ L
33E}u%F~V%5~ !B!B2ww#b''!! 5 @$)%L$)%L(-(-#&r77#&r77     Rxx09#b"++0F0F "% "%,F,VV'' 6{{c&kk11&(=(H(.,1%L,1%L0505+.v;;+.v;;	 	    !,5c&&6I6I,J,J % %(R88 *,A,V,2,205e05e4949/1/1
!" 
!"#    % $%, (:&&'I'I$NH	)) 5 C$)%L$)%L(-(-#'c(mm(<(<#=#=#+%3	 	    $,	%  $0N#0N+I+I*J*J !'H$$!F!F!F!FX!F!F!F<<<<8<<<	>>>>X>>>
Lj*55 . .B.$A">"(BH#E#EFFAG ''****! . . . ''-----. -6NN33- - b b((Xx $'8}}))8}}H55 :MFB	8; ;7 "I--"$9$K')(-e(-e,1,1'('5(/)7    . 'r* 7	"a 01 4)B-:JQ:NOO,d;;;HNN8,,, 9( C CI%bME%bME!!HuQx/E!!HuQx/E'lYq\9G4=1=1<5 5 + +0
L & ?+.ue+<+<L$+/+>+>L		Y(#(!!   !+/;i/G'TX./X/X( 0Y-1L94L-Lw-V-V3#- !L5AG5KNN5<|5KN#4 3 3 3123IInnEEE *,8/105e05e49491?!" !"#     BB ++6666Yu%5666A//2CCiO   -6c"bkk,B,B | |((Xx$'8}}))8}}H55 
 s8}}-- n nA"1+C"1+Cq6 !Q ! 'AH'AH'Q#h--(?@H'Q#h--(?@H{ !x{ ! { !x{ ! !3q6*C!3q6*C&4H&4H&4H&4H "HnG&nG!HnG&nG"<',69TTD"<',69TTD!Gs7|| ;;Gs7|| ;;, ! ! ! ! 4yy1}}D		A  #<',69TTD"<',69TTDaxx4!88  WWG)DEBWWG)DEB b\\F6{{Q 9/C (8 3q8H (8 3q8H 8^F%^F$kFK7&+:SSG!3v;;V#<<, ! ! ! ! 7||y9'<=BB  $c&kk1CKK?E!&6/22G #EGO 4 4I #666 &/'&9O&** %&#g,,*B%CNIIW!'   IInn==="$9$>')(-e(-e,1,1%&)7	 	    Enh  
 5 =$)%L$)%L(-(- 	 	 	 	]w	O^ ^sJ   9AP		P+	*P+	XX! X!Ab
b+*b+)"h
hhc                      t          t                    }t          | i |D ] \  }}||                             |           !|S r%   )r   r   r   r4   )argskwargsproblemsr+   problems        r.   testr   F  sQ    4  H&777 , ,	7""7++++Or0   c                     | |v rd S ||          || <   t          ||          dg           D ]}t          |j        |||           d S )N
components)r3   recursivelyAddGlyph	glyphName)r+   r,   
ttGlyphSetglyf	components        r.   r   r   N  sh    H$Y/HYT)_lB?? M M	I/:tLLLLM Mr0   c                 t    t           j                            |           }|rt          j        |d           | S )NT)exist_ok)osrz   dirnamemakedirs)rz   r   s     r.   ensure_parent_dirr   W  s7    good##G ,
Gd++++Kr0   c                 |#  IJKLM ddl }ddl}|                    dt          j                  }|                    ddd           |                    d	d
d           |                    ddt          dt          z             |                    ddt          dt          z             |                    dd
d           |                    ddd           |                    ddd           |                    ddd           |                    dd
d           |                    ddd           |                    dd
d           |                    dd t          d!d"#           |                    d$d%t          d&d'(           |                    d)d*d
d+           |                    d,d
d-           |
                    |           } dd.lm}  || j        rd/nd01           | j        r |d21           | j        r| j                                        nd}dd3lm} g }g }g }	t&          }
t)          | j                  }t-          | j                  d4k    rd}| j        d                             d5          rdd6lm} |                    | j        d                   }d7 |j        D             | _        d8 |j        D             }	d9 |j        D             Ld: |j        D             KKfd;L                                D             Ln| j        d                             d<          rdd=lm}m }  || j        d                   }|j!        }
 ||          }d> |j        D             }d? |D             }g | _        d@ |j        D             }	dA |j        D             LdB |j        D             KKfdCL                                D             Ln!| j        d                             dD          r ddEl"m#}  || j        d                   }|dF         j$        }
dG|v r|dH         }i J|j        D ]}|j%        |j&        |j'        dIJ|j(        <    dJ}dK|v r|dK         }tS          |j*        dLd          rdM JD             JdN}nl|j+                                        D ]R\  }}J|         ,                                }|                                D ]\  }}t[          ||          J|         |<   S|dG         }|dO         }i }t]          t^                    }|&ta          |j1        2                                          }|D ]} |j1        |          D ]}!i }"g }#ta          |!j                                                  D ]-\  }$}%|%d4         |"|$<   |#3                    |$|%d4         f           .t)          |#          }&|&|vr|4                    |"dNdJP          ||&<   tk          | ||&         ||&         |           dQg}|4                                g}i g}	dR ta          J2                                          D             Lta          |2                                dS T          D ]}&dUdV6                    JfdW|&D                       z   dUz   }'|r|'dXz  }'|3                    |'           |3                    ||&                    |	3                    t_          |&                     dN| _7        g | _        |	sdY |D             }	| j        D ]}(|(                    dZ          rQdd[l8m9})  |)|(          }tu                      }*|;                    |*           |*j$        }
|3                    |           n3ddEl"m#}  ||(          }|dF         j$        }
|3                    |           |3                     ||(          <                    d\d4          d                    g }|D ]\}t{          |d]          r|4                                Mn|M|3                    Mfd^M2                                D                        ]| j>        rZt          | j>                  IIfd_t          ||          D             }Ifd`t          ||	          D             }	Ifda|D             }|s&ta          t          db |D                                 }t          |          }+|D ]4Mt          M2                                          },|+|,z
  }-|-r
|-D ]}.dM|.<   5Lfdc|	D             }	| jA        pt          }/| jB        | jB        nt          }0	 t          D                    ddt-          |                     t          D                    det          |	                     t          ||||	|
| j7        |/|0| jG        f	  	        }1t]          t                    }2| jI        |jJ        n!t          t          | jI                  dg          }3| jM        s| jN        rMddlN}4|1D ] \  } }5|2|          3                    |5           !t          |4P                    |2          |3h           nd}6|1D ]\  } }7|2|          3                    |7           | |6k    rt          di|  dj|3h           | }6d}8dk|7v r|7dk         n|7dl         |7dm         f}9|9|8k    rEdn|7v r|7dn         n|7do         |7dp         f}:t          dqdr6                    |:          z  |3h           |9}8|7ds         t          jR        k    rt          dt|7dn         z  |3h           |7ds         t          jS        k    rt          du|7dn         z  |3h           
|7ds         t          jT        k    r2t          dv|7dw         |7do         |7dx         |7dp         fz  |3h           R|7ds         t          jU        k    r9t          dy|7dz         |7dw         |7do         |7dx         |7dp         fz  |3h           |7ds         t          jV        k    r@t          d{|7d|         |7dz         |7dw         |7do         |7dx         |7dp         fz  |3h           |7ds         t          jW        k    r7t          d}|7dw         d~|7do         dr|7dx         d~|7dp         |3h           D|7ds         t          jX        k    r@t          d|7d         |7dw         |7do         |7dx         |7dp         |7d         fz  |3h           |7ds         t          jY        k    r+t          d|7d         |7do         |7dp         fz  |3h           |7ds         t          jZ        k    r+t          d|7d         |7do         |7dp         fz  |3h           |7ds         t          j[        k    r2t          d|7d         |7d         |7do         |7dp         fz  |3h           d|7ds         t          j\        k    r#t          d|7do         d|7dp         |3h           n#|1D ] \  } }5|2|          3                    |5           !t          |2          }2dD ]}7tS          | |7          };|;t          D                    d|7^                                |;           d4dl_m`}<ma}= |7dk    r|<n|=}> |>t          |;          ||          5 }?|?b                    ||/|0           |2r|?c                    |2           |?d                    |2           |2s| jM        s|?e                                 |2r(|?f                                 |?g                                 ddd           n# 1 swxY w Y   | jh        r#t          D                    d| jh                   d4dl_mi}@ g }Ai }B |@|A||          5 }C|Cb                    |dJ|/|0           |2                                D ]1\  }D}E|D|Bt-          |A          <   |Cd                    |D|EidJdJ           2|2s| jM        s|Ce                                 ddd           n# 1 swxY w Y   ddlj}Ft          t          | jh                  d          5 }3|3k                    d           |3k                    d           |3k                    d           t          |A          D ]\  }G}C|G|Bv r2|3k                    d|B|G          dm                    d                     |3k                    dm                    d                     |3k                    |Fn                    |C                     |3k                    d           |3k                    d           |3k                    d           ddd           n# 1 swxY w Y   n=# t          $ r0}H|Hxjp        |z  c_p        t          q                    |H            d}H~Hww xY w|2r|2S dS )z/Test for interpolatability issues between fontsr   Nzfonttools varLib.interpolatable)descriptionz--glyphsstorez&Space-separate name of glyphs to check)actionhelpz
--show-all
store_truez3Show all glyph pairs, even if no problems are foundz--tolerancez,Error tolerance. Between 0 and 1. Default %s)r   rq   r  z--kinkinessz)How aggressively report kinks. Default %sz--jsonzOutput report in JSON formatz--pdfzOutput report in PDF formatz--psz"Output report in PostScript formatz--htmlzOutput report in HTML formatz--quietz%Only exit with code 1 or 0, no outputz--outputz3Output file for the problem report; Default: stdoutz--ignore-missingz<Will not report glyphs missing from sparse masters as errorsinputsFILE+zSInput a single variable font / DesignSpace / Glyphs file, or multiple TTF/UFO files)metavarrq   nargsr  z--nameNAMEr4   zGName of the master to use in the report. If not provided, all are used.)r  rq   r   r  z-vz	--verbosezRun verbosely.z--debugzRun with debug output.)configLoggerINFOERROR)levelDEBUG)basenamer   z.designspace)DesignSpaceDocumentc                     g | ]	}|j         
S r;   )rz   r<   rr   s     r.   r?   zmain.<locals>.<listcomp>  s    III66;IIIr0   c                     g | ]	}|j         
S r;   locationr  s     r.   r?   zmain.<locals>.<listcomp>      KKKVKKKr0   c                 B    i | ]}|j         |j        |j        |j        fS r;   r&   minimumdefaultmaximumr<   as     r.   
<dictcomp>zmain.<locals>.<dictcomp>  6       >?AIqy9  r0   c                 (    i | ]}|j         |j        S r;   r&   mapr  s     r.   r  zmain.<locals>.<dictcomp>      EEEqQVQUEEEr0   c                 R    i | ]"\  }t          fd |D                       #S )c              3   ^   K   | ]'}t          |t                                       V  (d S r%   r   dictr<   vaxis_mappingsks     r.   	<genexpr>z"main.<locals>.<dictcomp>.<genexpr>  ;      SS1+AtM!4D/E/EFFSSSSSSr0   tupler<   vvr*  r)  s     @r.   r  zmain.<locals>.<dictcomp>  Q       Ar 5SSSSSPRSSSSS  r0   )z.glyphsz.glyphspackage)GSFontto_designspacec                     g | ]	}|j         
S r;   )font)r<   sources     r.   r?   zmain.<locals>.<listcomp>  s    CCCVV[CCCr0   c                 D    g | ]}|j         j        d |j         j        S )-)r   
familyName	styleName)r<   fs     r.   r?   zmain.<locals>.<listcomp>  s0    TTT 1 1 1163C3CDTTTr0   c                     g | ]	}|j         
S r;   r  r  s     r.   r?   zmain.<locals>.<listcomp>  r  r0   c                 B    i | ]}|j         |j        |j        |j        fS r;   r  r  s     r.   r  zmain.<locals>.<dictcomp>  r  r0   c                 (    i | ]}|j         |j        S r;   r   r  s     r.   r  zmain.<locals>.<dictcomp>  r"  r0   c                 R    i | ]"\  }t          fd |D                       #S )c              3   ^   K   | ]'}t          |t                                       V  (d S r%   r%  r'  s     r.   r+  z"main.<locals>.<dictcomp>.<genexpr>  r,  r0   r-  r/  s     @r.   r  zmain.<locals>.<dictcomp>  r1  r0   z.ttf)TTFontheadgvarfvarrB   r   r   FavarVarStorec                     i | ]	}|d ddd
S )rB   r   r   rE  r;   )r<   tags     r.   r  zmain.<locals>.<dictcomp>  s$    &X&X&XSsa,@,@&X&X&Xr0   Tr   )r  
normalizedrecalcBoundsz''c                     i | ]}|d S )rE  r;   r  s     r.   r  zmain.<locals>.<dictcomp>#  s    SSS1;SSSr0   c                 $    t          |           | fS r%   )r2   )r(  s    r.   <lambda>zmain.<locals>.<lambda>$  s    APQ{ r0   )key' c           
   3   p   K   | ]0\  }}|d t          t          ||                   d          V  1dS )=   N)r   r   )r<   r*  r(  axisMappings      r.   r+  zmain.<locals>.<genexpr>'  sk       	# 	# !%1 !" 1$6q+a.$I$I2!" !" !"	# 	# 	# 	# 	# 	#r0   z (normalized)c                     g | ]}i S r;   r;   )r<   _s     r.   r?   zmain.<locals>.<listcomp><  s    '''AR'''r0   z.ufo)	UFOReader.getGlyphSetc                 "    i | ]}||         S r;   r;   )r<   r*  r,   s     r.   r  zmain.<locals>.<dictcomp>V  s    BBBQ!Xa[BBBr0   c                 "    g | ]\  }}|v 	|S r;   r;   )r<   r&   r,   accepted_namess      r.   r?   zmain.<locals>.<listcomp>Z  2     
 
 
h~%% %%%r0   c                 "    g | ]\  }}|v 	|S r;   r;   )r<   r&   r  r]  s      r.   r?   zmain.<locals>.<listcomp>_  r^  r0   c                     g | ]}|v |	S r;   r;   )r<   r&   r]  s     r.   r?   zmain.<locals>.<listcomp>d  s#    BBB$4>+A+A+A+A+Ar0   c                 @    g | ]}|                                 D ]}|S r;   rf   )r<   r,   gns      r.   r?   zmain.<locals>.<listcomp>g  s-    TTTHHMMOOTTbRTTTTr0   c                 0    g | ]}t          |          S r;   )r   )r<   locaxis_tripless     r.   r?   zmain.<locals>.<listcomp>r  s$    KKK#"355KKKr0   zRunning on %d glyphsetszLocations: %s)r   r   r[   r^   r   r\   r]   r_   w)filezGlyph z was not compatible:rs   rv   rw   rr   rt   ru   z  Masters: %s:z, rq   z"    Glyph was missing in master %sz'    Glyph has an open path in master %sz*    Path count differs: %i in %s, %i in %srx   ry   z5    Node count differs in path %i: %i in %s, %i in %srz   z7    Node %o incompatible in path %i: %s in %s, %s in %sr{   z    Contour order differs: z in zD    Contour %d start point differs: %s in %s, %s in %s; reversed: %srR   r   z3    Contour %d interpolation is underweight: %s, %sz2    Contour %d interpolation is overweight: %s, %sz'    Contour %d has a kink at %s: %s, %srI   z    Showing z and )pspdfzWriting %s to %s)InterpolatablePSInterpolatablePDFrh  )rk   r   )r\   r]   zWriting HTML to %s)InterpolatableSVG)show_tolerancer\   r]   )rm  show_page_numberwbs   <!DOCTYPE html>
sN   <html><body align="center" style="font-family: sans-serif; text-color: #222">
s6   <title>fonttools varLib.interpolatable report</title>
z
<h1>Glyph z</h1>
zutf-8z$<img src='data:image/svg+xml;base64,s   ' />
s   <hr>
s   </body></html>
)rargparsesysArgumentParsermain__doc__add_argumentfloatDEFAULT_TOLERANCEr   str
parse_args	fontToolsr	  verboser   r   splitos.pathr  DEFAULT_UPEMr.  r  r2   endswithfontTools.designspaceLibr  fromfilesourcesaxesitems	glyphsLibr2  r3  upmfontTools.ttLibrA  
unitsPerEmminValuedefaultValuemaxValueaxisTagr3   tablesegmentscopyr   r   r&  sorted
variationsrg   r4   rZ  r   joinr   fontTools.ufoLibrX  r   readInforsplithasattrr&   setr   r\   r]   r   r   r   r   r_   r   outputstdoutr   r   quietjsonprintdumpsr   r   r   r   r   r   r   r   r   r   r   r   sort_problemsupperinterpolatablePlotrj  rk  add_title_pageadd_summaryadd_problemsdraw_cupcake	add_indexadd_table_of_contentshtmlrl  base64writerJ   encode	b64encode	Exceptionr   error)Nr   rp  rq  parserr	  r   r  fontsr   r[   r^   original_args_inputsdesignspacer  r2  r3  gsfontrA  r5  rD  axisrJ  rF  r  r  fvarMappingr  rI   rC  r   ttGlyphSetsrk   r+   varlocDictrd  rI  vallocTupler&   filenamerX  r   	glyphsSetglyphSetGlyphNamesdiffrb  r\   r]   problems_genr   r;  r  r   last_glyphnameplast_master_idxsmaster_idxsmaster_namesr>   rj  rk  PlotterClassdocrl  svgsglyph_startssvgrP   glyph_problemsr  rj   rS   r]  rU  r)  re  r,   sN                                                                            @@@@@r.   rs  rs  ^  s)   OOOJJJ$$)L %  F 5    
 B    
 ;>OO	     8;LL	     +    
 *    
 1    
 +    
 4    
 B    
 K    
 b     V     k,EUVVV
	,=UVVVT""D&&&&&&L$,;G====z $7####$(K9T[   TF      EEID --
4;1;q>"">22 s	!DDDDDD-66t{1~FFKII[5HIIIDKKK{7JKKKI CNCS  L FEK4DEEEM   )//11  LL
 [^$$%BCC d	!88888888VDKN++F:D(.00KCC{/BCCCETTeTTTEDKKK{7JKKKI CNCS  L FEK4DEEEM   )//11  LL
 [^$$V,, Q	!......6$+a.))D<*D~~ F|  I  D M,=1 1K--
 #
T>><Dtz:t<< 	"&X&XK&X&X&X%)

151D1D1F1F " "-GX*5g*>*C*C*E*EK3;>>3C3C " "%>P$,k?" ?"G 4U ; ;"
 F|F| '--	>#DO$8$8$:$:;;F!'  I#y9  "$ (.sx~~/?/?(@(@ 6 6HC+.q6GCLJJSV}5555#(::#;66484D4D)0TPU 5E 5 5K1 ,%y':K<QSW   " ))++,D	SS{?O?O?Q?Q8R8RSSS &y~~'7'7=R=R S S S 5 5H(( 	# 	# 	# 	# )1	# 	# 	# 	 	
   " 0/LL&&&LL8!4555$$T(^^4444&*#  ('''''	K ; ;V$$ 	2222229X&&D"$$DMM$?DLL......6(##D<*DLLXXh''..sA66q9::::I D D4'' 	''))HHHBBBB(--//BBBCCCCy CTY
 
 
 
"%eY"7"7
 
 
	

 
 
 
"%eY"7"7
 
 
	
 CBBB%BBB WTT	TTTUUVVFI $ $ 11-- 	$ $ $# LKKKKKKI3"3I"&."<BSIl*C	NN;;;')"4"4555.]

 

 

 t$$ {" JJ'44c:: 	
 z O	4y K*6 8 8&IwY'..w7777djj**33333!%$0 B BLIqY'..q111 N22FyFFFQOOOO)2+/( (1,, </>1BC  
 #&666  (1}} x[["#J-:!? %
 /$))L2I2IIPQRRRR+6(y$9$AAA@1X;NUV     6&;&EEEE(S!"     6&;&FFFH !) !* !) !*	 "#	 	 	 	 	 6&;&FFFS !&	 !) !* !) !* "#
 
 
 
 
 6&;&PPPU !&	 !&	 !) !* !) !* "#     6&;&III !") !* !) !* "#	 	 	 	 	 6&;&MMMb !) !) !* !) !* !* "#     6&;&GGGQ !) !* !* "#     6&;&FFFP !) !* !* "#     6&;&@@@E !) !'
 !* !*	 "#	 	 	 	 	 6&;&CCC !"* !*
 "#   wBH '3 4 4"	7#**73333 ** 	0 	0A$""C{HH'C888OOOOOOOO/0Dyy++>OL!#&&)5   0""(I #     .OOH---  *** '
 '$$&&& 0MMOOO--///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 &	-HH)49555======DL""49EJJJ 'c""(#(''	 #    .6^^-=-=  )E>.3LT+$$/',). %    
   '
 '$$&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' '" MMM'	22D99 -Q,---f   RSSS'oo ' 'FAsL(( E\!_ E E E L LW U UVVVGGBII'RRSSSGGF,,S11222GGI&&&GGI&&&&+,,,- - - - - - - - - - - - - - -    	&&		!
   s   UAE; *B}6AE; }	AE; 	}	
AAE; A=A@@AE; @A@@AE; @A@@ )AE; A	DAE/E#AE; E/AE3E3AE; E6AE3E7AE; E;
AF5F+AF0F0AF5__main__)NNFr%   )8rt  interpolatableHelpersinterpolatableTestContourOrderr   interpolatableTestStartingPointr   fontTools.pens.recordingPenr   r   r	   fontTools.pens.transformPenr
   fontTools.pens.statisticsPenr   r   fontTools.pens.momentsPenr   fontTools.varLib.modelsr   r   fontTools.misc.fixedToolsr   fontTools.misc.transformr   collectionsr   typesr   	functoolsr   pprintr   mathr   r   r   loggingr   	getLoggerr   rw  r   r   r~  r   r   r   r   r   rs  rX   rq  r   exitintboolr;   r0   r.   <module>r     s    % $ $ $ > > > > > > @ @ @ @ @ @         
 5 4 4 4 4 4 L L L L L L L L 6 6 6 6 6 6 I I I I I I I I 7 7 7 7 7 7 . . . . . . # # # # # # ! ! ! ! ! !                                  				g9::    U3 U3 U3 U3 U3 U3 U3 U3t 
	D 	D D D D DN x  M M M  G G G GT zJJJtvvHCHSSh  !!!!!	 r0   