B
    ¶ôJd  ã               @   s:   d Z ddlmZ ddlZdZdd„ ZG dd	„ d	ejƒZdS )
a   TSI{0,1,2,3,5} are private tables used by Microsoft Visual TrueType (VTT)
tool to store its hinting source data.

TSI0 is the index table containing the lengths and offsets for the glyph
programs and 'extra' programs ('fpgm', 'prep', and 'cvt') that are contained
in the TSI1 table.
é   )ÚDefaultTableé    Nz>HHLc             C   s   t | ƒt |ƒ|fS )N)Úint)ÚglyphIDÚ
textLengthÚ
textOffset© r   úQ/var/www/html/venv/lib/python3.7/site-packages/fontTools/ttLib/tables/T_S_I__0.pyÚfixlongs   s    r
   c               @   s2   e Zd ZdgZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )Útable_T_S_I__0ZTSI1c       
      C   s¬   |d j }g }t t¡}xNt|d ƒD ]>}tt t|d |… ¡Ž \}}}	| |||	f¡ ||d … }q&W t|ƒdksxt	‚|d dksŒt	dƒ‚|d d… | _
|dd … | _d S )NZmaxpé   r   éûÿÿÿ)iþÿ  r   l   4øW zbad magic numberéüÿÿÿ)Ú	numGlyphsÚstructÚcalcsizeÚ
tsi0FormatÚranger
   ÚunpackÚappendÚlenÚAssertionErrorÚindicesÚextra_indices)
ÚselfÚdataÚttFontr   r   ÚsizeÚir   r   r   r   r   r	   Ú	decompile   s    

ztable_T_S_I__0.decompilec             C   s~   t | dƒsdS d}x(| jD ]\}}}|t t|||¡ }qW |t tddd¡ }x(| jD ]\}}}|t t|||¡ }qXW |S )Nr   ó    iþÿ  r   l   4øW )Úhasattrr   r   Úpackr   r   )r   r   r   Úindexr   r   r   r   r	   Úcompile"   s    
ztable_T_S_I__0.compilec             C   s   || _ || _d S )N)r   r   )r   r   r   r   r   r	   Úset/   s    ztable_T_S_I__0.setc             C   s   |  d¡ | ¡  d S )Nz-This table will be calculated by the compiler)ÚcommentÚnewline)r   Úwriterr   r   r   r	   ÚtoXML4   s    
ztable_T_S_I__0.toXMLN)Ú__name__Ú
__module__Ú__qualname__Údependenciesr   r$   r%   r)   r   r   r   r	   r      s
   r   )Ú__doc__Ú r   r   r   r
   r   r   r   r   r	   Ú<module>   s
   