
    h{                     v    S SK Jr  S SKJrJr  S SKJr  S SKrS SKr\R                  " \
5      r " S S\5      rg)    )TTFont)readTTCHeaderwriteTTCHeader)BytesIONc                   f    \ rS rSrSrSS jrS rS rS rSS jr	SS	 jr
S
 rS rS rS rS rSrg)TTCollection
   a  Object representing a TrueType Collection / OpenType Collection.
The main API is self.fonts being a list of TTFont instances.

If shareTables is True, then different fonts in the collection
might point to the same table object if the data for the table was
the same in the font file.  Note, however, that this might result
in suprises and incorrect behavior if the different fonts involved
have different GlyphOrder.  Use only if you know what you are doing.
Nc                 x   / =o@l         Uc  g SU;  d   U5       eSn[        US5      (       d  [        US5      nSnU(       a  0 OS n[        U5      n[	        UR
                  5       H"  n[        U4XS.UD6n	UR                  U	5        M$     UR                  S5      (       d  U(       a  UR                  5         g g g )N
fontNumberFreadrbT)r   _tableCachelazy)
fontshasattropenr   rangenumFontsr   appendgetclose)
selffileshareTableskwargsr   closeStream
tableCacheheaderifonts
             N/var/www/html/env/lib/python3.13/site-packages/fontTools/ttLib/ttCollection.py__init__TTCollection.__init__   s    
<6)161)tV$$d#DK&RD
t$v'A$O1OODLL ( zz&!!kJJL '2!    c                     U $ N r   s    r!   	__enter__TTCollection.__enter__0   s    r$   c                 $    U R                  5         g r&   )r   )r   typevalue	tracebacks       r!   __exit__TTCollection.__exit__3   s    

r$   c                 J    U R                    H  nUR                  5         M     g r&   )r   r   )r   r    s     r!   r   TTCollection.close6   s    JJDJJL r$   c                 `   [        US5      (       d  Sn[        US5      nOUn[        5       nU(       a  0 OSn[        U[	        U R
                  5      5      n/ nU R
                   HC  nUR                  UR                  5       5        UR                  XS9  UR                  SS5        ME     UR                  U5        UR                  [        R                  " S[	        U R
                  5      -  /UQ76 5        U(       a  UR                  UR                  5       5        UR                  5         g)z}Save the font to disk. Similarly to the constructor,
the 'file' argument can be either a pathname or a writable
file object.
writeNwb)r   r      z>%dL)r   r   r   r   lenr   r   tell_saveseekr4   structpackgetvaluer   )r   r   r   finalr   offsets_offsetoffsetsr    s           r!   saveTTCollection.save:   s    
 tW%%Ed#D E9D&RD
'c$**o>JJDNN499;'JJtJ3IIaO 
 			.!

6;;vDJJ7B'BCKK(

r$   c                    SSK Jn  UR                  XS9nU(       a:  SSKJn  SR                  UR                  S5      S S 5      nUR                  SUS9  OUR                  S5        UR                  5         UR                  5         U R                   H(  nUR                  " U4S	S
0UD6  UR                  5         M*     UR                  S5        UR                  5         UR                  5         g )Nr   )	xmlWriter)
newlinestr)version.r6   ttCollection)ttLibVersionwriteVersionF)fontTools.miscrD   	XMLWriter	fontToolsrF   joinsplitbegintagnewliner   _saveXMLendtagr   )	r   
fileOrPathrE   rJ   r   rD   writerrF   r    s	            r!   saveXMLTTCollection.saveXMLX   s    ,$$Z$G)hhw}}S1"156GOONOAOON+JJDMM&?u??NN  	n%r$   c                      U R                   U   $ r&   r   r   items     r!   __getitem__TTCollection.__getitem__p       zz$r$   c                      X R                   U'   g r&   rY   )r   r[   r-   s      r!   __setitem__TTCollection.__setitem__s   s     

4r$   c                      U R                   U   $ r&   rY   rZ   s     r!   __delitem__TTCollection.__delitem__v   r^   r$   c                 ,    [        U R                  5      $ r&   )r7   r   r(   s    r!   __len__TTCollection.__len__y   s    4::r$   c                 ,    [        U R                  5      $ r&   )iterr   r(   s    r!   __iter__TTCollection.__iter__|   s    DJJr$   rY   )NF)T)
T)__name__
__module____qualname____firstlineno____doc__r"   r)   r/   r   rA   rV   r\   r`   rc   rf   rj   __static_attributes__r'   r$   r!   r   r   
   s>    6<0 !  r$   r   )fontTools.ttLib.ttFontr   fontTools.ttLib.sfntr   r   ior   r;   logging	getLoggerrm   logobjectr   r'   r$   r!   <module>rz      s2    ) >   !s 6 s r$   