
     i:5                        d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZmZ ddlmZmZ deddfd	Zd
edefdZ	 	 ddee         de	ee                  de	ee                  dee         fdZ	 	 	 	 ddedede	ee                  de	ee                  dededeeef         fdZ	 	 	 	 ddedede	ee                  de	ee                  dededeeef         fdZd Zdee
         fdZdS )    N)IterableIteratorListOptionalTextTuple   color_unified_diff_line)run_external_diffu_diff)file_existsget_tables_argument_listoutputreturnc                 0   | sdS t           j                                        s!t           j                            |            dS t	          j        d          pt          j        d          }|s!t           j                            |            dS |g}dt          j        	                    |          v r|
                    d           t          j        |t          j        d          }	 |j                            |            |j                                         |                                 dS # t"          t$          f$ r' |j        r|j                                         Y dS Y dS t&          $ r" |j        r|j                                          w xY w)zDPipes output to a pager if stdout is a TTY and a pager is available.NPAGERlessz-RT)stdintext)sysstdoutisattywriteosgetenvshutilwhichpathbasenameappend
subprocessPopenPIPEr   closewaitBrokenPipeErrorKeyboardInterrupt	Exception)r   pager	pager_cmdprocs       a/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/fontTools/diff/__init__.pypipe_outputr.      s     : 
   Ig6&,v"6"6E 
   I!!%((((IZ_4HHHD
   
		./    : 	J	 	 	    : 	Js   *AD3 31F*+F	diff_toolc                     	 t          j        | dgt           j        t           j        d          }n# t          $ r Y dS w xY w|j        pd|j        pdz   }d|v S )z9Returns True if the provided diff executable is GNU diff.z	--versionT)r   stderrr   F zGNU diffutils)r"   runr$   OSErrorr   r1   )r/   r,   version_outputs      r-   _is_gnu_diffr6   3   s}    ~$??	
 
 
    uu k'RDK,=2>Nn,,s   .1 
??tagsinclude_tablesexclude_tablesc              #   8   K   | D ]}|r||v r	|r||vr|V  d S )N )r7   r8   r9   tags       r-   _iter_filtered_table_tagsr=   C   sV      
    	c^33 	c77				     file1file2font_number_1font_number_2c                    ddl m}  || d|          5 } ||d|          5 }d |j                                        D             d |j                                        D             t	          t          t          z  ||                              }	fd|	D             }
fd	|	D             }fd
|	D             }d}g }|                    d           |                    d|  d           |                    d| d           |
rad}|                    dt          |
           d           |
D ]6}|                    d| dt          |j        |                    d           7|rad}|                    dt          |           d           |D ]6}|                    d| dt          |j        |                    d           7|                    dt          |           d           |D ]}|j        |         }|j        |         }||k    r*|                    d| dt          |           d           Ld}|                    d| dt          |           dt          |           d           |r|                    d           n|                    d           |d	                    |          fcd d d            cd d d            S # 1 swxY w Y   d d d            d S # 1 swxY w Y   d S ) Nr   TTFontTlazy
fontNumberc                 ,    h | ]}t          |          S r;   str.0r<   s     r-   	<setcomp>zsummarize.<locals>.<setcomp>^       999cS999r>   c                 ,    h | ]}t          |          S r;   rK   rM   s     r-   rO   zsummarize.<locals>.<setcomp>_   rP   r>   r8   r9   c                 $    g | ]}|v |v
|S r;   r;   rN   r<   tags1tags2s     r-   
<listcomp>zsummarize.<locals>.<listcomp>k   +    NNNC5LLS=M=M=M=M=Mr>   c                 $    g | ]}|v |v
|S r;   r;   rT   s     r-   rW   zsummarize.<locals>.<listcomp>l   rX   r>   c                 $    g | ]}|v |v 
|S r;   r;   rT   s     r-   rW   zsummarize.<locals>.<listcomp>m   &    III3%<<C5LLLLLr>   zBinary table summary:
z	  file1: 
z	  file2: Fz
Tables only in file1 (z):
z- z (z bytes)
z
Tables only in file2 (z+ z
Tables in both (z  z: SAME (z* z: DIFF (z vs z
Result: SAME
z
Result: DIFFERENT
r2   )
fontTools.ttLibrF   readerkeyssortedsetr=   r!   lenjoin)r@   rA   r8   r9   rB   rC   rF   font1font2all_tagsonly1only2both	identicallinesr<   data1data2rU   rV   s                     @@r-   	summarizern   P   sS    '&&&&& 	u4M:::6)>Cu4M:::6)>C99U\%6%6%8%899999U\%6%6%8%8999)EM#1#1   
 
 ONNNNNNNNNNNNNNNIIIIIxIII	/000****+++****+++ 	LILLDCJJDDDEEE L LJ#JJU\#->)?)?JJJKKKK 	LILLDCJJDDDEEE L LJ#JJU\#->)?)?JJJKKKK9#d))999::: 	V 	VCL%EL%E~~D#DDs5zzDDDEEEE!	T#TTs5zzTTs5zzTTTUUUU 	2LL+,,,,LL0111"''%..(m6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6) 6)s5   K>J'K&K>&K*	*K>-K*	.K>>LLc                 d   ddl m}  || d|          5 } ||d|          5 }d |j                                        D             d |j                                        D             t	          t          t          z  ||                              }	fd|	D             }
t                      }|
D ]7}|j        |         }|j        |         }||k    r|                    |           8|cd d d            cd d d            S # 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )	Nr   rE   TrG   c                 ,    h | ]}t          |          S r;   rK   rM   s     r-   rO   z,get_binary_exclude_tables.<locals>.<setcomp>   rP   r>   c                 ,    h | ]}t          |          S r;   rK   rM   s     r-   rO   z,get_binary_exclude_tables.<locals>.<setcomp>   rP   r>   rR   c                 $    g | ]}|v |v 
|S r;   r;   rT   s     r-   rW   z-get_binary_exclude_tables.<locals>.<listcomp>   r[   r>   )r]   rF   r^   r_   r`   ra   r=   add)r@   rA   r8   r9   rB   rC   rF   rd   re   rf   ri   outr<   rl   rm   rU   rV   s                  @@r-   get_binary_exclude_tablesru      s    '&&&&& 	u4M:::>Cu4M:::>C99U\%6%6%8%899999U\%6%6%8%8999)EM#1#1   
 
 JIIIIxIIIee 	 	CL%EL%E~~5                                        s5   D%CD4D%D	D%D	D%%D),D)c                  :   d} 	 t          t          j        dd                   } nu# t          $ r Y nit          $ r] t          j        t
          j        t
          j                  }t          j	        |t          j
                                                   Y nw xY w| S )z!Compare two fonts for differencesr   r	   N)r3   r   argvr(   r'   r   opendevnullO_WRONLYdup2r   fileno)retry   s     r-   mainr~      s     C.#(122,    . . . '"*bk22
**,,-----	.
 Js   !& 
BA#BBrw   c                    t          j        d          }|                    dddd           |                    dd	t          d
d           |                    ddt          dd d           |                    ddt          dd d           |                    dt          d           |                    dt          d d           |                    dg ddd           |                    dt          d d!d"#           |                    d$t          d d!d%#           |                    d&d'dd(           |                    d)d*dd+           |                    d,d-dd.           |                    d/d01           |                    d2d31           |                    |           }|j        r<|j        r5|j        s,t          j
                            d4t          j                    d5S |j        sd6|_        t          |j                  s=|j        s4t          j
                            d7|j         d8t          j                    d5S t          |j                  s=|j        s4t          j
                            d7|j         d8t          j                    d5S t#          |j                  }t#          |j                  }|j        r	 t+          |j        |j        |||j        |j        9          \  }}|j        st          j                            |           |rd:nd;S # t2          $ r@}|j        s.t          j
                            d<| t          j                    Y d }~d5S d }~ww xY w|j        r`t5          |j        |j        |||j        |j        9          |fd=|D             }n&|g }|                    t9                               |j        }|j        d>k    p|j        dk    ot          j        j        }	|tA          j!        d?          }nU|rStA          j!        |          }|=|j        s4t          j
                            d@|j         dAt          j                    d5S 	 |r|j"        }
|
O|j#        d
k    rdBg}
ndC$                    |j#                  g}
tK          |          r|
&                    dD           n|
'                                }
tQ          ||
|j        |j        |||j        |j        d6E	  	        }n0tS          |j        |j        |j#        |||j        |j        d6F          }|	rdG |D             }dH*                    |          }|j        stW          |           |rd;nd:S # t2          $ r@}|j        s.t          j
                            d<| t          j                    Y d }~d5S d }~ww xY w)INz&An OpenType table diff tool for fonts.)descriptionz-lz	--summary
store_truez.Report table presence and binary equality only)actionhelpz-Uz--lines   z5Number of context lines for unified diff (default: 3))typedefaultr   z-tz	--include+z5Font tables to include. Multiple options are allowed.)r   nargsr   r   z-xz	--excludez5Font tables to exclude. Multiple options are allowed.z--diffz.Run external diff tool command (default: diff))r   r   z
--diff-argz*External diff tool arguments (default: -u)z--color)autoneveralwaysr   z*Whether to colorize output (default: auto))choicesr   r   z--y1r?   NUMBERzMSelect font number for TrueType Collection (.ttc/.otc) FILE1, starting from 0)r   r   metavarr   z--y2zMSelect font number for TrueType Collection (.ttc/.otc) FILE2, starting from 0z-az--alwaysz'Compare tables even if binary identicalz-bz--binaryz0Compare tables only if binaries differ (default)z-qz--quietzSuppress all outputFILE1zFont file path 1)r   FILE2zFont file path 2zv[*] Error: --always and --binary are mutually exclusive options. Please use ONLY one of these options in your command.   Tz[*] ERROR: The file path 'z' can not be found.)r8   r9   rB   rC   r   r	   z[*] ERROR: c                     g | ]}|v|	S r;   r;   )rN   r<   excluded_binary_tabless     r-   rW   zrun.<locals>.<listcomp>q  s+       s:P/P/P/P/P/Pr>   r   diffz.[*] ERROR: The external diff tool executable 'z' was not found.z-uz-u{}z-F^\s\s<)r8   r9   font_number_afont_number_buse_multiprocess)context_linesr8   r9   r   r   r   c                 ,    g | ]}t          |          S r;   r
   )rN   lines     r-   rW   zrun.<locals>.<listcomp>  s!    GGG-d33GGGr>   r2   ),argparseArgumentParseradd_argumentintrL   
parse_argsr   binaryquietr   r1   r   r   linesepr   r   r   r   includeexcludesummaryrn   y1y2r   r)   ru   extendr`   r   colorr   r   r   diff_argrk   formatr6   r!   splitr   r   rc   r.   )rw   parserargsinclude_listexclude_listrj   r   er/   color_outputr   r   s              @r-   r3   r3      sk    $<  F =	     D     D     D     s!Q     9	     +++9	     \     \     6	     ?	     i3H     &8999
&8999%0066D { t{ z 	JUHJ
U U   q;  tz"" z 	JXTZXXBJXX   qtz"" z 	JXTZXXBJXX   q *B$,)O)OL)A$,)O)OL| 	 )

++"g"g! ! !Iv : )
  (((!(11q( 	 	 	: @
  !>q!>"*!>!>???11111	
 { @!:JJ''''"
 "
 "
 #   +  LL #!'= > >???	I:) 
f2!2  L((			 L++	: 
  @	@ @35:@ @   1/ !	}H:?? $vHH &dj 9 9:H	** 1OOK000#>>++&

++"g"g!%
 
 
FF 

"j++"g"g!%	 	 	F  	HGGGGGFz 	 !qq!   z 	<J:1:bj::;;;qqqqqs2   AL, ,
M665M11M6;D	V 
W5W

W)NN)NNr?   r?   )r   r   r   r   r"   typingr   r   r   r   r   r   r   r   r   r   r   utilsr   r   rL   r.   boolr6   r=   r   rn   ru   r~   r3   r;   r>   r-   <module>r      s    				 



      B B B B B B B B B B B B B B B B * * * * * * + + + + + + + + 8 8 8 8 8 8 8 8# # # # # #L-C -D - - - -$ +/*.
 

3-
T#Y'
 T#Y'
 c]	
 
 
 
  +/*.@) @)@)@) T#Y'@) T#Y'	@)
 @) @) 49@) @) @) @)L +/*.$ $$$ T#Y'$ T#Y'	$
 $ $ 49$ $ $ $N  (kd4j k k k k k kr>   