
    <`J                     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                   .    e Zd Zd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
             @lib/python3.11/site-packages/fontTools/ttLib/tables/sbixGlyph.py__init__zGlyph.__init__   s   $($..$$$$$$, $$. 
!
rd""',D	$
a


T
U
UUD!!;S)9%:%:!:;<< "! 	"!    c                 h   |                     | 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                   |            | j        dk    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.dupe>H)getGlyphNamer   r   r   r   r   r   r   sbixGlyphHeaderFormatSizer   unpacksbixGlyphHeaderFormatr   structr   r   )r   ttFontr   r   s       r   	decompilezGlyph.decompile,   s1   &&tx00$.	\			6	7	77	$,333


4
5
55
>'6P7P6P)QSWXXX
&  =t|,E,F,FGHHDC$11#66D\";"<"<=DN"D
l
hhhr   c                    | j         ddlm} |                    d          t	          j        d|                    | j                             | _        | j        	d| _	        d S t          j        t          |           | 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   s      r   compilezGlyph.compileD   s    	^			B	C	CC [v00@@AA$(	4<<<,4d;;dnL4<<<r   c                 ~   | j         d k    r2|                    d| j                   |                                 d S |                    d| j         | j        | j        | j                   |                                 | j         dk    r|                    d| j                   nX|                    d           |                                 |                    | j	                   |
                    d           |                                 |
                    d           |                                 d S )Nglyph)name)r   r-   r   r   r   ref)	glyphnamehexdata)r   	simpletagr   newlinebegintagr   r   r   dumphexr   endtag)r   	xmlWriterr%   s      r   toXMLzGlyph.toXMLP   sI   	 wT^444	6W##	     	u(?@@@@i   T^$$$I7r   c           
         |dk    rHt          j        d|                    t          d|d         z   dz                                 | _        d S |dk    rt          |          | _        d S ddlm} |                    d|z            )	Nr.   r   z'''r/   r0   r   r   zcan't handle '%s' element)	r$   r(   r)   r   r   r   r   r   r   )r   r-   attrscontentr%   r   s         r   fromXMLzGlyph.fromXMLk   s    	U]] Kf&7&7{I[A[^cAc8d8d&e&eff4>>>yG$$4>>>			5<	=	==r   )NNr   r   NNNr   )__name__
__module____qualname__r   r&   r*   r7   r;    r   r   r   r      sg        = = = =*  0
M 
M 
M  6
> 
> 
> 
> 
>r   r   )fontTools.miscr   fontTools.misc.textToolsr   r   r$   r#   calcsizer!   objectr   r?   r   r   <module>rD      s    " " " " " " 6 6 6 6 6 6 6 6   -G,-BCC _> _> _> _> _>F _> _> _> _> _>r   