
    jke                     v    d dl mZ ddlZddlZddlZ ej
                  e      Z G d dej                        Zy)   )DefaultTable    Nc                   6    e Zd ZdgZd Zd Zd Zd Zd Zd Z	y)	table__l_o_c_aglyfc                    |d   j                   }|rd}nd}t        j                  |      }|j                  |       t        j                  dk7  r|j                          |sGt        j                  d      }t        t        |            D ]  }|j                  ||   dz          |}t        |      |d   j                  dz   k  r0t        j                  dt        |      dz
  |d   j                         || _        y )	NheadIHbig   maxpr   z9corrupt 'loca' table, or wrong numGlyphs in 'maxp': %d %d)indexToLocFormatarray	frombytessys	byteorderbyteswaprangelenappend	numGlyphslogwarning	locations)selfdatattFont
longFormatformatr   lis           A/usr/lib/python3/dist-packages/fontTools/ttLib/tables/_l_o_c_a.py	decompileztable__l_o_c_a.decompile   s    F^44
FFKK'	D!==E! C A3y>* +1)*+Iy>VF^559:KKKI"v((
 #    c                 8   	 t        | j                        }|dk  rt	        d | j                  D              rdt        j
                  d      }t        t        | j                              D ]#  }|j                  | j                  |   dz         % d|d   _	        n*t        j
                  d| j                        }d|d   _	        t        j                  d	k7  r|j                          |j                         S # t        $ r | j                  g        d}Y w xY w)
Nr   i   c              3   ,   K   | ]  }|d z  dk(    yw)r   r   N ).0r!   s     r#   	<genexpr>z)table__l_o_c_a.compile.<locals>.<genexpr>*   s     )M!a%1*)Ms   r   r   r	   r
   r   r   )maxr   AttributeErrorsetallr   r   r   r   r   r   r   r   tobytes)r   r   max_locationr   r"   s        r#   compileztable__l_o_c_a.compile$   s    	t~~.L '!c)Mdnn)M&MC(I3t~~./ 9  !2a!789./F6N+C8I./F6N+==E!   ""  	HHRLL	s   C9 9DDc                 :    t        j                   d|      | _        y )Nr
   )r   r   )r   r   s     r#   r-   ztable__l_o_c_a.set6   s    S)4r%   c                 F    |j                  d       |j                          y )Nz3The 'loca' table will be calculated by the compiler)commentnewline)r   writerr   s      r#   toXMLztable__l_o_c_a.toXML9   s    LMr%   c                      | j                   |   S N)r   )r   indexs     r#   __getitem__ztable__l_o_c_a.__getitem__=   s    ~~e$$r%   c                 ,    t        | j                        S r9   )r   r   )r   s    r#   __len__ztable__l_o_c_a.__len__@   s    4>>""r%   N)
__name__
__module____qualname__dependenciesr$   r1   r-   r7   r;   r=   r(   r%   r#   r   r   
   s'    8L#.#$5%#r%   r   )	 r   r   r   logging	getLoggerr>   r   r   r(   r%   r#   <module>rE      s7     
   g!7#\.. 7#r%   