
    Mcg                     f    d dl mZ d dlmZmZ d dlZdZ ej                  e      Z G d de	      Z
y)    )sstruct)readHexsafeEvalNa  
	>
	originOffsetX: h	# The x-value of the point in the glyph relative to its
						# lower-left corner which corresponds to the origin of
						# the glyph on the screen, that is the point on the
						# baseline at the left edge of the glyph.
	originOffsetY: h	# The y-value of the point in the glyph relative to its
						# lower-left corner which corresponds to the origin of
						# the glyph on the screen, that is the point on the
						# baseline at the left edge of the glyph.
	graphicType:  4s	# e.g. "png "
c                   B    e Zd Z	 	 	 	 	 	 	 	 ddZd Zd Zd Zd Zd Zy)	GlyphNc	                    || _         || _        || _        || _        || _        || _        || _        || _        | j                  | j                  d   dk(  r| j                  d d | _        t        | j                        dkD  rddl	m
}	 |	j                  d      t        | j                        dk  r/| xj                  dd dt        | j                        z
   z  c_        y y y )N    r   ttLibz7Glyph.graphicType must not be longer than 4 characters.z    )gid	glyphNamereferenceGlyphNameoriginOffsetXoriginOffsetYrawdatagraphicType	imageDatalen	fontToolsr   
TTLibError)
selfr   r   r   r   r   r   r   r   r   s
             [/var/www/html/bid-api/venv/lib/python3.12/site-packages/fontTools/ttLib/tables/sbixGlyph.py__init__zGlyph.__init__   s     ""4**&" '#t+#'#3#3CR#8 4##$q(+&&M  T%%&*  F+Ha#d6F6F2G.G$II  + (    c                 B    | j                   dk(  xs | j                   dk(  S )zHReturns True if this glyph is a reference to another glyph's image data.dupeflip)r   )r   s    r   is_reference_typezGlyph.is_reference_type9   s#    6)GT-=-=-GGr   c                 ^   |j                  | j                        | _        | j                  ddlm} |j                  d      t        | j                        dkD  rt        | j                        t        k  rddlm} |j                  d      t        j                  t        | j                  d t         |        | j                         r@t        j                  d| j                  t        d        \  }|j                  |      | _        n| j                  t        d  | _        d | _        | `| `y )Nr   r   zNo table data to decompilezGlyph header too short.>H)getGlyphNamer   r   r   r   r   r   r   sbixGlyphHeaderFormatSizer   unpacksbixGlyphHeaderFormatr    structr   r   )r   ttFontr   r   s       r   	decompilezGlyph.decompile=   s    ,,TXX6<<'""#?@@t||q 4<< #<<+ &&'@AANN%t||4N5N'OQU %%'tT\\:S:T-UV*0*=*=c*B'!%.G.H!I*.'LHr   c                    | j                   ddlm} |j                  d      t	        j
                  d|j                  | j                               | _        | j                  
d}|| _        y t        j
                  t        |       }| j                         r:|t	        j
                  d|j                  | j                              z  }|| _        y | j                  J || j                  z  }|| _        y )Nr   r   z&Can't compile Glyph without glyph namer"   r   )r   r   r   r   r'   pack
getGlyphIDr   r   r   r&   r    r   r   r   )r   r(   r   r   s       r   compilezGlyph.compileY   s    >>!'""#KLL ;;tV%6%6t~~%FG#G  ll#8$?G%%'6;;tV->->t?V?V-WXX  ~~1114>>)r   c                 l   | j                   .|j                  d| j                         |j                          y |j	                  d| j                   | j                  | j
                  | j                         |j                          | j                         r|j                  d| j                         nM|j	                  d       |j                          |j                  | j                         |j                  d       |j                          |j                  d       |j                          y )Nglyph)name)r   r0   r   r   ref)	glyphnamehexdata)r   	simpletagr   newlinebegintagr   r   r    r   dumphexr   endtag)r   	xmlWriterr(   s      r   toXMLzGlyph.toXMLl   s   # dnn=((,,,, 	 	
 	!!#1H1HIy)dnn-Y'!r   c                     |dk(  rFt        d|d   z   dz         }t        j                  d|j                  |            | _        || _        y |dk(  rt        |      | _        y ddlm} |j                  d|z        )	Nr1   z'''r2   r"   r3   r   r   zcan't handle '%s' element)
r   r'   r+   r,   r   r   r   r   r   r   )r   r0   attrscontentr(   r2   r   s          r   fromXMLzGlyph.fromXML   sw    5= !{);!;e!CDI#[[v/@/@/KLDN&/D#Y$W-DN'""#>#EFFr   )NNr   r   NNNr   )	__name__
__module____qualname__r   r    r)   r-   r:   r>    r   r   r   r      s>      JDH8&8Gr   r   )fontTools.miscr   fontTools.misc.textToolsr   r   r'   r&   calcsizer$   objectr   rB   r   r   <module>rG      s<    " 6   -G,,-BC GF Gr   