§
    ÛóÉj’  ã                   ó¼   — d dl mZ d dlmZ d dlZd dlZd dlmZ d dlm	Z	m
Z
mZmZ d dlmZ d dlmZ  ej        e¦  «        Zed„ ¦   «         Z G d	„ d
e¦  «        ZdS )é    )ÚTTFont)ÚBytesION)Úcontextmanager)ÚTTC_V1ÚTTC_V2ÚreadTTCHeaderÚwriteTTCHeader)Útable_D_S_I_G_)ÚtimestampNowc              #   óú   K  — t          ¦   «         }g }	 | D ]=}|j        r4d|v r0|                     ||j        f¦  «         ||d         _        d|_        Œ>|V — |D ]\  }}||_        ŒdS # |D ]\  }}||_        Œw xY w)a,  Pin a single ``head.modified`` timestamp across an iterable of TTFonts.

    When several fonts are saved together with ``recalcTimestamp=True``, each
    one restamps its own ``head`` table via ``timestampNow()``, whose
    granularity is one second. If the wall clock ticks between two fonts'
    ``head.compile()`` calls they get different ``modified`` values, which
    defeats byte-identical table sharing (``shareTables=True``) and makes the
    saved size non-deterministic.

    This reads ``timestampNow()`` once (so ``SOURCE_DATE_EPOCH`` is still
    honored) and applies it to every font that would have recalculated its own
    timestamp, suppressing the per-font restamp for the duration. Each font's
    ``recalcTimestamp`` flag is restored on exit, even if the body raises; the
    pinned ``modified`` value is left in place, matching a normal recalc save.
    Fonts with ``recalcTimestamp`` falsy, or without a ``head`` table, are left
    untouched (their ``head`` is not even loaded).

    See https://github.com/fonttools/fonttools/issues/4110.
    ÚheadFN)r   ÚrecalcTimestampÚappendÚmodified)ÚfontsÚnowÚrestoreÚfontr   s        ú�/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/fontTools/ttLib/ttCollection.pyÚ_sharedModifiedTimestampr      sÇ   è è € õ* ‰.Œ.€CØ€Gð3Øð 	-ð 	-ˆDØÔ#ð -¨°$¨¨ð —’  dÔ&:Ð;Ñ<Ô<Ð<Ø(+��V”Ô%Ø',�Ô$øØˆ	ˆ	ˆ	à%,ð 	3ð 	3Ñ!ˆD�/Ø#2ˆDÔ Ð ð	3ð 	3ø Wð 	3ð 	3Ñ!ˆD�/Ø#2ˆDÔ Ð ð	3øøøs   ”AA) Á)A:c                   óZ   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zdd	„Zdd„Z	d„ Z
d„ Zd„ Zd„ Zd„ ZdS )ÚTTCollectionaç  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.
    NFc                 ón  — g x}| _         |€d S d|vs
J |¦   «         ‚d}t          |d¦  «        st          |d¦  «        }d}|ri nd }t          |¦  «        }t	          |j        ¦  «        D ]'}t          |f||dœ|¤Ž}	|                     |	¦  «         Œ(|j        t          k    red | _
        |j        dk    rSt          d¦  «        | _
        |                     |j        d¦  «         |                     |j        ¦  «        | j
        _        |                     d	¦  «        s|r|                     ¦   «          d S d S d S )
NÚ
fontNumberFÚreadÚrbT)r   Ú_tableCacher   ÚDSIGÚlazy)r   ÚhasattrÚopenr   ÚrangeÚnumFontsr   r   ÚVersionr   ÚdsigÚulDsigOffsetr
   Úseekr   ÚulDsigLengthÚdataÚgetÚclose)
ÚselfÚfileÚshareTablesÚkwargsr   ÚcloseStreamÚ
tableCacheÚheaderÚir   s
             r   Ú__init__zTTCollection.__init__=   sc  € ØÐˆ�”
Øˆ<ØˆFà 6Ð)Ð)Ð)¨6Ñ)Ô)Ð)àˆÝ�t˜VÑ$Ô$ð 	Ý˜˜dÑ#Ô#ˆDØˆKà&Ð0�R�R¨Dˆ
å˜tÑ$Ô$ˆÝ�v”Ñ'Ô'ð 	ð 	ˆAÝ˜$ÐO¨1¸*ÐOÐOÈÐOÐOˆDØ�LŠL˜ÑÔÐÐàŒ>�VÒ#Ð#Ø/3ˆDŒIØÔ" aÒ'Ð'Ý*¨6Ñ2Ô2�”	Ø—	’	˜&Ô-¨qÑ1Ô1Ð1Ø!%§¢¨6Ô+>Ñ!?Ô!?�”	”ð �zŠz˜&Ñ!Ô!ð 	 kð 	Ø�JŠJ‰LŒLˆLˆLˆLð	ð 	ð 	ð 	ó    c                 ó   — | S ©N© ©r,   s    r   Ú	__enter__zTTCollection.__enter___   s   € Øˆr5   c                 ó.   — |                       ¦   «          d S r7   )r+   )r,   ÚtypeÚvalueÚ	tracebacks       r   Ú__exit__zTTCollection.__exit__b   s   € Ø�
Š
‰Œˆˆˆr5   c                 óB   — | j         D ]}|                     ¦   «          Œd S r7   )r   r+   )r,   r   s     r   r+   zTTCollection.closee   s,   € Ø”Jð 	ð 	ˆDØ�JŠJ‰LŒLˆLˆLð	ð 	r5   Tc                 ó0  — t          |d¦  «        sd}t          |d¦  «        }n|}t          ¦   «         }|ri nd}t          | d¦  «        rt          nt          }t          | j        ¦  «        5  t          |t          | j        ¦  «        |¬¦  «        }g }| j        D ]V}| 	                    | 
                    ¦   «         ¦  «         |                     ||¬¦  «         |                     dd¦  «         ŒW	 ddd¦  «         n# 1 swxY w Y   |                     |¦  «         |                     t          j        d	t          | j        ¦  «        z  g|¢R Ž ¦  «         |t          k    rö| j        �ït          | j        d
¦  «        r| j        j        }	n| j                             d¦  «        }	| 
                    ¦   «         }
|                     dd¦  «         | 
                    ¦   «         }|                     |	¦  «         |                     |
¦  «         |                     d¦  «         |                     t          j        dt          |	¦  «        |¦  «        ¦  «         |r'|                     |                     ¦   «         ¦  «         |                     ¦   «          dS )z•Save the font to disk. Similarly to the constructor,
        the 'file' argument can be either a pathname or a writable
        file object.
        ÚwriteNÚwbr%   ©Úversion)r1   r   é   z>%dLr)   s   DSIGz>2L)r    r!   r   r   r   r   r   r	   Úlenr   ÚtellÚ_saver'   rB   ÚstructÚpackr%   r)   ÚcompileÚgetvaluer+   )r,   r-   r.   Úfinalr1   rE   Úoffsets_offsetÚoffsetsr   r)   Údsig_header_fields_offsetÚdsig_offsets               r   ÚsavezTTCollection.savei   sŽ  € õ
 �t˜WÑ%Ô%ð 	ØˆEÝ˜˜dÑ#Ô#ˆDˆDð ˆEÝ‘9”9ˆDà&Ð0�R�R¨Dˆ
õ $ D¨&Ñ1Ô1Ð=•&�&µvˆõ & d¤jÑ1Ô1ð 	 ð 	 Ý+¨Dµ#°d´j±/´/È7ÐSÑSÔSˆNØˆGØœ
ð  ð  �Ø—’˜tŸyšy™{œ{Ñ+Ô+Ð+Ø—
’
˜4¨J�
Ñ7Ô7Ð7Ø—	’	˜!˜Q‘”��ð ð	 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 ð 	�	Š	�.Ñ!Ô!Ð!Ø�
Š
•6”;˜v­¨D¬J©¬Ñ7ÐB¸'ÐBÐBÐBÑCÔCÐCà•fÒÐ ¤Ð!6å�t”y &Ñ)Ô)ð /Ø”y”~��à”y×(Ò(¨Ñ.Ô.�ð )-¯	ª	©¬Ð%à�IŠI�a˜‰OŒOˆOØŸ)š)™+œ+ˆKà�JŠJ�tÑÔÐà�IŠIÐ/Ñ0Ô0Ð0à�JŠJ�wÑÔÐà�JŠJ•v”{ 5­#¨d©)¬)°[ÑAÔAÑBÔBÐBàð 	)Ø�KŠK˜Ÿš™œÑ(Ô(Ð(Ø�
Š
‰Œˆˆˆs   Á,BC>Ã>DÄDú
c                 ó0  — ddl m} |                     ||¬¦  «        }|rNddlm} d                     |                     d¦  «        d d…         ¦  «        }|                     d|¬¦  «         n|                     d¦  «         |                     ¦   «          |                     ¦   «          | j	        D ]&} |j
        |fd	d
i|¤Ž |                     ¦   «          Œ'|                     d¦  «         |                     ¦   «          |                     ¦   «          d S )Nr   )Ú	xmlWriter)Ú
newlinestrrD   ú.rF   ÚttCollection)ÚttLibVersionÚwriteVersionF)ÚfontTools.miscrV   Ú	XMLWriterÚ	fontToolsrE   ÚjoinÚsplitÚbegintagÚnewliner   Ú_saveXMLÚendtagr+   )	r,   Ú
fileOrPathrW   r[   r/   rV   ÚwriterrE   r   s	            r   ÚsaveXMLzTTCollection.saveXML¡   s-  € Ø,Ð,Ð,Ð,Ð,Ð,à×$Ò$ Z¸JÐ$ÑGÔGˆàð 	,Ø)Ð)Ð)Ð)Ð)Ð)à—h’h˜wŸ}š}¨SÑ1Ô1°"°1°"Ô5Ñ6Ô6ˆGØ�OŠO˜N¸ˆOÑAÔAÐAÐAà�OŠO˜NÑ+Ô+Ð+Ø�ŠÑÔÐØ�ŠÑÔÐà”Jð 	ð 	ˆDØˆDŒM˜&Ð?Ð?¨uÐ?¸Ð?Ð?Ð?Ø�NŠNÑÔÐÐà�Š�nÑ%Ô%Ð%Ø�ŠÑÔÐà�Š‰Œˆˆˆr5   c                 ó   — | j         |         S r7   ©r   ©r,   Úitems     r   Ú__getitem__zTTCollection.__getitem__¹   ó   € ØŒz˜$ÔÐr5   c                 ó   — || j         |<   d S r7   ri   )r,   rk   r=   s      r   Ú__setitem__zTTCollection.__setitem__¼   s   € Ø ˆŒ
�4ÑÐÐr5   c                 ó   — | j         |         S r7   ri   rj   s     r   Ú__delitem__zTTCollection.__delitem__¿   rm   r5   c                 ó*   — t          | j        ¦  «        S r7   )rG   r   r9   s    r   Ú__len__zTTCollection.__len__Â   s   € Ý�4”:‰ŒÐr5   c                 ó*   — t          | j        ¦  «        S r7   )Úiterr   r9   s    r   Ú__iter__zTTCollection.__iter__Å   s   € Ý�D”JÑÔÐr5   )NF)T)rT   T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r4   r:   r?   r+   rS   rg   rl   ro   rq   rs   rv   r8   r5   r   r   r   2   sÔ   € € € € € ðð ð ð  ð  ð  ðDð ð ðð ð ðð ð ð6ð 6ð 6ð 6ðpð ð ð ð0 ð  ð  ð!ð !ð !ð ð  ð  ðð ð ð ð  ð  ð  ð  r5   r   )ÚfontTools.ttLib.ttFontr   Úior   rJ   ÚloggingÚ
contextlibr   ÚfontTools.ttLib.sfntr   r   r   r	   ÚfontTools.ttLib.tables.D_S_I_G_r
   ÚfontTools.misc.timeToolsr   Ú	getLoggerrw   Úlogr   Úobjectr   r8   r5   r   ú<module>r…      s  ðØ )Ð )Ð )Ð )Ð )Ð )Ø Ð Ð Ð Ð Ð Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NÐ NØ :Ð :Ð :Ð :Ð :Ð :Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1à€gÔ˜Ñ!Ô!€ð ð!3ð !3ñ „ð!3ðHT ð T ð T ð T ð T �6ñ T ô T ð T ð T ð T r5   