
    g}
                     f    d dl mZ d dlmZ ddlmZ d dlZd dlZdZ G d dej
                        Z	y)	    )sstruct)safeEval   )DefaultTableNz
    >        # big endian
    version: 16.16F    # Table version
    flags:        H    # bit 0: 1=long format, 0=short format
                       # bit 1: 1=attribute names, 0=no names
    numAttribs:   H    # NUmber of attributes
c                   N    e Zd ZdZdgZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zy)table_G__l_o_cz}Graphite Index to Glyph Atttributes table

    See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables
    GlatNc                 `    t         j                   j                  | |       d | _        d| _        y )Nr   )r   __init__	attribIds
numAttribs)selftags     \/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/fontTools/ttLib/tables/G__l_o_c.pyr   ztable_G__l_o_c.__init__   s&    !!**45    c                 `   t        j                  t        ||       \  }}| j                  }| `t	        j                  |dz  rdnd      | _        | j
                  j                  |d t        |      | j                  |dz  z  z
          t        j                  dk7  r| j
                  j                          t	        j                  d      | _        |dz  r[| j                  j                  || j                   dz  d         t        j                  dk7  r| j                  j                          y y y )Nr   IH   big)r   unpack2Gloc_headerflagsarray	locations	frombyteslenr   sys	byteorderbyteswapr   )r   datattFont_r   s        r   	decompileztable_G__l_o_c.decompile   s    //+tT:4

JEAIS3?  &QD	DOOuqy4Q(Q!RS==E!NN##%S)19NN$$T4??*:Q*>*@%AB}}%'') & r   c           	         t        j                  t        t        dt	        | j
                        dz  | j                  j                  dk(  z   | j                              }t        j                  dk7  r| j                  j                          || j                  j                         z  }t        j                  dk7  r| j                  j                          | j
                  rwt        j                  dk7  r| j
                  j                          || j
                  j                         z  }t        j                  dk7  r| j
                  j                          |S )Ng      ?r   r   )versionr   r   r   )r   packr   dictboolr   r   typecoder   r   r   r    tobytes)r   r"   r!   s      r   compileztable_G__l_o_c.compile,   s    ||DNN+q0T^^5L5LPS5ST??
 ==E!NN##%&&((==E!NN##%>>}}%'')DNN**,,D}}%'')r   c                 ^    t        |      dk\  }t        j                  |rdnd|      | _        y )Ni   r   r   )maxr   r   )r   r   long_formats      r   setztable_G__l_o_c.setB   s&    )n-KSS)Lr   c                 ^    |j                  d| j                         |j                          y )N
attributes)number)	simpletagr   newline)r   writerr"   s      r   toXMLztable_G__l_o_c.toXMLF   s#    doo>r   c                 H    |dk(  rt        t        |d               | _        y y )Nr2   r3   )intr   r   )r   nameattrscontentr"   s        r   fromXMLztable_G__l_o_c.fromXMLJ   s$    <!(5?";<DO  r   c                      | j                   |   S N)r   )r   indexs     r   __getitem__ztable_G__l_o_c.__getitem__N   s    ~~e$$r   c                 ,    t        | j                        S r?   )r   r   r   s    r   __len__ztable_G__l_o_c.__len__Q   s    4>>""r   c                 ,    t        | j                        S r?   )iterr   rC   s    r   __iter__ztable_G__l_o_c.__iter__T   s    DNN##r   r?   )__name__
__module____qualname____doc__dependenciesr   r$   r,   r0   r7   r=   rA   rD   rG    r   r   r   r      s>    
 8L
*,M=%#$r   r   )
fontTools.miscr   fontTools.misc.textToolsr    r   r   r   r   r   rM   r   r   <module>rQ      s/    " -   
D$\.. D$r   