
    Ph                     x    d dl mZ d dlmZmZmZ ddlmZ dZdZ	 G d de
      Z G d	 d
ej                        Zy)    )sstruct)tobytestostrsafeEval   )DefaultTablez
		>	# big endian
		tableVersionMajor:	H
		tableVersionMinor: 	H
		flags:	H
		recordsCount:		H
		recordsOffset:		H
		fontNameLength:		H
zH
		>	# big endian
		UV:			L
		cid:		H
		gid:		H
		ggid:		H
		name:		32s
c                   ,    e Zd ZddZd Zd Zd Zd Zy)
GMAPRecordc                 J    || _         || _        || _        || _        || _        y )N)UVcidgidggidname)selfuvr   r   r   r   s         jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/G_M_A_P_.py__init__zGMAPRecord.__init__   s%    		    c                 J   |j                  d       |j                          |j                  d| j                         |j                          |j                  d| j                         |j                          |j                  d| j
                         |j                          |j                  d| j
                         |j                          |j                  d| j                         |j                          |j                  d       |j                          y )Nr
   r   valuer   r   glyphletGidGlyphletName)begintagnewline	simpletagr   r   r   r   endtag)r   writerttFonts      r   toXMLzGMAPRecord.toXML#   s    %TWW-dhh/dhh/dhh7tyy9l#r   c                 T    |d   }|dk(  r|| _         y t        | |t        |             y )Nr   r   )r   setattrr   )r   r   attrscontentr    r   s         r   fromXMLzGMAPRecord.fromXML3   s*    g>!DID$0r   c                     | j                   d| _         t        | j                        }|dk  r| j                  dd|z
  z  z   | _        t        j                  t
        |       }|S )Nr        )r   lenr   r   packGMAPRecordFormat1)r   r    nameLendatas       r   compilezGMAPRecord.compile:   sU    77?DGdii.R<		DBL$99DI||-t4r   c                     dt        | j                        z   dz   t        | j                        z   dz   t        | j                        z   dz   t        | j                        z   dz   t        | j
                        z   dz   S )NzGMAPRecord[ UV: z, cid: z, gid: z, ggid: z, Glyphlet Name: z ])strr   r   r   r   r   )r   s    r   __repr__zGMAPRecord.__repr__C   s    $''l $((m 	
 $((m  $))n "" $))n	 
	
r   N)r   r   r   r    )__name__
__module____qualname__r   r!   r&   r/   r2    r   r   r
   r
      s     1
r   r
   c                   ,    e Zd ZdZg Zd Zd Zd Zd Zy)table_G_M_A_P_zGlyphlets GMAP table

    The ``GMAP`` table is used by Adobe's SING Glyphlets.

    See also https://web.archive.org/web/20080627183635/http://www.adobe.com/devnet/opentype/gdk/topic.html
    c                    t        j                  t        ||       \  }}t        |d | j                         | _        | j                  dz  dk(  sJ d       || j                  d  }g | _        t        | j                        D ]c  }t        j                  t        |t                     \  }}|j                  j                  d      |_        | j                  j                  |       e y )N   r   z0GMAP error: recordsOffset is not 32 bit aligned.r)   )r   unpack2
GMAPFormatr   fontNameLength
psFontNamerecordsOffsetgmapRecordsrangerecordsCountr,   r
   r   stripappend)r   r.   r    dummynewDatai
gmapRecords          r   	decompileztable_G_M_A_P_.decompile]   s     T4@w(=$*=*= >?" 	CB	C  t))+,t(()A")//!7JL#J )oo33D9JO##J/ *r   c                    t        | j                        | _        t        | j                        | _        d| j                  dz   dz   dz  z  | _        t        j                  t        |       }|t        | j                        z   }|d| j
                  t        |      z
  z  z   }| j                  D ]  }||j                  |      z   } |S )Nr;             )r*   rA   rC   r?   r>   r@   r   r+   r=   r   r/   )r   r    r.   records       r   r/   ztable_G_M_A_P_.compilel   s     0 01!$//2D$7$7"$<#Aa"GH||J-gdoo..et11CI=>>&&F&..00D 'r   c                    |j                  d       |j                          t        j                  t              \  }}}|D ]1  }t        | |      }|j                  ||       |j                          3 |j                  d| j                         |j                          | j                  D ]  }|j                  ||        y )Nz7Most of this table will be recalculated by the compilerr   
PSFontName)
commentr   r   	getformatr=   getattrr   r?   rA   r!   )	r   r   r    formatstringnamesfixesr   r   rI   s	            r   r!   ztable_G_M_A_P_.toXMLw   s    PQ%,%6%6z%B"eUDD$'ET/NN  	T__=**JVV, +r   c                 4   |dk(  rkt        | d      sg | _        t               }| j                  j                  |       |D ]-  }t	        |t
              r|\  }}}|j                  ||||       / y |d   }|dk(  r|| _        y t        | |t        |             y )Nr
   rA   r   rQ   )
hasattrrA   r
   rE   
isinstancer1   r&   r?   r#   r   )r   r   r$   r%   r    rI   elementr   s           r   r&   ztable_G_M_A_P_.fromXML   s    <4/#% #J##J/"gs+'.$eW""4@	 # 'NE|#"'dHUO4r   N)	r4   r5   r6   __doc__dependenciesrJ   r/   r!   r&   r7   r   r   r9   r9   S   s"     L0	-5r   r9   N)fontTools.miscr   fontTools.misc.textToolsr   r   r   r3   r   r=   r,   objectr
   r9   r7   r   r   <module>ra      sA    " = = 
 5
 5
pA5\.. A5r   