
    ]Mh                     j    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
dS )    )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                   D    e Zd Z	 	 	 	 	 	 	 	 d	dZd Zd Zd Zd Zd ZdS )
GlyphNr   c	                    || _         || _        || _        || _        || _        || _        || _        || _        | j        | j        d         dk    r| j        d d         | _        t          | j                  dk    rddl	m
}	 |	                    d          t          | j                  dk     r1| xj        dd dt          | j                  z
           z  c_        d S d S d S )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/test/jupyter/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/sbixGlyph.py__init__zGlyph.__init__   s    ""4**&" '#t++#'#3CRC#8 4#$$q((++++++&&M   T%&&**  F+Ha#d6F2G2G.G+H$II     (' +*    c                 .    | j         dk    p
| 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                 z   |                     | j                  | _        | j        ddlm} |                    d          t          | j                  dk    rt          | j                  t          k     rddlm} |                    d          t          j
        t          | j        d t                   |            |                                 rDt          j
        d| j        t          d                    \  }|                     |          | _        n | j        t          d          | _        d | _        | `| `d S )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=   sA   ,,TX66<''''''""#?@@@t|q  4<  #<<<++++++ &&'@AAAN%t|4N5N4N'OQU   %%'' /tT\:S:T:T-UVV*0*=*=c*B*B''!%.G.H.H!I*.'LHHHr   c                    | j         ddlm} |                    d          t	          j        d|                    | j                             | _        | j        d}nrt          j        t          |           }|                                 r1|t	          j        d|                    | j                            z  }n| j        J || j        z  }|| _        d S )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L ;tV%6%6t~%F%FGG#GGl#8$??G%%'' *6;tV->->t?V-W-WXXX~1114>)r   c                    | j         2|                    d| j                   |                                 d S |                    d| j         | j        | j        | j                   |                                 |                                 r|                    d| j                   nX|                    d           |                                 |	                    | j
                   |                    d           |                                 |                    d           |                                 d S )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   sK   # dn===F(,, 	 	
 	
 	
 	!!## 	(1HIIIIy)))dn---Y'''!!!r   c                 $   |dk    rQt          d|d         z   dz             }t          j        d|                    |                    | _        || _        d S |dk    rt          |          | _        d S ddlm} |	                    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   s    5== !{);!;e!CDDI#[v/@/@/K/KLLDN&/D###Y$W--DNNN''''''""#>#EFFFr   )NNr   r   NNNr   )	__name__
__module____qualname__r   r    r)   r-   r:   r>    r   r   r   r      s          J  J  J  JDH H H  8  &  8G G G G Gr   r   )fontTools.miscr   fontTools.misc.textToolsr   r   r'   r&   calcsizer$   objectr   rB   r   r   <module>rG      s    " " " " " " 6 6 6 6 6 6 6 6   -G,-BCC G G G G GF G G G G Gr   