
    Ph                     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                   :    e Zd ZdZdgZd Zd Zd Zd Zd Z	d Z
y	)
table__l_o_c_aa	  Index to Location table

    The ``loca`` table stores the offsets in the ``glyf`` table that correspond
    to the descriptions of each glyph. The glyphs are references by Glyph ID.

    See also https://learn.microsoft.com/en-us/typography/opentype/spec/loca
    glyfc                    |d   j                   }|rd}nd}t        j                  |      }|j                  |       t        j                  dk7  r|j                          |st        j                  dd |D              }t        |      |d   j                  dz   k  r0t        j                  dt        |      dz
  |d   j                         || _
        y )	NheadIHbigc              3   &   K   | ]	  }d |z    yw)   N .0ls     jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/_l_o_c_a.py	<genexpr>z+table__l_o_c_a.decompile.<locals>.<genexpr>    s     )CA!a%s   maxpr   z9corrupt 'loca' table, or wrong numGlyphs in 'maxp': %d %d)indexToLocFormatarray	frombytessys	byteorderbyteswaplen	numGlyphslogwarning	locations)selfdatattFont
longFormatformatr    s         r   	decompileztable__l_o_c_a.decompile   s    F^44
FFKK'	D!==E! C)C)CDI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   Nr   r   s     r   r   z)table__l_o_c_a.compile.<locals>.<genexpr>/   s     )Mn!a%1*ns   r   r   r	   r
   r   r   )maxr    AttributeErrorsetallr   ranger   appendr   r   r   r   tobytes)r!   r#   max_locationr    is        r   compileztable__l_o_c_a.compile)   s    	t~~.L '!c)Mdnn)M&MC(I3t~~./  !2a!78 0./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.set;   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.toXML>   s    LMr'   c                      | j                   |   S N)r    )r!   indexs     r   __getitem__ztable__l_o_c_a.__getitem__B   s    ~~e$$r'   c                 ,    t        | j                        S r;   )r   r    )r!   s    r   __len__ztable__l_o_c_a.__len__E   s    4>>""r'   N)__name__
__module____qualname____doc__dependenciesr&   r3   r,   r9   r=   r?   r   r'   r   r   r   
   s.     8L#(#$5%#r'   r   )	 r   r   r   logging	getLoggerr@   r   r   r   r'   r   <module>rH      s7     
   g!<#\.. <#r'   