o
    i                     @   sF   d dl mZ d dlmZmZ d dlZdZeeZG d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                   @   sN   e Zd Z								dddZdd Zdd Zd	d
 Zdd Zdd ZdS )GlyphNr   c	           
      C   s   || _ || _|| _|| _|| _|| _|| _|| _| jd urW| jd dkr,| jd d | _t| jdkr>ddl	m
}	 |	dt| jdk rY|  jdd dt| j  7  _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
    r   o/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/fontTools/ttLib/tables/sbixGlyph.py__init__   s(   
$	zGlyph.__init__c                 C   s   | j dkp	| j dkS )zHReturns True if this glyph is a reference to another glyph's image data.Zdupeflip)r   )r   r   r   r   is_reference_type9   s   zGlyph.is_reference_typec                 C   s   | | j| _| jd u rddlm} |dt| jdkr^t| jtk r0ddlm} |dt	
t| jd t |  |  rSt
d| jtd  \}| || _n| jtd  | _d | _| `| `d S )Nr   r	   zNo table data to decompilezGlyph header too short.>H)ZgetGlyphNamer   r   r   r   r
   r   r   sbixGlyphHeaderFormatSizer   unpacksbixGlyphHeaderFormatr   structr   r   )r   ttFontr
   r   r   r   r   	decompile=   s$   


zGlyph.decompilec                 C   s   | j d u rddlm} |dtd|| j | _| jd u r#d}n#t	t
| }|  r:|td|| j7 }n| jd usAJ || j7 }|| _d S )Nr   r	   z&Can't compile Glyph without glyph namer       )r   r   r
   r   r    pack
getGlyphIDr   r   r   r   r   r   r   r   )r   r!   r
   r   r   r   r   compileY   s   




zGlyph.compilec                 C   s   | j d u r|jd| jd |  d S |jd| j | j| j| jd |  |  r2|jd| jd n|d |  |	| j
 |d |  |d |  d S )NZglyph)name)r   r'   r   r   ref)	glyphnamehexdata)r   Z	simpletagr   newlineZbegintagr   r   r   r   Zdumphexr   Zendtag)r   Z	xmlWriterr!   r   r   r   toXMLl   s*   



zGlyph.toXMLc                 C   sj   |dkrt d|d  d }td||| _|| _d S |dkr(t|| _d S ddlm} |	d| )	Nr(   z'''r)   r   r*   r   r	   zcan't handle '%s' element)
r   r    r$   r%   r   r   r   r   r
   r   )r   r'   attrscontentr!   r)   r
   r   r   r   fromXML   s   
zGlyph.fromXML)NNr   r   NNNr   )	__name__
__module____qualname__r   r   r"   r&   r,   r/   r   r   r   r   r      s    
"r   )ZfontTools.miscr   ZfontTools.misc.textToolsr   r   r    r   calcsizer   objectr   r   r   r   r   <module>   s    
