a
    èÝEbvm ã                (   @   sL  d Z ddlmZ ddlmZ ddlmZmZ ddlmZm	Z	m
Z
mZmZmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlZddlZddlZejd Ze e¡ZdZdZ G dd„ de!ƒZ"G dd„ dej#ƒZ$G dd„ de%ƒZ&G dd„ de%ƒZ'dd„ Z(G dd„ de%ƒZ)G dd„ de)ƒZ*G dd„ de)ƒZ+G dd „ d e)ƒZ,G d!d"„ d"e)ƒZ-G d#d$„ d$e-ƒZ.G d%d&„ d&e-ƒZ/G d'd(„ d(e%ƒZ0G d)d*„ d*e0ƒZ1G d+d,„ d,e1ƒZ2G d-d.„ d.e0ƒZ3G d/d0„ d0e0ƒZ4G d1d2„ d2e%ƒZ5G d3d4„ d4e%ƒZ6G d5d6„ d6e%ƒZ7d7d8„ Z8d9d:„ Z9d;d<„ Z:d=d>„ Z;d?d@„ Z<dAdB„ Z=dCdD„ Z>dEdF„ Z?dGdH„ Z@dIdJ„ ZAdKdL„ ZBdMdN„ ZCdOdP„ ZDdQdR„ ZEG dSdT„ dTe%ƒZFG dUdV„ dVeFƒZGG dWdX„ dXeFƒZHdYdZ„ ZId[d\„ ZJG d]d^„ d^eFƒZKG d_d`„ d`eFƒZLG dadb„ dbeFƒZMG dcdd„ ddeMƒZNG dedf„ dfeMƒZOG dgdh„ dheMƒZPG didj„ djeFƒZQG dkdl„ dle%ƒZRdmdn„ ZSdodp„ ZTdqdr„ ZUdsdt„ ZVdudv„ ZWdwdx„ ZXdydz„ ZYG d{d|„ d|e%ƒZZG d}d~„ d~eFƒZ[dd€„ Z\d�d‚„ Z]dƒd„„ Z^d…d†„ Z_G d‡dˆ„ dˆeMƒZ`G d‰dŠ„ dŠeFƒZaG d‹dŒ„ dŒeFƒZbd�dŽ„ Zcd�d�„ Zdd‘d’„ ZeG d“d”„ d”e%ƒZfG d•d–„ d–e%ƒZgG d—d˜„ d˜eFƒZhd™dšd›dœdehƒ fd�džddŸd deHƒ fd¡d¢d deHƒ fd£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯g d°¢dfd±d²d³d¯g d´¢dfdµd¶d·d¸d¹dºd»d¼d½d¾d¿dÀdeQƒ fdÁdÂdÃdÀde[ƒ fdÄdÅdÆdeNƒ fdÇd4dÀdeaƒ fdÈdÉdÀde`ƒ fdÊd6dÀdePƒ fdËdÌdÀdebƒ fg$Zid™d­d®d¯g d°¢dfdÇd4dÀdeaƒ fdÈdÉdÀde`ƒ fdÊd6dÀdePƒ fdËdÌdÀdebƒ fgZjdÍZkdÎZldÏelekdÐddfdÑdÒdÓdÔdÕdÖd×dØdÙdÚdÛdÜdÝdÞdßdàdádâdãdädådÀdeOƒ fgZmdÏelekdÐddfdÑdÒdÓdÔdÕdÖd×dØdÙdÚdÛdßdàdädådÀdeOƒ fgZndædç„ Zoeoemƒ eoeiƒ G dèdé„ déejpƒZqG dêdë„ dëejpƒZrG dìdí„ díe%ƒZsdîdï„ ZtG dðdñ„ dñesƒZuG dòdó„ dóesƒZvG dôdõ„ dõesƒZwG död÷„ d÷e%ƒZxG dødù„ dùexƒZyG dúdû„ dûexƒZzG düdý„ dýexƒZ{G dþdÿ„ dÿe%ƒZ|g �d ¢Z}�dZ~ee}ƒe~k�sÂJ ‚i Z€e�e~ƒD ]Z‚e‚e€e}e‚ < �qÎg �d¢Zƒ�dZ„eeƒƒe„k�sJ ‚g �d¢Z…�dZ†ee…ƒe†k�s&J ‚g �d¢Z‡�dZˆee‡ƒeˆk�sHJ ‚dS (  a+  cffLib: read/write Adobe CFF fonts

OpenType fonts with PostScript outlines contain a completely independent
font file, Adobe's *Compact Font Format*. So dealing with OpenType fonts
requires also dealing with CFF. This module allows you to read and write
fonts written in the CFF format.

In 2016, OpenType 1.8 introduced the `CFF2 <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2>`_
format which, along with other changes, extended the CFF format to deal with
the demands of variable fonts. This module parses both original CFF and CFF2.

é    )Ússtruct)ÚpsCharStrings)Ú	unionRectÚintRect)ÚbytechrÚbyteordÚ	bytesjoinÚtobytesÚtostrÚsafeEval)ÚTTFont)ÚOTTableWriter)ÚOTTableReader)ÚotTables)ÚBytesIONé   z%
	major:   B
	minor:   B
	hdrSize: B
i  c                   @   s   e Zd ZdS )ÚStopHintCountEventN)Ú__name__Ú
__module__Ú__qualname__© r   r   úY/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/fontTools/cffLib/__init__.pyr   )   s   r   c                   @   sJ   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dS )Ú_DesubroutinizingT2Decompiler)Úop_hintmaskZop_cntrmaskZ
op_rmovetoZ
op_hmovetoZ
op_vmovetoNc                 C   s   t j | |||¡ d S ©N)r   ÚSimpleT2DecompilerÚ__init__)ÚselfÚ
localSubrsÚglobalSubrsÚprivater   r   r   r   1   s    ÿz&_DesubroutinizingT2Decompiler.__init__c                 C   sf  d| _ | jD ]}t| || jƒ qt|dƒrh| j rd| jrdztj | |¡ W n t	yb   | jd= Y n0 d S g |_
tj | |¡ |jd d … }t|j
ƒD ]t\}}|dks¨J ‚||d  dv sÈJ ||d  ƒ‚t||d  ƒtksàJ ‚|d dkrø|d d… }|||d |…< q”| jj�sXd|v �r6|d | d¡d … }n"t|ƒ�rN|d dk�rX| d¡ ||_|`
d S )	NTÚ_desubroutinizedéÿÿÿÿé   r   )ZcallsubrZ	callgsubrÚreturnÚendchar)Úneed_hintcountÚstop_hintcount_opsÚsetattrÚstop_hint_countÚhasattrÚcallingStackr   r   Úexecuter   Ú_patchesÚprogramÚreversedÚtypeÚintr    Úin_cff2ÚindexÚlenÚappendr!   )r   Ú
charStringÚop_nameZdesubroutinizedÚidxZ	expansionr   r   r   r,   5   s6    

 


z%_DesubroutinizingT2Decompiler.executec                 C   s4   | j | jd | j  }tj | |¡ |  ||¡ d S ©Nr"   )r   ÚoperandStackZ	localBiasr   r   Úop_callsubrÚprocessSubr©r   r3   Úsubrr   r   r   r;   [   s    z)_DesubroutinizingT2Decompiler.op_callsubrc                 C   s4   | j | jd | j  }tj | |¡ |  ||¡ d S r9   )r   r:   Z
globalBiasr   r   Úop_callgsubrr<   r=   r   r   r   r?   `   s    z*_DesubroutinizingT2Decompiler.op_callgsubrc                 G   s<   d| _ | jD ]}t| |d ƒ q| jd }t|dƒr8tƒ ‚d S )NFr"   r!   )r&   r'   r(   r+   r*   r   )r   Úargsr7   Úcsr   r   r   r)   e   s    


z-_DesubroutinizingT2Decompiler.stop_hint_countc                 C   s    t j | |¡ | jr|  ¡  d S r   )r   r   r   r&   r)   ©r   r3   r   r   r   r   m   s    z)_DesubroutinizingT2Decompiler.op_hintmaskc                 C   s*   | j d }t|dƒs&|j ||jf¡ d S )Nr"   r!   )r+   r*   r-   r5   r!   )r   r3   r>   rA   r   r   r   r<   r   s    

z)_DesubroutinizingT2Decompiler.processSubr)N)r   r   r   r'   r   r,   r;   r?   r)   r   r<   r   r   r   r   r   -   s   
&r   c                   @   sf   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zddd„Z	dd„ Z
ddd„Zdd„ Zdd„ ZdS )Ú
CFFFontSeta  A CFF font "file" can contain more than one font, although this is
	extremely rare (and not allowed within OpenType fonts).

	This class is the entry point for parsing a CFF table. To actually
	manipulate the data inside the CFF font, you will want to access the
	``CFFFontSet``'s :class:`TopDict` object. To do this, a ``CFFFontSet``
	object can either be treated as a dictionary (with appropriate
	``keys()`` and ``values()`` methods) mapping font names to :class:`TopDict`
	objects, or as a list.

	.. code:: python

		from fontTools import ttLib
		tt = ttLib.TTFont("Tests/cffLib/data/LinLibertine_RBI.otf")
		tt["CFF "].cff
		# <fontTools.cffLib.CFFFontSet object at 0x101e24c90>
		tt["CFF "].cff[0] # Here's your actual font data
		# <fontTools.cffLib.TopDict object at 0x1020f1fd0>
	
	Nc                 C   s8  || _ t t| d¡| ¡ |durL|r*dnd}| j|krhtd|| jf ƒ‚n| jdv s^J dƒ‚| jdk}|sÆt d| d¡¡d	 | _| 	| j
¡ td
d„ t||d�D ƒƒ| _t||d�| _t|ƒ| _nLt d| d¡¡d	 | _| 	| j
¡ dg| _|j}t||| j|d�| _d| _t||d�| _| j| j_| j| j_dS )ag  Parse a binary CFF file into an internal representation. ``file``
		should be a file handle object. ``otFont`` is the top-level
		:py:class:`fontTools.ttLib.ttFont.TTFont` object containing this CFF file.

		If ``isCFF2`` is passed and set to ``True`` or ``False``, then the
		library makes an assertion that the CFF header is of the appropriate
		version.
		é   Nr#   r   ú2Invalid CFF 'major' version: expected %d, found %d©r   r#   úUnknown CFF formatÚBr   c                 s   s   | ]}t |ƒV  qd S r   ©r
   ©Ú.0Úsr   r   r   Ú	<genexpr>©   ó    z'CFFFontSet.decompile.<locals>.<genexpr>©ÚisCFF2ú>HÚCFF2Font)ÚotFontr   ÚunpackÚcffHeaderFormatÚreadÚmajorÚ
ValueErrorÚstructÚoffSizeÚseekÚhdrSizeÚlistÚIndexÚ	fontNamesÚTopDictIndexÚtopDictIndexÚIndexedStringsÚstringsÚtopDictSizeÚgetGlyphOrderÚGlobalSubrsIndexÚGlobalSubrs)r   ÚfilerS   rP   Úexpected_majorÚcff2GetGlyphOrderr   r   r   Ú	decompileŽ   s:    

ÿÿ

ÿ
zCFFFontSet.decompilec                 C   s
   t | jƒS r   )r4   r_   ©r   r   r   r   Ú__len__¹   s    zCFFFontSet.__len__c                 C   s
   t | jƒS r   )r]   r_   rl   r   r   r   Úkeys¼   s    zCFFFontSet.keysc                 C   s   | j S r   )ra   rl   r   r   r   Úvalues¿   s    zCFFFontSet.valuesc                 C   sb   t |dƒr| ¡ }nDt|tƒrP|}z| j |¡}W qX tyL   t|ƒ‚Y qX0 nt|ƒ‚| j	| S )zp Return TopDict instance identified by name (str) or index (int
		or any object that implements `__index__`).
		Ú	__index__)
r*   rp   Ú
isinstanceÚstrr_   r3   rX   ÚKeyErrorÚ	TypeErrorra   )r   ZnameOrIndexr3   Únamer   r   r   Ú__getitem__Â   s    


zCFFFontSet.__getitem__c                 C   sÜ  || _ |dur8|rdnd}| j|krTtd|| jf ƒ‚n| jdv sJJ dƒ‚| jdk}|jrr|sr| jD ]}| ¡  qd|s~tƒ }nd}t|ƒ}| jj|| |d�}|rØd| _	| 
t t| ¡¡ | ¡ | _| 
t d	| j¡¡ n2d
| _	d
| _| 
t t| ¡¡ | 
t d| j¡¡ |�sDtƒ }	| jD ]}
|	 |
¡ �q| 
|	j|| |d�¡ | 
|¡ |�sb| 
| ¡ ¡ | 
| jj|| |d�¡ | jD ],}t|dƒ�rœ|jdu �r€| ¡ }||_�q€| |¡}|D ]}| 
|¡ �q¼| |¡ dS )at  Write the object back into binary representation onto the given file.
		``file`` should be a file handle object. ``otFont`` is the top-level
		:py:class:`fontTools.ttLib.ttFont.TTFont` object containing this CFF file.

		If ``isCFF2`` is passed and set to ``True`` or ``False``, then the
		library makes an assertion that the CFF header is of the appropriate
		version.
		Nr#   r   rE   rF   rG   rO   é   rQ   é   rH   Úcharset)rS   rW   rX   ZrecalcBBoxesra   ÚrecalcFontBBoxrb   Ú	CFFWriterÚgetCompilerr\   Úaddr   ÚpackrU   ÚgetDataLengthrd   rY   rZ   r^   r_   r5   rg   r*   ry   re   ÚgetChildrenÚtoFile)r   rh   rS   rP   ri   ÚtopDictrc   ÚwriterZtopCompilerr_   ru   ry   ÚchildrenÚchildr   r   r   ÚcompileÒ   sZ    	
ÿÿ









zCFFFontSet.compilec                 C   s¶   |j d| jd� | ¡  |j d| jd� | ¡  | jD ]B}|jdt|ƒd� | ¡  | | }| |¡ | d¡ | ¡  q6| ¡  | d¡ | ¡  | j	 |¡ | d¡ | ¡  dS )zËWrite the object into XML representation onto the given
		:class:`fontTools.misc.xmlWriter.XMLWriter`.

		.. code:: python

			writer = xmlWriter.XMLWriter(sys.stdout)
			tt["CFF "].cff.toXML(writer)

		rW   ©ÚvalueÚminorÚCFFFont©ru   rg   N)
Ú	simpletagrW   Únewliner‰   r_   Úbegintagr
   ÚtoXMLÚendtagrg   )r   Ú	xmlWriterÚfontNameÚfontr   r   r   r�     s"    





zCFFFontSet.toXMLc                 C   s:  || _ t| dƒsd| _t| dƒs&d| _|dk�r˜| jdkr¬t| dƒsJd| _t| dƒsZd| _t| d	ƒsltƒ | _t| d
ƒs„g | _t	ƒ | _
|d }| j |¡ t| jd�}d|_nd| jdk�rt| dƒsÈd| _t| d	ƒsÚtƒ | _t| d
ƒsìdg| _| j j}t| j|d�}t	d|dƒ| _
| j
 |¡ |D ].}t|tƒ�r4�q |\}}}| |||¡ �q t|dƒ�r6|jd jdu �r6|j}	|	D ]}
t|
dƒ�rx|j|
j_�qxnž|d	k�rtj}t| d	ƒ�s¼tƒ | _|D ]@}t|tƒ�rÔ�qÀ|\}}}|ƒ }| |||¡ | j |¡ �qÀn2|dk�rt|d ƒ| _n|dk�r6t|d ƒ| _dS )z?Reads data from the XML element into the ``CFFFontSet`` object.rW   r   r‰   r   rŠ   rZ   rx   r\   rg   r_   ru   )rg   Nr#   rw   rR   )rg   rj   ÚVarStoreÚPrivaterˆ   )rS   r*   rW   r‰   rZ   r\   rf   rg   r_   r`   ra   r5   ÚTopDictry   re   rq   rr   ÚfromXMLÚFDArrayÚvstorer”   r•   r   ÚT2CharStringr1   )r   ru   ÚattrsÚcontentrS   r’   r‚   rj   ÚelementÚfdArrayÚfontDictZsubrCharStringClassr>   r   r   r   r—   .  sv    










þ




zCFFFontSet.fromXMLc                 C   s:  d| _ | jj}td|dƒ}| jj|_|| _|d }t|dƒrD|j}nd}tt	ƒ}||_
||_tD ]:}|d }||vr`||jv r†|j|= t||ƒr`t||ƒ q`t|dƒ�sXtƒ  }	|_d|	_|j|	_|	|j_|j}
|
jrà|	|
j_n|	|
_tƒ }| d¡ |	 |¡ ||_ttƒ}tD ]B}|d }||v�r||jv �r<|j|= t||ƒ�rt||ƒ �qn®|j}	ttƒ}|	D ]š}| d¡ |j ¡ D ]0}||j
v�r‚|j|= t||ƒ�r‚t||ƒ �q‚|j}tD ]B}|d }||v�r¾||jv �rè|j|= t||ƒ�r¾t||ƒ �q¾�qjtƒ }| j||dd� | d¡ | j ||dd� dS )	zåConverts this object from CFF format to CFF2 format. This conversion
		is done 'in-place'. The conversion cannot be reversed.

		This assumes a decompiled CFF table. (i.e. that the object has been
		filled via :meth:`decompile`.)r#   Nr   r•   r   r˜   TrO   )!rW   rS   re   r`   ra   Úitemsr*   r•   Ú
buildOrderÚtopDictOperators2Úorderrj   ÚtopDictOperatorsÚrawDictÚdelattrÚFDArrayIndexr˜   rc   rg   rž   ÚCharStringsÚcharStringsAreIndexedÚcharStringsIndexÚFontDictÚsetCFF2r5   ÚprivateDictOperators2ÚprivateDictOperatorsrn   r   r†   r[   rk   )r   rS   rj   ZtopDictDatar‚   ZprivateDictZopOrderÚentryÚkeyrž   ÚcharStringsrŸ   ZprivateOpOrderrh   r   r   r   ÚconvertCFFToCFF2r  sz    










zCFFFontSet.convertCFFToCFF2c                 C   sâ   | j D ]Ì}| | }|j}|jD ]N}| |¡\}}| ¡  t|jdg ƒ}t||j|jƒ}| 	|¡ |j
|_|`
qt|dƒr¬|jD ]*}	|	j}
t|
dƒr–|
`d|
jv r~|
jd= q~q|j}
t|
dƒrÀ|
`d|
jv r|
jd= q| j ¡  d S )NÚSubrsr˜   )r_   r¨   ry   ÚgetItemAndSelectorrk   Úgetattrr    r   r   r,   r!   r.   r*   r˜   r•   r³   r¥   rg   Úclear)r   r’   r“   rA   ÚgÚcÚ_ZsubrsZ
decompilerÚfdÚpdr   r   r   ÚdesubroutinizeÂ  s0    









zCFFFontSet.desubroutinize)N)N)N)r   r   r   Ú__doc__rk   rm   rn   ro   rv   r†   r�   r—   r²   r¼   r   r   r   r   rC   x   s   
+
?
DPrC   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	r{   zUHelper class for serializing CFF data to binary. Used by
	:meth:`CFFFontSet.compile`.c                 C   s   g | _ || _d S r   )ÚdatarP   ©r   rP   r   r   r   r   ã  s    zCFFWriter.__init__c                 C   s   | j  |¡ d S r   )r¾   r5   )r   Útabler   r   r   r}   ç  s    zCFFWriter.addc           	      C   sR  d }d}t   td|¡ |d }d}|g}| jD ]f}t|dƒrd|| ¡  }t|tƒrp|jrp| ¡ | _n|t	|ƒ }t|dƒr†| 
||¡ |}| |¡ q.||kr q¦|}qt   td¡ | ¡ }| jrÖt d| j¡| jd< n"t|d ƒ| _t d	| j¡| jd< dg}| jD ]:}t|d
ƒ�r | |¡ n
| |¡ | | ¡ | ¡ �q||k�sNJ ‚d S )Nr   z CFFWriter.toFile() iteration: %dr   r   ÚsetPosz#CFFWriter.toFile() writing to file.rQ   r"   rH   r�   )ÚlogÚDEBUGr¾   r*   r   rq   ÚTopDictIndexCompilerrP   rd   r4   rÁ   r5   ÚtellrY   r~   ÚcalcOffSizerZ   r�   Úwrite)	r   rh   ZlastPosListÚcountÚposZposListÚitemÚendPosÚbeginr   r   r   r�   ê  s@    




zCFFWriter.toFileN)r   r   r   r½   r   r}   r�   r   r   r   r   r{   à  s   r{   c                 C   s2   | dk rd}n | dk rd}n| dk r*d}nd}|S )Né   r   i   r#   i   rD   rx   r   )ZlargestOffsetrZ   r   r   r   rÆ     s    rÆ   c                   @   s:   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚIndexCompilerz‚Base class for writing CFF `INDEX data <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#5-index-data>`_
	to binary.Nc                 C   sB   |d u r$t |dƒr$|j}|d us$J ‚|| _|  ||¡| _|| _d S ©NrP   )r*   rP   ÚgetItemsr    Úparent)r   r    rc   rÑ   rP   r   r   r   r   !  s    zIndexCompiler.__init__c                 C   s   |S r   r   ©r   r    rc   r   r   r   rÐ   )  s    zIndexCompiler.getItemsc                 C   sT   | j rLd}|g}| j D ]2}t|dƒr2|| ¡  }n|t|ƒ }| |¡ qng }|S )Nr   r   )r    r*   r   r4   r5   )r   rÉ   ÚoffsetsrÊ   r   r   r   Ú
getOffsets,  s    

zIndexCompiler.getOffsetsc                 C   sV   | j rd}nd}| jrN|  ¡ d }t|ƒ}|d t| jƒd |  | d }n|}|S )Nrx   r#   r"   r   )rP   r    rÔ   rÆ   r4   )r   Z	countSizeZ
lastOffsetrZ   Ú
dataLengthr   r   r   r   ;  s$    ÿþýýÿzIndexCompiler.getDataLengthc           	      C   sÌ   |   ¡ }| jr t|t| jƒƒ nt|t| jƒƒ | jrÈt|d ƒ}t||ƒ | }tj	}|D ]2}|d|ƒ|d … }t|ƒ| ks„J ‚| 
|¡ q\| jD ]0}t|dƒr°| |¡ q–t|dd�}| 
|¡ q–d S )Nr"   ú>lr�   Úlatin1©Úencoding)rÔ   rP   ÚwriteCard32r4   r    ÚwriteCard16rÆ   Ú
writeCard8rY   r~   rÇ   r*   r�   r	   )	r   rh   rÓ   rZ   r~   ÚoffsetÚ	binOffsetrÊ   r¾   r   r   r   r�   P  s$    


zIndexCompiler.toFile)N)	r   r   r   r½   r   rÐ   rÔ   r   r�   r   r   r   r   rÎ     s   
rÎ   c                   @   s   e Zd Zdd„ ZdS )ÚIndexedStringsCompilerc                 C   s   |j S r   ©rc   rÒ   r   r   r   rÐ   j  s    zIndexedStringsCompiler.getItemsN)r   r   r   rÐ   r   r   r   r   rß   h  s   rß   c                       sH   e Zd ZdZdd„ Zdd„ Z‡ fdd„Z‡ fdd	„Z‡ fd
d„Z‡  Z	S )rÄ   z/Helper class for writing the TopDict to binary.c                 C   s$   g }|D ]}|  | || ¡¡ q|S r   ©r5   r|   ©r   r    rc   ÚoutrÊ   r   r   r   rÐ   q  s    zTopDictIndexCompiler.getItemsc                 C   s$   g }| j D ]}| | |¡¡ q
|S r   ©r    Úextendr€   )r   rc   r„   r‚   r   r   r   r€   w  s    
z TopDictIndexCompiler.getChildrenc                    s.   | j rd| jd  ¡ g}|S tt| ƒ ¡ S d S ©Nr   )rP   r    r   ÚsuperrÄ   rÔ   )r   rÓ   ©Ú	__class__r   r   rÔ   }  s    zTopDictIndexCompiler.getOffsetsc                    s*   | j r| jd  ¡ }|S tt| ƒ ¡ S d S ræ   )rP   r    r   rç   rÄ   )r   rÕ   rè   r   r   r   „  s    z"TopDictIndexCompiler.getDataLengthc                    s,   | j r| jd  |¡ ntt| ƒ |¡ d S ræ   )rP   r    r�   rç   rÄ   ©r   rh   rè   r   r   r�   ‹  s    zTopDictIndexCompiler.toFile)
r   r   r   r½   rÐ   r€   rÔ   r   r�   Ú__classcell__r   r   rè   r   rÄ   n  s   rÄ   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚFDArrayIndexCompilerz¨Helper class for writing the
	`Font DICT INDEX <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#10-font-dict-index-font-dicts-and-fdselect>`_
	to binary.c                 C   s$   g }|D ]}|  | || ¡¡ q|S r   rá   râ   r   r   r   rÐ   —  s    zFDArrayIndexCompiler.getItemsc                 C   s$   g }| j D ]}| | |¡¡ q
|S r   rä   )r   rc   r„   rŸ   r   r   r   r€   �  s    
z FDArrayIndexCompiler.getChildrenc                 C   sº   |   ¡ }| jr t|t| jƒƒ nt|t| jƒƒ t|d ƒ}t||ƒ | }tj	}|D ]2}|d|ƒ|d … }t|ƒ| ks~J ‚| 
|¡ qV| jD ]$}t|dƒrª| |¡ q�| 
|¡ q�d S )Nr"   rÖ   r�   )rÔ   rP   rÚ   r4   r    rÛ   rÆ   rÜ   rY   r~   rÇ   r*   r�   )r   rh   rÓ   rZ   r~   rÝ   rÞ   rÊ   r   r   r   r�   £  s     


zFDArrayIndexCompiler.toFilec                 C   s   || j jd< d S )Nr˜   ©rÑ   r¥   ©r   rÉ   rË   r   r   r   rÁ   ·  s    zFDArrayIndexCompiler.setPosN)r   r   r   r½   rÐ   r€   r�   rÁ   r   r   r   r   rì   ’  s
   rì   c                   @   s   e Zd ZdZdd„ ZdS )ÚGlobalSubrsCompilerz¤Helper class for writing the `global subroutine INDEX <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#9-local-and-global-subr-indexes>`_
	to binary.c                 C   s*   g }|D ]}|  | j¡ | |j¡ q|S r   ©r†   rP   r5   Úbytecode©r   r    rc   rã   rA   r   r   r   rÐ   ¿  s
    zGlobalSubrsCompiler.getItemsN)r   r   r   r½   rÐ   r   r   r   r   rï   »  s   rï   c                   @   s   e Zd ZdZdd„ ZdS )ÚSubrsCompilerz£Helper class for writing the `local subroutine INDEX <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#9-local-and-global-subr-indexes>`_
	to binary.c                 C   s   || j j }|| j jd< d S ©Nr³   )rÑ   rÉ   r¥   )r   rÉ   rË   rÝ   r   r   r   rÁ   Ë  s    zSubrsCompiler.setPosN)r   r   r   r½   rÁ   r   r   r   r   ró   Ç  s   ró   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚCharStringsCompilerzžHelper class for writing the `CharStrings INDEX <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#9-local-and-global-subr-indexes>`_
	to binary.c                 C   s*   g }|D ]}|  | j¡ | |j¡ q|S r   rð   rò   r   r   r   rÐ   Ó  s
    zCharStringsCompiler.getItemsc                 C   s   || j jd< d S ©Nr¨   rí   rî   r   r   r   rÁ   Ú  s    zCharStringsCompiler.setPosN)r   r   r   r½   rÐ   rÁ   r   r   r   r   rõ   Ð  s   rõ   c                   @   sX   e Zd ZdZeZddd„Zdd„ Zdd„ Zd	d
„ Z	dd„ Z
dd„ Zddd„Zdd„ ZdS )r^   z¡This class represents what the CFF spec calls an INDEX (an array of
	variable-sized objects). `Index` items can be addressed and set using
	Python list indexing.Nc                 C   s8  |d u |d u ksJ ‚g | _ | jj}|d u r.d S || _t td|| ¡ ¡ || _|r\t|ƒ}nt	|ƒ}|dkrpd S d g| | _ t
|ƒ}t td||¡ |dks¨J d| ƒ‚g  | _}dd|  }t|d ƒD ]2}| |¡}	||	 }	t d|	¡\}
| t|
ƒ¡ qÊ| ¡ d | _| | j|d	  ¡ t td
|| ¡ ¡ d S )Núloading %s at %sr   z    index count: %s offSize: %srx   zoffSize too large: %só    r   ú>Lr"   ú    end of %s at %s)r    ré   r   Ú_isCFF2rÂ   rÃ   rÅ   rh   Ú
readCard32Ú
readCard16Ú	readCard8rÓ   ÚrangerV   rY   rT   r5   r1   Ú
offsetBaser[   )r   rh   rP   ru   rÈ   rZ   rÓ   Úpadr3   ÚchunkrÝ   r   r   r   r   å  s6    


zIndex.__init__c                 C   s
   t | jƒS r   )r4   r    rl   r   r   r   rm     s    zIndex.__len__c                 C   s†   | j | }|d ur|S | j| | j }| j|d  | j|  }| j}| |¡ | |¡}t|ƒ|kshJ ‚|  ||||¡}|| j |< |S ©Nr   )r    rÓ   r   rh   r[   rV   r4   ÚproduceItem)r   r3   rÊ   rÝ   Úsizerh   r¾   r   r   r   rv     s    



zIndex.__getitem__c                 C   s   || j |< d S r   ©r    )r   r3   rÊ   r   r   r   Ú__setitem__  s    zIndex.__setitem__c                 C   s   |S r   r   )r   r3   r¾   rh   rÝ   r   r   r   r    s    zIndex.produceItemc                 C   s   | j  |¡ dS )zAdd an item to an INDEX.N)r    r5   )r   rÊ   r   r   r   r5     s    zIndex.appendc                 C   s   | j | |||d�S ©NrO   ©ÚcompilerClass©r   rc   rÑ   rP   r   r   r   r|     s    zIndex.getCompilerc                 C   s   | j dd…= dS )zEmpty the INDEX.Nr  rl   r   r   r   r¶   !  s    zIndex.clear)NN)N)r   r   r   r½   rÎ   r
  r   rm   rv   r  r  r5   r|   r¶   r   r   r   r   r^   Þ  s   

r^   c                       sR   e Zd ZdZeZejZejZ	d‡ fdd„	Z
dd„ Zdd„ Zd	d
„ Zdd„ Z‡  ZS )rf   aä  This index contains all the global subroutines in the font. A global
	subroutine is a set of ``CharString`` data which is accessible to any
	glyph in the font, and are used to store repeated instructions - for
	example, components may be encoded as global subroutines, but so could
	hinting instructions.

	Remember that when interpreting a ``callgsubr`` instruction (or indeed
	a ``callsubr`` instruction) that you will need to add the "subroutine
	number bias" to number given:

	.. code:: python

		tt = ttLib.TTFont("Almendra-Bold.otf")
		u = tt["CFF "].cff[0].CharStrings["udieresis"]
		u.decompile()

		u.toXML(XMLWriter(sys.stdout))
		# <some stuff>
		# -64 callgsubr <-- Subroutine which implements the dieresis mark
		# <other stuff>

		tt["CFF "].cff[0].GlobalSubrs[-64] # <-- WRONG
		# <T2CharString (bytecode) at 103451d10>

		tt["CFF "].cff[0].GlobalSubrs[-64 + 107] # <-- RIGHT
		# <T2CharString (source) at 103451390>

	("The bias applied depends on the number of subrs (gsubrs). If the number of
	subrs (gsubrs) is less than 1240, the bias is 107. Otherwise if it is less
	than 33900, it is 1131; otherwise it is 32768.",
	`Subroutine Operators <https://docs.microsoft.com/en-us/typography/opentype/otspec180/cff2charstr#section4.4>`)
	Nc                    s8   t t| ƒj||d� || _|| _|r*|| _|r4|| _d S r  )rç   rf   r   r   r    ÚfdSelectrž   )r   rh   r   r    r  rž   rP   rè   r   r   r   L  s    zGlobalSubrsIndex.__init__c                 C   sn   | j d ur| j }nJt| dƒrX| jd urXt| dƒrF| jd urF| j| }nd}| j| j}nd }| j||| jd�S )Nrž   r  r   ©r    r   )r    r*   rž   r  r•   Ú	subrClassr   )r   r3   r¾   rh   rÝ   r    ÚfdIndexr   r   r   r  V  s    
zGlobalSubrsIndex.produceItemc                 C   s|   |  d¡ | ¡  tt| ƒƒD ]X}| | }| ¡ rD|jd|dd� n|jd|d� | ¡  | |¡ | d¡ | ¡  qdS )zåWrite the subroutines index into XML representation onto the given
		:class:`fontTools.misc.xmlWriter.XMLWriter`.

		.. code:: python

			writer = xmlWriter.XMLWriter(sys.stdout)
			tt["CFF "].cff[0].GlobalSubrs.toXML(writer)

		zDThe 'index' attribute is only for humans; it is ignored when parsed.Ú
CharStringr   )r3   Úraw©r3   N)Úcommentr�   rÿ   r4   ÚneedsDecompilationrŽ   r�   r�   )r   r‘   Úir>   r   r   r   r�   c  s    
ÿ

zGlobalSubrsIndex.toXMLc                 C   s0   |dkrd S |   ¡ }| |||¡ |  |¡ d S )Nr  )r  r—   r5   )r   ru   r›   rœ   r>   r   r   r   r—   |  s
    zGlobalSubrsIndex.fromXMLc                 C   s$   d }t | dƒr| j| }| | |fS )Nr  )r*   r  )r   r3   Úselr   r   r   r´   ƒ  s    

z#GlobalSubrsIndex.getItemAndSelector)NNNNNN)r   r   r   r½   rï   r
  r   rš   r  ÚcharStringClassr   r  r�   r—   r´   rë   r   r   rè   r   rf   &  s   !  ÿ
rf   c                   @   s   e Zd ZdZeZdS )Ú
SubrsIndexz³This index contains a glyph's local subroutines. A local subroutine is a
	private set of ``CharString`` data which is accessible only to the glyph to
	which the index is attached.N)r   r   r   r½   ró   r
  r   r   r   r   r  Š  s   r  c                       s6   e Zd ZdZeZd
‡ fdd„	Zdd„ Zdd	„ Z‡  Z	S )r`   aS  This index represents the array of ``TopDict`` structures in the font
	(again, usually only one entry is present). Hence the following calls are
	equivalent:

	.. code:: python

		tt["CFF "].cff[0]
		# <fontTools.cffLib.TopDict object at 0x102ed6e50>
		tt["CFF "].cff.topDictIndex[0]
		# <fontTools.cffLib.TopDict object at 0x102ed6e50>

	Nr   c                    s¶   |d u |d u ksJ ‚|| _ |d urž|rž|| _g | _| jj}t td|| ¡ ¡ || _d}d g| | _d|g| _	| ¡ | _
| | j
| ¡ t td|| ¡ ¡ ntt| ƒj||d� d S )Nr÷   r   r   rú   rO   )rj   rû   r    ré   r   rÂ   rÃ   rÅ   rh   rÓ   r   r[   rç   r`   r   )r   rh   rj   ZtopSizerP   ru   rÈ   rè   r   r   r   ¢  s    

zTopDictIndex.__init__c                 C   s*   t | j||| j| j| jd�}| |¡ |S r  )r–   rc   rg   rj   rû   rk   )r   r3   r¾   rh   rÝ   Útopr   r   r   r  ¶  s    þ
zTopDictIndex.produceItemc                 C   sL   t t| ƒƒD ]:}|jd|d� | ¡  | |  |¡ | d¡ | ¡  qd S ©Nr«   r  ©rÿ   r4   rŽ   r�   r�   r�   ©r   r‘   r  r   r   r   r�   ½  s    
zTopDictIndex.toXML)NNr   N)
r   r   r   r½   rÄ   r
  r   r  r�   rë   r   r   rè   r   r`   ’  s     ÿr`   c                   @   s(   e Zd ZeZdd„ Zdd„ Zdd„ ZdS )r§   c                 C   sL   t t| ƒƒD ]:}|jd|d� | ¡  | |  |¡ | d¡ | ¡  qd S r  r  r  r   r   r   r�   Ê  s    
zFDArrayIndex.toXMLc                 C   s*   t | j||| j| j| jd�}| |¡ |S ©N)rP   r™   )r«   rc   rg   rû   r™   rk   )r   r3   r¾   rh   rÝ   rŸ   r   r   r   r  Ò  s    þ
zFDArrayIndex.produceItemc                 C   sN   |dkrd S t ƒ }|D ](}t|tƒr&q|\}}}| |||¡ q|  |¡ d S )Nr«   )r«   rq   rr   r—   r5   )r   ru   r›   rœ   rŸ   r�   r   r   r   r—   Ù  s    

zFDArrayIndex.fromXMLN)r   r   r   rì   r
  r�   r  r—   r   r   r   r   r§   Æ  s   r§   c                   @   sF   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dS )ÚVarStoreDataNc                 C   s   || _ d | _|| _tƒ | _d S r   )rh   r¾   Ú
otVarStorer   r“   )r   rh   r  r   r   r   r   ç  s    zVarStoreData.__init__c                 C   sh   | j rdG dd„ dtƒ}|di d�}t| j ƒ}| j  |¡| _i }t| j|ƒ}t ¡ | _| j 	|| j
¡ | S )Nc                   @   s   e Zd Zdd„ ZdS )z+VarStoreData.decompile.<locals>.GlobalStatec                 S   s   || _ || _d S r   ©Ú	tableTypeÚcachingStats)r   r!  r"  r   r   r   r   ð  s    z4VarStoreData.decompile.<locals>.GlobalState.__init__N)r   r   r   r   r   r   r   r   ÚGlobalStateï  s   r#  r”   r   )rh   Úobjectrý   rV   r¾   r   Úotr”   r  rk   r“   )r   r#  ZglobalStateÚlengthÚreaderr   r   r   rk   í  s    

zVarStoreData.decompilec                 C   s$   t ƒ }| j || j¡ | ¡ | _d S r   )r   r  r†   r“   Z
getAllDatar¾   )r   rƒ   r   r   r   r†   ý  s    zVarStoreData.compilec                 C   s   | j  || j¡ d S r   )r  r�   r“   )r   r‘   ru   r   r   r   ÚwriteXML  s    zVarStoreData.writeXMLc                 C   sB   t  ¡ | _|D ].}t|tƒr|\}}}| j |||| j¡ qqd S r   )r%  r”   r  rq   Útupler—   r“   )r   ru   r›   rœ   rÑ   r�   r   r   r   ÚxmlRead  s    


zVarStoreData.xmlReadc                 C   s
   t | jƒS r   ©r4   r¾   rl   r   r   r   rm     s    zVarStoreData.__len__c                 C   s   | j j| }|j}|S r   )r  ZVarDataZVarRegionCount)r   ZvsIndexZvarDataÚ
numRegionsr   r   r   ÚgetNumRegions  s    zVarStoreData.getNumRegions)NN)
r   r   r   r   rk   r†   r(  r*  rm   r-  r   r   r   r   r  å  s   

r  c                   @   s6   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚFDSelectNc                 C   sœ  |�rŒt |ƒ| _| jdkr@ddlm} |d| |¡ƒ ¡ | _�q˜| jdkrÖd g| }t|ƒ}d }d }t|ƒD ]8}	t|ƒ}
|d ur˜t||
ƒD ]}|||< qŠ|
}t |ƒ}ql|d urÎt|ƒ}
t||
ƒD ]}|||< qÀ|| _n´| jdk�rxd g| }t|ƒ}d }d }t|ƒD ]>}	t|ƒ}
|d u�r4t||
ƒD ]}|||< �q$|
}t|ƒ}�q|d u�rpt|ƒ}
t||
ƒD ]}|||< �q`|| _nd�s˜J d| ƒ‚n|| _g | _d S )Nr   )ÚarrayrH   rD   rx   Fzunsupported FDSelect format: %s)	rþ   Úformatr/  rV   ÚtolistÚgidArrayrý   rÿ   rü   )r   rh   Ú	numGlyphsr0  r/  r2  ÚnRangesrº   Úprevr  ÚfirstÚglyphIDr   r   r   r     sT    









zFDSelect.__init__c                 C   s
   t | jƒS r   )r4   r2  rl   r   r   r   rm   M  s    zFDSelect.__len__c                 C   s
   | j | S r   ©r2  rB   r   r   r   rv   P  s    zFDSelect.__getitem__c                 C   s   || j |< d S r   r8  )r   r3   ÚfdSelectValuer   r   r   r  S  s    zFDSelect.__setitem__c                 C   s   | j  |¡ d S r   )r2  r5   )r   r9  r   r   r   r5   V  s    zFDSelect.append)NNN)r   r   r   r   rm   rv   r  r5   r   r   r   r   r.    s
   
1r.  c                   @   sf   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZeZdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )r¨   añ  The ``CharStrings`` in the font represent the instructions for drawing 
	each glyph. This object presents a dictionary interface to the font's
	CharStrings, indexed by glyph name:

	.. code:: python
	
		tt["CFF "].cff[0].CharStrings["a"]
		# <T2CharString (bytecode) at 103451e90>

	See :class:`fontTools.misc.psCharStrings.T1CharString` and
	:class:`fontTools.misc.psCharStrings.T2CharString` for how to decompile,
	compile and interpret the glyph drawing instructions in the returned objects.

	Nc           
      C   s†   || _ |d urTt||||||d�| _i  | _}tt|ƒƒD ]}	|	|||	 < q:d| _n.i | _d| _|| _|d urt|| _|d ur‚|| _	d S )NrO   r   r   )
r   r  rª   r±   rÿ   r4   r©   r    r  rž   )
r   rh   ry   r   r    r  rž   rP   r±   r  r   r   r   r   j  s     ÿ
zCharStrings.__init__c                 C   s   t | j ¡ ƒS r   )r]   r±   rn   rl   r   r   r   rn   €  s    zCharStrings.keysc                 C   s   | j r| jS t| j ¡ ƒS d S r   )r©   rª   r]   r±   ro   rl   r   r   r   ro   ƒ  s    zCharStrings.valuesc                 C   s
   || j v S r   )r±   )r   ru   r   r   r   Úhas_key‰  s    zCharStrings.has_keyc                 C   s
   t | jƒS r   )r4   r±   rl   r   r   r   rm   Ž  s    zCharStrings.__len__c                 C   s   | j | }| jr| j| }|S r   )r±   r©   rª   )r   ru   r6   r   r   r   rv   ‘  s    

zCharStrings.__getitem__c                 C   s*   | j r| j| }|| j|< n
|| j|< d S r   )r©   r±   rª   )r   ru   r6   r3   r   r   r   r  —  s    
zCharStrings.__setitem__c                 C   sZ   | j r| j| }| j |¡S t| dƒrDt| dƒr>| j| j}qHd}nd }| j| |fS d S )Nrž   r  r   )r©   r±   rª   r´   r*   ÚfdSelectIndex)r   ru   r3   r  r   r   r   r´   ž  s    


zCharStrings.getItemAndSelectorc                 C   sœ   t |  ¡ ƒ}|D ]†}|  |¡\}}| ¡ r2dg}ng }|d u rV| dd|fg| ¡ n| dd|fd|fg| ¡ | ¡  | |¡ | d¡ | ¡  qd S )N)r  r   r  ru   r;  )Úsortedrn   r´   r  rŽ   r�   r�   r�   )r   r‘   Únamesru   ZcharStrr;  r  r   r   r   r�   ¬  s     þ

zCharStrings.toXMLc           
   	   C   s¸   |D ]®}t |tƒrq|\}}}|dkr(qd}t| dƒrlzt|d ƒ}W n ty\   d}Y n0 | j| j}n| j}|d }tj	}||| j
d�}	|	 |||¡ |dkrª||	_|	| |< qd S )Nr  r"   rž   r;  r   ru   r  )rq   rr   r*   r   rs   rž   r•   r    r   rš   r   r—   r;  )
r   ru   r›   rœ   r�   ZfdIDr    Ú	glyphNamer  r6   r   r   r   r—   ¿  s0    



þzCharStrings.fromXML)N)r   r   r   r½   r   rn   ro   r:  Ú__contains__rm   rv   r  r´   r�   r—   r   r   r   r   r¨   Z  s    ÿ
r¨   c                 C   s   t |  d¡ƒS r  )r   rV   )rh   r   r   r   rþ   Û  s    rþ   c                 C   s   t  d|  d¡¡\}|S )NrQ   r#   ©rY   rT   rV   ©rh   rˆ   r   r   r   rý   ß  s    rý   c                 C   s   t  d|  d¡¡\}|S )Nrù   rx   r@  rA  r   r   r   rü   ä  s    rü   c                 C   s   |   t|ƒ¡ d S r   )rÇ   r   rA  r   r   r   rÜ   é  s    rÜ   c                 C   s   |   t d|¡¡ d S ©NrQ   ©rÇ   rY   r~   rA  r   r   r   rÛ   í  s    rÛ   c                 C   s   |   t d|¡¡ d S ©Nrù   rC  rA  r   r   r   rÚ   ñ  s    rÚ   c                 C   s   t | ƒS r   )r   r‡   r   r   r   Ú	packCard8õ  s    rE  c                 C   s   t  d| ¡S rB  ©rY   r~   r‡   r   r   r   Ú
packCard16ù  s    rG  c                 C   s   t  d| ¡S rD  rF  r‡   r   r   r   Ú
packCard32ý  s    rH  c                 C   s(   i }| D ]\}}}}}||f||< q|S r   r   ©rÀ   ÚdÚopru   ÚargÚdefaultÚconvr   r   r   ÚbuildOperatorDict  s    rO  c                 C   sT   i }| D ]F\}}}}}t |tƒr:t|d ƒt|d ƒ }nt|ƒ}||f||< q|S ©Nr   r   )rq   r)  r   rI  r   r   r   ÚbuildOpcodeDict  s    
rQ  c                 C   s&   g }| D ]\}}}}}|  |¡ q|S r   )r5   )rÀ   ÚlrK  ru   rL  rM  rN  r   r   r   r¡     s    r¡   c                 C   s,   i }| D ]\}}}}}|d ur|||< q|S r   r   rI  r   r   r   ÚbuildDefaults  s
    
rS  c                 C   s$   i }| D ]\}}}}}|||< q|S r   r   rI  r   r   r   ÚbuildConverters"  s    
rT  c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚSimpleConverterc              	   C   sN   t |dƒs|  ||¡S |j}| ¡ }z|  ||¡W | |¡ S | |¡ 0 d S )Nrh   )r*   Ú_readrh   rÅ   r[   )r   rÑ   rˆ   rh   rÉ   r   r   r   rV   +  s    

þzSimpleConverter.readc                 C   s   |S r   r   ©r   rÑ   rˆ   r   r   r   rV  5  s    zSimpleConverter._readc                 C   s   |S r   r   rW  r   r   r   rÇ   8  s    zSimpleConverter.writec                 C   s   |j ||d� | ¡  d S )Nr‡   )rŒ   r�   ©r   r‘   ru   rˆ   r   r   r   ÚxmlWrite;  s    zSimpleConverter.xmlWritec                 C   s   |d S ©Nrˆ   r   ©r   ru   r›   rœ   rÑ   r   r   r   r*  ?  s    zSimpleConverter.xmlReadN)r   r   r   rV   rV  rÇ   rY  r*  r   r   r   r   rU  )  s
   
rU  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚASCIIConverterc                 C   s   t |dd�S ©NÚasciirØ   rI   rW  r   r   r   rV  E  s    zASCIIConverter._readc                 C   s   t |dd�S r]  ©r	   rW  r   r   r   rÇ   H  s    zASCIIConverter.writec                 C   s"   |j |t|dd�d� | ¡  d S )Nr^  rØ   r‡   ©rŒ   r
   r�   rX  r   r   r   rY  K  s    zASCIIConverter.xmlWritec                 C   s   t |d dd�S )Nrˆ   r^  rØ   r_  r[  r   r   r   r*  O  s    zASCIIConverter.xmlReadN©r   r   r   rV  rÇ   rY  r*  r   r   r   r   r\  C  s   r\  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚLatin1Converterc                 C   s   t |dd�S ©Nr×   rØ   rI   rW  r   r   r   rV  U  s    zLatin1Converter._readc                 C   s   t |dd�S rc  r_  rW  r   r   r   rÇ   X  s    zLatin1Converter.writec                 C   s<   t |dd�}|dv r"t dd|¡}|j||d� | ¡  d S )Nr×   rØ   )ÚNoticeÚ	Copyrightz	[\r\n]\s+ú r‡   )r
   ÚreÚsubrŒ   r�   rX  r   r   r   rY  [  s
    zLatin1Converter.xmlWritec                 C   s   t |d dd�S )Nrˆ   r×   rØ   r_  r[  r   r   r   r*  b  s    zLatin1Converter.xmlReadNra  r   r   r   r   rb  S  s   rb  c                 C   s&   zt | ƒ}W n   t| ƒ}Y n0 |S r   )r1   Úfloat)rL   rˆ   r   r   r   ÚparseNumf  s
    rj  c                 C   s`   g }| D ]>}t |tƒrq|\}}}|d  ¡ }dd„ |D ƒ}| |¡ qt|ƒdkr\|d }|S )Nrˆ   c                 S   s   g | ]}t |ƒ‘qS r   )Úeval©rK   Úvalr   r   r   Ú
<listcomp>u  rN   z"parseBlendList.<locals>.<listcomp>r   r   )rq   rr   Úsplitr5   r4   )rL   Ú	valueListr�   ru   r›   rœ   Ú	blendListr   r   r   ÚparseBlendListn  s    

rr  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚNumberConverterc                 C   s„   t |tƒrj| |¡ | ¡  | ¡  d dd„ |D ƒ¡}|jt|d� | ¡  | ¡  | 	|¡ | ¡  n|j||d� | ¡  d S )Nrf  c                 S   s   g | ]}t |ƒ‘qS r   ©rr   rl  r   r   r   rn  ‚  rN   z,NumberConverter.xmlWrite.<locals>.<listcomp>r‡   ©
rq   r]   rŽ   r�   ÚindentÚjoinrŒ   ÚkBlendDictOpNameÚdedentr�   )r   r‘   ru   rˆ   Ú
blendValuer   r   r   rY  }  s    



zNumberConverter.xmlWritec                 C   s.   |  dd ¡}|d u rt|ƒ}nt|d ƒ}|S rZ  )Úgetrr  rj  )r   ru   r›   rœ   rÑ   ÚvalueStringrˆ   r   r   r   r*  Œ  s
    
zNumberConverter.xmlReadN©r   r   r   rY  r*  r   r   r   r   rs  |  s   rs  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚArrayConverterc                 C   sª   |r|t |d tƒr|| |¡ | ¡  | ¡  |D ].}d dd„ |D ƒ¡}|jt|d� | ¡  q0| ¡  | 	|¡ | ¡  n*d dd„ |D ƒ¡}|j||d� | ¡  d S )Nr   rf  c                 S   s   g | ]}t |ƒ‘qS r   rt  rl  r   r   r   rn  œ  rN   z+ArrayConverter.xmlWrite.<locals>.<listcomp>r‡   c                 S   s   g | ]}t |ƒ‘qS r   rt  rl  r   r   r   rn  £  rN   ru  )r   r‘   ru   rˆ   rp  rz  r   r   r   rY  –  s    



zArrayConverter.xmlWritec                 C   s8   |  dd ¡}|d u rt|ƒ}n| ¡ }dd„ |D ƒ}|S )Nrˆ   c                 S   s   g | ]}t |ƒ‘qS r   )rj  )rK   rˆ   r   r   r   rn  ­  rN   z*ArrayConverter.xmlRead.<locals>.<listcomp>)r{  rr  ro  )r   ru   r›   rœ   rÑ   r|  rp  ro   r   r   r   r*  §  s    
zArrayConverter.xmlReadNr}  r   r   r   r   r~  •  s   r~  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚTableConverterc                 C   s2   |  |¡ | ¡  | |¡ | |¡ | ¡  d S r   )rŽ   r�   r�   r�   rX  r   r   r   rY  ³  s
    


zTableConverter.xmlWritec                 C   s<   |   ¡ ƒ }|D ](}t|tƒrq|\}}}| |||¡ q|S r   )ÚgetClassrq   rr   r—   )r   ru   r›   rœ   rÑ   Úobr�   r   r   r   r*  º  s    


zTableConverter.xmlReadNr}  r   r   r   r   r  ±  s   r  c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚPrivateDictConverterc                 C   s   t S r   )ÚPrivateDictrl   r   r   r   r€  Æ  s    zPrivateDictConverter.getClassc           
      C   s|   |\}}|j }|j}z
|j}W n ty4   d }Y n0 t|j||||d�}| |¡ | |¡}	t|	ƒ|ksnJ ‚| 	|	¡ |S r  )
rh   rû   r™   ÚAttributeErrorrƒ  rc   r[   rV   r4   rk   )
r   rÑ   rˆ   r  rÝ   rh   rP   r™   Zprivr¾   r   r   r   rV  É  s    

ÿ


zPrivateDictConverter._readc                 C   s   dS )N)r   r   r   rW  r   r   r   rÇ   Ù  s    zPrivateDictConverter.writeN©r   r   r   r€  rV  rÇ   r   r   r   r   r‚  Ä  s   r‚  c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚSubrsConverterc                 C   s   t S r   )r  rl   r   r   r   r€  ß  s    zSubrsConverter.getClassc                 C   s(   |j }|j}| |j| ¡ t||d�S r  )rh   rû   r[   rÝ   r  )r   rÑ   rˆ   rh   rP   r   r   r   rV  â  s    zSubrsConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ   è  s    zSubrsConverter.writeNr…  r   r   r   r   r†  Ý  s   r†  c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚCharStringsConverterc              	   C   sv   |j }|j}|j}|j}t|dƒrD|j}t|dƒr:|j}nd }d }	nd\}}|j}	| |¡ t	||||	|||d�}
|
S )Nr˜   r.  )NNrO   )
rh   rû   ry   rg   r*   r˜   r.  r•   r[   r¨   )r   rÑ   rˆ   rh   rP   ry   r   rž   r  r    r±   r   r   r   rV  î  s"    


ÿzCharStringsConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ     s    zCharStringsConverter.writec           	      C   sd   t |dƒr,|j}t |dƒr"|j}nd }d }n|jd d   }}}td d |j|||ƒ}| |||¡ |S )Nr˜   r.  )r*   r˜   r.  r•   r¨   rg   r—   )	r   ru   r›   rœ   rÑ   rž   r  r    r±   r   r   r   r*    s    

ÿzCharStringsConverter.xmlReadN©r   r   r   rV  rÇ   r*  r   r   r   r   r‡  ì  s   r‡  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚCharsetConverterc                 C   s”  t |dƒ}|dk�r|j}|j}| |¡ t td|¡ t|ƒ}|dkrZt|||j|ƒ}n(|dksj|dkr~t	|||j||ƒ}nt
‚t|ƒ|ks’J ‚t td| ¡ ¡ i }g }	|D ]`}
|
|v rþ||
 }|
d t|ƒ |v râ|d7 }qÄ|d ||
< |
d t|ƒ }
d||
< |	 |
¡ q°|	}nT|�s*d|jv�r>|dk�s8J ‚d }n.|dk�rNt}n|dk�r^t}n|dk�rlt}|�r�t|ƒ|jk�r�|d |j… }|S )	NÚROSr#   zloading charset at %sr   r   z    charset end at %sú#r¨   )r*   r3  rh   r[   rÂ   rÃ   rþ   ÚparseCharset0rc   ÚparseCharsetÚNotImplementedErrorr4   rÅ   rr   r5   r¥   ÚcffISOAdobeStringsÚcffIExpertStringsÚcffExpertSubsetStrings)r   rÑ   rˆ   ÚisCIDr3  rh   r0  ry   ZallNamesZ
newCharsetr>  Únr   r   r   rV    sL    






zCharsetConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ   I  s    zCharsetConverter.writec                 C   s   |  d¡ | ¡  d S )Nz8charset is dumped separately as the 'GlyphOrder' element)r  r�   rX  r   r   r   rY  L  s    
zCharsetConverter.xmlWritec                 C   s   d S r   r   r[  r   r   r   r*  S  s    zCharsetConverter.xmlReadNra  r   r   r   r   r‰    s   .r‰  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚCharsetCompilerc                 C   s\   |d dksJ ‚t |jdƒ}t|||ƒ}t|||ƒ}t|ƒt|ƒk rL|| _n|| _|| _d S )Nr   ú.notdefrŠ  )r*   ÚdictObjÚpackCharset0ÚpackCharsetr4   r¾   rÑ   )r   rc   ry   rÑ   r’  Údata0r¾   r   r   r   r   Y  s    zCharsetCompiler.__init__c                 C   s   || j jd< d S )Nry   rí   rî   r   r   r   rÁ   d  s    zCharsetCompiler.setPosc                 C   s
   t | jƒS r   r+  rl   r   r   r   r   g  s    zCharsetCompiler.getDataLengthc                 C   s   |  | j¡ d S r   ©rÇ   r¾   rê   r   r   r   r�   j  s    zCharsetCompiler.toFileN©r   r   r   r   rÁ   r   r�   r   r   r   r   r”  W  s   r”  c                 C   s|   d }t tdfttdfttdfg}t| ƒ}|D ]J\}}}|d urB qx||krLq,|}t|ƒD ]}| | || krXd } q,qXq,|S )Nr   r   r#   )ÚcffISOAdobeStringCountr�  ÚcffExpertStringCountr�  ÚcffExpertSubsetStringCountr‘  r4   rÿ   )ry   ZpredefinedCharSetValZpredefinedCharSetsZlcsZcntZpcsÚcsvr  r   r   r   ÚgetStdCharSetn  s"    ýr   c                 C   s   t | dd … ƒS )NrD   )r1   ©ru   rc   r   r   r   ÚgetCIDfromNameƒ  s    r¢  c                 C   s
   |  | ¡S r   )ÚgetSIDr¡  r   r   r   ÚgetSIDfromName‡  s    r¤  c                 C   sJ   d}t |ƒg}|rt}nt}| dd … D ]}| t|||ƒƒ¡ q(t|ƒS rP  )rE  r¢  r¤  r5   rG  r   )ry   r’  rc   Úfmtr¾   Ú	getNameIDru   r   r   r   r—  ‹  s    
r—  c                 C   sì   d}g }d }d}|rt }nt}| dd … D ]R}|||ƒ}	|d u rF|	}n2|d |	krx|| }
|
dkrfd}| ||
f¡ |	}|	}q*|r¤|| }
|
dkr–d}| ||
f¡ t|ƒg}|dkr¼t}nt}|D ]\}}
| t|ƒ||
ƒ ¡ qÄt|ƒS )Nr   r   éÿ   r#   )r¢  r¤  r5   rE  rG  r   )ry   r’  rc   r¥  Úrangesr6  Úendr¦  ru   ÚSIDÚnLeftr¾   Ú	nLeftFuncr   r   r   r˜  ˜  s<    

r˜  c                 C   sj   dg}|r>t | d ƒD ]$}t|ƒ}| dt|ƒ d¡ ¡ qn(t | d ƒD ]}t|ƒ}| || ¡ qJ|S ©Nr•  r   Zcidrw   )rÿ   rý   r5   rr   Úzfill)r3  rh   rc   r’  ry   r  ÚCIDrª  r   r   r   rŒ  ½  s    rŒ  c                 C   s¢   dg}d}|dkrt }nt}|| k ržt|ƒ}||ƒ}	|rjt|||	 d ƒD ]}
| dt|
ƒ d¡ ¡ qJn&t|||	 d ƒD ]}| || ¡ q|||	 d }q|S r­  )rþ   rý   rÿ   r5   rr   r®  )r3  rh   rc   r’  r¥  ry   rÈ   r¬  r6  r«  r¯  rª  r   r   r   r�  Ê  s    r�  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚEncodingCompilerc                 C   sZ   t |tƒrJ ‚t|jj||jƒ}t|jj||jƒ}t|ƒt|ƒk rJ|| _n|| _|| _	d S r   )
rq   rr   ÚpackEncoding0r–  ry   rc   ÚpackEncoding1r4   r¾   rÑ   )r   rc   rÙ   rÑ   r™  Zdata1r   r   r   r   à  s    zEncodingCompiler.__init__c                 C   s   || j jd< d S )NÚEncodingrí   rî   r   r   r   rÁ   ê  s    zEncodingCompiler.setPosc                 C   s
   t | jƒS r   r+  rl   r   r   r   r   í  s    zEncodingCompiler.getDataLengthc                 C   s   |  | j¡ d S r   rš  rê   r   r   r   r�   ð  s    zEncodingCompiler.toFileNr›  r   r   r   r   r°  Þ  s   
r°  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚEncodingConverterc                 C   s¤   |dkrdS |dkrdS |dks$J ‚|j }| |¡ t td|¡ t|ƒ}|d@ }|r^tdƒ‚|d@ }|dkr‚t|j|||jƒ}n|dkrœt	|j|||jƒ}|S d S )	Nr   ÚStandardEncodingr   ÚExpertEncodingzloading Encoding at %sé€   z*Encoding supplements are not yet supportedé   )
rh   r[   rÂ   rÃ   rþ   rŽ  ÚparseEncoding0ry   rc   ÚparseEncoding1)r   rÑ   rˆ   rh   r¥  ÚhaveSupplementrÙ   r   r   r   rV  ö  s,    

ÿ
ÿzEncodingConverter._readc                 C   s   |dkrdS |dkrdS dS )Nrµ  r   r¶  r   r   rW  r   r   r   rÇ     s
    zEncodingConverter.writec                 C   sˆ   |dv r"|j ||d� | ¡  d S | |¡ | ¡  tt|ƒƒD ]0}|| }|dkr@|j dt|ƒ|d� | ¡  q@| |¡ | ¡  d S )N)rµ  r¶  r‹   r•  Úmap)Úcoderu   )rŒ   r�   rŽ   rÿ   r4   Úhexr�   )r   r‘   ru   rˆ   r½  r>  r   r   r   rY    s    


zEncodingConverter.xmlWritec           	      C   sZ   d|v r|d S dgd }|D ]6}t |tƒr.q|\}}}t|d ƒ}|d }|||< q|S )Nru   r•  rÍ   r½  )rq   rr   r   )	r   ru   r›   rœ   rÑ   rÙ   r�   r½  r>  r   r   r   r*  #  s    



zEncodingConverter.xmlReadNra  r   r   r   r   r´  ô  s   r´  c                 C   sF   t |ƒ}dgd }td|d ƒD ] }t |ƒ}|dkr | | ||< q |S )Nr•  rÍ   r   r   ©rþ   rÿ   )ry   rh   r»  rc   ZnCodesrÙ   r7  r½  r   r   r   r¹  1  s    
r¹  c           
      C   sl   t |ƒ}dgd }d}t|ƒD ]H}t |ƒ}t |ƒ}	t|||	 d ƒD ]}| | ||< |d }qD|d }q|S )Nr•  rÍ   r   r¿  )
ry   rh   r»  rc   r4  rÙ   r7  r  r½  r«  r   r   r   rº  ;  s    


rº  c           	      C   s¶   d}i }t t|ƒƒD ]}|| }|dkr|||< qg }| dd … D ]}| |¡}| |¡ qB|rv|d d u rv| ¡  q\t|ƒtt|ƒƒg}|D ]}|d u ržd}| t|ƒ¡ qŽt|ƒS )Nr   r•  r   r"   ©rÿ   r4   r{  r5   ÚpoprE  r   )	ry   rÙ   rc   r¥  Úmr½  ru   Úcodesr¾   r   r   r   r±  I  s$    


r±  c                 C   s  d}i }t t|ƒƒD ]}|| }|dkr|||< qg }d }d}	| dd … D ]H}| |d¡}|d u rh|}n&|	d |krŽ|	| }
| ||
f¡ |}|}	qJ|	| }
| ||
f¡ |rÈ|d d dkrÈ| ¡  qªt|ƒtt|ƒƒg}|D ]*\}}
|dkrôd}| t|ƒt|
ƒ ¡ qàt|ƒS )Nr   r•  r   r"   rÀ  )ry   rÙ   rc   r¥  rÂ  r½  ru   r¨  r6  r©  r«  r¾   r   r   r   r²  `  s8    

r²  c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚFDArrayConverterc                 C   s^   z
|j }W n ty    d }Y n0 |j}|j}| |¡ t||d�}||_|j|_|j|_|S r  )	r”   r„  rh   rû   r[   r§   r™   rc   rg   )r   rÑ   rˆ   r™   rh   rP   rž   r   r   r   rV  „  s    


zFDArrayConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ   ’  s    zFDArrayConverter.writec                 C   s8   t ƒ }|D ](}t|tƒrq
|\}}}| |||¡ q
|S r   )r§   rq   rr   r—   )r   ru   r›   rœ   rÑ   rž   r�   r   r   r   r*  •  s    

zFDArrayConverter.xmlReadNrˆ  r   r   r   r   rÄ  ‚  s   rÄ  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚFDSelectConverterc                 C   s    |j }| |¡ t||jƒ}|S r   )rh   r[   r.  r3  )r   rÑ   rˆ   rh   r  r   r   r   rV  ¡  s    
zFDSelectConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ   §  s    zFDSelectConverter.writec                 C   s    |  |d|jfg¡ | ¡  d S ©Nr0  )rŒ   r0  r�   rX  r   r   r   rY  ¬  s    zFDSelectConverter.xmlWritec           	      C   s$   t |d ƒ}d }d }t|||ƒ}|S rÆ  )r   r.  )	r   ru   r›   rœ   rÑ   r¥  rh   r3  r  r   r   r   r*  °  s
    zFDSelectConverter.xmlReadNra  r   r   r   r   rÅ  Ÿ  s   rÅ  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚVarStoreConverterc                 C   s$   |j }| |¡ t|ƒ}| ¡  |S r   )rh   r[   r  rk   )r   rÑ   rˆ   rh   ÚvarStorer   r   r   rV  º  s
    
zVarStoreConverter._readc                 C   s   dS ræ   r   rW  r   r   r   rÇ   Á  s    zVarStoreConverter.writec                 C   s   |  ||¡ d S r   )r(  rX  r   r   r   rY  Ä  s    zVarStoreConverter.xmlWritec                 C   s   t ƒ }| ||||¡ |S r   )r  r*  )r   ru   r›   rœ   rÑ   rÈ  r   r   r   r*  Ç  s    zVarStoreConverter.xmlReadNra  r   r   r   r   rÇ  ¸  s   rÇ  c                 C   s.   d}t |ƒg}| D ]}| t |ƒ¡ qt|ƒS ræ   )rE  r5   r   )ÚfdSelectArrayr¥  r¾   r3   r   r   r   ÚpackFDSelect0Í  s
    
rÊ  c           
      C   s¬   d}g }t | ƒ}d}t|ƒD ]&}| | }||kr| ||g¡ |}q|d }t|ƒg}| tt |ƒƒ¡ |D ](}	| t|	d ƒ¡ | t|	d ƒ¡ ql| t|ƒ¡ t|ƒS )NrD   r"   r   r   )r4   rÿ   r5   rE  rG  r   ©
rÉ  r¥  ZfdRangesZlenArrayZlastFDIndexr  r  ZsentinelGIDr¾   ZfdRanger   r   r   ÚpackFDSelect3Õ  s"    
rÌ  c           
      C   s¬   d}g }t | ƒ}d}t|ƒD ]&}| | }||kr| ||g¡ |}q|d }t|ƒg}| tt |ƒƒ¡ |D ](}	| t|	d ƒ¡ | t|	d ƒ¡ ql| t|ƒ¡ t|ƒS )Nrx   r"   r   r   )r4   rÿ   r5   rE  rH  rG  r   rË  r   r   r   ÚpackFDSelect4ê  s"    
rÍ  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚFDSelectCompilerc                 C   sŒ   |j }|j}|dkr t|ƒ| _nb|dkr4t|ƒ| _nN|dkrHt|ƒ| _n:t|ƒ}t|ƒ}t|ƒt|ƒk rv|| _d|_ n|| _d|_ || _d S )Nr   rD   rx   )r0  r2  rÊ  r¾   rÌ  rÍ  r4   rÑ   )r   r  rÑ   r¥  rÉ  r™  Zdata3r   r   r   r     s     zFDSelectCompiler.__init__c                 C   s   || j jd< d S )Nr.  rí   rî   r   r   r   rÁ     s    zFDSelectCompiler.setPosc                 C   s
   t | jƒS r   r+  rl   r   r   r   r     s    zFDSelectCompiler.getDataLengthc                 C   s   |  | j¡ d S r   rš  rê   r   r   r   r�     s    zFDSelectCompiler.toFileNr›  r   r   r   r   rÎ  ÿ  s   rÎ  c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚVarStoreCompilerc                 C   s6   || _ |js| ¡  tt|jƒƒ|jg}t|ƒ| _d S r   )rÑ   r¾   r†   rG  r4   r   )r   ÚvarStoreDatarÑ   r¾   r   r   r   r   #  s    þzVarStoreCompiler.__init__c                 C   s   || j jd< d S )Nr”   rí   rî   r   r   r   rÁ   -  s    zVarStoreCompiler.setPosc                 C   s
   t | jƒS r   r+  rl   r   r   r   r   0  s    zVarStoreCompiler.getDataLengthc                 C   s   |  | j¡ d S r   rš  rê   r   r   r   r�   3  s    zVarStoreCompiler.toFileNr›  r   r   r   r   rÏ  !  s   
rÏ  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚROSConverterc                 C   s<   |\}}}|  |dt|ƒfdt|ƒfd|fg¡ | ¡  d S ©NZRegistryZOrderZ
Supplementr`  )r   r‘   ru   rˆ   Úregistryr£   Z
supplementr   r   r   rY  9  s    


ýþzROSConverter.xmlWritec                 C   s   |d |d t |d ƒfS rÒ  )r   r[  r   r   r   r*  D  s    zROSConverter.xmlReadNr}  r   r   r   r   rÑ  7  s   rÑ  )é   ZmaxstackÚnumberNN)é   é   rŠ  )rª  rª  rÕ  ))rÖ  é   ZSyntheticBaserÕ  NN)r   Úversionrª  NNrd  rª  )rÖ  r   re  )r#   ZFullNamerª  NN))rÖ  é&   ÚFontNamerª  NN)rD   Z
FamilyNamerª  NN)rx   ÚWeightrª  NN))rÖ  r   ZisFixedPitchrÕ  r   N))rÖ  r#   ZItalicAnglerÕ  r   N))rÖ  rD   ZUnderlinePositionrÕ  iœÿÿÿN))rÖ  rx   ZUnderlineThicknessrÕ  é2   N))rÖ  rw   Z	PaintTyperÕ  r   N))rÖ  é   ZCharstringTyperÕ  r#   N)rÖ  é   Ú
FontMatrixr/  )çü©ñÒMbP?r   r   rá  r   r   )é   ZUniqueIDrÕ  NNrw   ÚFontBBox)r   r   r   r   ))rÖ  é   ZStrokeWidthrÕ  r   N)é   ZXUIDr/  NN))rÖ  é   Ú
PostScriptrª  NN))rÖ  é   ZBaseFontNamerª  NN))rÖ  é   ZBaseFontBlendÚdeltaNN))rÖ  é   ÚCIDFontVersionrÕ  r   N))rÖ  é    ÚCIDFontRevisionrÕ  r   N))rÖ  é!   ÚCIDFontTyperÕ  r   N))rÖ  é"   ÚCIDCountrÕ  i"  Né   ry   rÕ  ))rÖ  é#   ZUIDBaserÕ  NNé   r³  é   r•   )rÕ  rÕ  )rÖ  é%   )rÖ  é$   r˜   é   é   r”   Úblendré  )rè  ÚvsindexrÕ  NNrq  )rÞ  Z
BlueValuesrê  NN)rß  Z
OtherBluesrê  NN)rä  ZFamilyBluesrê  NN)é	   ZFamilyOtherBluesrê  NN))rÖ  rý  Z	BlueScalerÕ  g}?5^ºI¤?N))rÖ  é
   Z	BlueShiftrÕ  rß  N))rÖ  é   ZBlueFuzzrÕ  r   N)rþ  ZStdHWrÕ  NN)rÿ  ZStdVWrÕ  NN))rÖ  rÖ  Z	StemSnapHrê  NN))rÖ  râ  Z	StemSnapVrê  NN))rÖ  rå  Z	ForceBoldrÕ  r   N))rÖ  ró  ZForceBoldThresholdrÕ  NN))rÖ  rõ  ZlenIVrÕ  NN))rÖ  rù  ZLanguageGrouprÕ  r   N))rÖ  rö  ZExpansionFactorrÕ  g¸…ëQ¸®?N))rÖ  é   ZinitialRandomSeedrÕ  r   N)rØ  ÚdefaultWidthXrÕ  r   N)ræ  ÚnominalWidthXrÕ  r   Nr   r³   c                 C   sŠ   t t| ƒƒD ]x}| | \}}}}}|d ur,q|dv r<tƒ }n6|dkrLtƒ }n&|dkr\tƒ }n|dkrjd }ndsrJ ‚|||||f| |< qd S )N)rê  r/  rÕ  rª  rq  F)rÿ   r4   r~  rs  r\  )rÀ   r  rK  ru   rL  rM  rN  r   r   r   ÚaddConverters®  s    r  c                   @   s   e Zd ZeeƒZdS )ÚTopDictDecompilerN)r   r   r   rO  r¤   Ú	operatorsr   r   r   r   r  Ä  s   r  c                   @   s   e Zd ZeeƒZdS )ÚPrivateDictDecompilerN)r   r   r   rO  r®   r  r   r   r   r   r  È  s   r  c                   @   sb   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ ZdS )ÚDictCompilerr   Nc           	      C   s®   |rt |tƒsJ ‚|d u r6t|dƒr6|j}|d us6J ‚|| _|| _|| _|| _i }|jD ]J}t||d ƒ}|d u rrqX|j	| }| 
||¡}||j |¡kršqX|||< qX|| _d S rÏ   )rq   rb   r*   rP   r–  rc   rÑ   r£   rµ   Ú
convertersrÇ   Údefaultsr{  r¥   )	r   r–  rc   rÑ   rP   r¥   ru   rˆ   rN  r   r   r   r   Ï  s(    


zDictCompiler.__init__c                 C   s   d S r   r   rî   r   r   r   rÁ   å  s    zDictCompiler.setPosc                 C   s   t |  d¡ƒS )Nr   )r4   r†   rl   r   r   r   r   è  s    zDictCompiler.getDataLengthc                 C   sâ   t   td| jj|¡ | j}g }| jjD ]®}| |¡}|d u r>q&| j| \}}t	|t
ƒr®t|ƒ}t|ƒ|ksrJ dƒ‚t|ƒD ]0}	||	 }
||	 }t| d|
 ƒ}| ||ƒ¡ qznt| d| ƒ}| ||ƒ¡ | |¡ q&t|ƒ}|S )Nz-- compiling %s for %szvalue doesn't match arg typeZarg_)rÂ   rÃ   ré   r   r¥   r–  r£   r{  Úopcodesrq   r)  r4   rÿ   rµ   r5   r   )r   Úreasonr¥   r¾   ru   rˆ   rK  ZargTyperR  r  rL  ÚvZ
arghandlerr   r   r   r†   ë  s*    

zDictCompiler.compilec                 C   s   |   d¡}| |¡ d S )Nr�   )r†   rÇ   )r   rh   r¾   r   r   r   r�   	  s    
zDictCompiler.toFilec                 C   sJ   t |tƒr>dd„ |D ƒ}| tdƒ¡ | ttƒ¡ t|ƒ}nt|ƒ}|S )Nc                 S   s   g | ]}t |ƒ‘qS r   ©ÚencodeNumberrl  r   r   r   rn  		  rN   z+DictCompiler.arg_number.<locals>.<listcomp>r   )rq   r]   r5   r  r   ÚblendOpr   )r   Únumr¾   Zdatumr   r   r   Ú
arg_number	  s    

zDictCompiler.arg_numberc                 C   s   t  | j |¡¡S r   )r   ÚencodeIntCFFrc   r£  )r   rL   r   r   r   Úarg_SID	  s    zDictCompiler.arg_SIDc                 C   s&   g }|D ]}|  |  |¡¡ qt|ƒS r   )r5   r  r   )r   rˆ   r¾   r  r   r   r   Ú	arg_array	  s    zDictCompiler.arg_arrayc                 C   sn   |sdS |d }t |tƒr&|  |¡}n@g }d}|D ]}| || ¡ |}q2g }|D ]}| t|ƒ¡ qRt|ƒS )NrN   r   )rq   r]   Úarg_delta_blendr5   r  r   )r   rˆ   Zval0r¾   rã   Úlastr  r  r   r   r   Ú	arg_delta	  s    
zDictCompiler.arg_deltac                 C   s,  t |d ƒ}t |ƒ}|| d }|| jkrˆt| jd | ƒ}g }tt |ƒ|ƒ}|dkrXq†|d|… }|  |¡}	| |	¡ ||d… }q@n dg| }
dg| }d}d}||k ræ|| d }|| |
|< |}|| dd… ||< |d7 }q¤|
}|D ]}| |¡ qîdd„ |D ƒ}| t|ƒ¡ | tt	ƒ¡ |S )a'  A delta list with blend lists has to be *all* blend lists.

		The value is a list is arranged as follows::

			[
				[V0, d0..dn]
				[V1, d0..dn]
				...
				[Vm, d0..dn]
			]

		``V`` is the absolute coordinate value from the default font, and ``d0-dn``
		are the delta values from the *n* regions. Each ``V`` is an absolute
		coordinate from the default font.

		We want to return a list::

			[
				[v0, v1..vm]
				[d0..dn]
				...
				[d0..dn]
				numBlends
				blendOp
			]

		where each ``v`` is relative to the previous default font value.
		r   r   Nc                 S   s   g | ]}t |ƒ‘qS r   r  rl  r   r   r   rn  m	  rN   z0DictCompiler.arg_delta_blend.<locals>.<listcomp>)
r4   ÚmaxBlendStackr1   Úminr  rå   r5   r  r   r  )r   rˆ   Z
numMastersZ	numBlendsZnumStackZnumBlendValuesrã   ZnumValZvalListZout1Z	firstListZ	deltaListr  ZprevValÚdefaultValueZrelValueListrq  r   r   r   r  ,	  s<    





zDictCompiler.arg_delta_blend)N)r   r   r   r  r   rÁ   r   r†   r�   r  r  r  r  r  r   r   r   r   r  Ì  s   

r  c                 C   s"   t | tƒrt | ¡S t | ¡S d S r   )rq   ri  r   ZencodeFloatr  )r  r   r   r   r  s	  s    

r  c                   @   s   e Zd ZeeƒZdd„ ZdS )ÚTopDictCompilerc                 C   sú  | j }g }| jjd u r¬t| jdƒrr| jjrrt| jdƒr<d }nt| jjƒ}|d u rh| t|| jj| ƒ¡ n
|| jd< t| jdƒrÔ| jj	rÔ| jj	}t
|tƒsÔ| t||| ƒ¡ n(t| jdƒrÔ| jj}t|| ƒ}| |¡ t| jdƒ�r4| jj}t|ƒdk�r | jj}	| jjD ]}
| |	|
 j¡ �qt|| ƒ}| |¡ t| jdƒ�r†g }| jj}	| jjD ]}
| |	|
 ¡ �qVt||| |d�}| |¡ t| jd	ƒ�r¾| jj || ¡}| |¡ | | |¡¡ t| jd
ƒ�rö| jj || ¡}| |¡ | | |¡¡ |S )Nry   rŠ  r³  r”   r.  r   r¨   rO   r˜   r•   )rP   r–  rj   r*   ry   r   r5   r”  r¥   r³  rq   rr   r°  r”   rÏ  r.  r4   r¨   r;  rÎ  rõ   r˜   r|   rå   r€   r•   )r   rc   rP   r„   ZcharsetCoderÙ   rÐ  ZvarStoreCompr  r±   ru   ZfdSelectCompr    ZcharStringsCompZfdArrayIndexCompÚprivCompr   r   r   r€   ~	  sX    





ÿ


zTopDictCompiler.getChildrenN)r   r   r   rQ  r¤   r
  r€   r   r   r   r   r  z	  s   r  c                       s.   e Zd ZeeƒZd‡ fdd„	Zdd„ Z‡  ZS )ÚFontDictCompilerNc           	         sº   t t| ƒj||||d� g }| j}tt|jƒt|jƒ ƒD ]^}||jv rT| 	|¡ q:|j
 |¡}|d ur~|j| }| ||¡}t||d ƒ|kr:| 	|¡ q:|r¶t dd t|ƒ¡ ¡ d S )NrO   z:Some CFF FDArray/FontDict keys were ignored upon compile: rf  )rç   r  r   r–  r<  Úsetr  r£   r¥   r5   r	  r{  rV   rµ   rÂ   Úwarningrw  )	r   r–  rc   rÑ   rP   ÚignoredNamesru   rM  rN  rè   r   r   r   º	  s$    

ÿÿzFontDictCompiler.__init__c                 C   s>   g }t | jdƒr:| jj || ¡}| |¡ | | |¡¡ |S ©Nr•   )r*   r–  r•   r|   r5   rå   r€   )r   rc   r„   r  r   r   r   r€   Ú	  s    
zFontDictCompiler.getChildren)N)	r   r   r   rQ  r¤   r
  r   r€   rë   r   r   rè   r   r  ·	  s    r  c                   @   s(   e Zd ZeZeeƒZdd„ Zdd„ Z	dS )ÚPrivateDictCompilerc                 C   s"   || }||f| j jd< || _d S r!  )rÑ   r¥   rÉ   )r   rÉ   rË   r  r   r   r   rÁ   è	  s    zPrivateDictCompiler.setPosc                 C   s*   g }t | jdƒr&| | jj || ¡¡ |S rô   )r*   r–  r5   r³   r|   )r   rc   r„   r   r   r   r€   í	  s    zPrivateDictCompiler.getChildrenN)
r   r   r   ÚmaxStackLimitr  rQ  r®   r
  rÁ   r€   r   r   r   r   r"  ã	  s   r"  c                   @   sH   e Zd Zddd„Zdd„ Zdd„ Zddd	„Zd
d„ Zdd„ Zdd„ Z	dS )ÚBaseDictNc                 C   sd   |d u |d u ksJ ‚i | _ g | _|| _|d u r2d S || _|| _|d ur`t td| jj|¡ || _	d S )Nr÷   )
r¥   Ú	skipNamesrc   rû   rh   rÂ   rÃ   ré   r   rÝ   )r   rc   rh   rÝ   rP   r   r   r   r   ö	  s    zBaseDict.__init__c                 C   sF   t   td| jjt|ƒ¡ |  | j| ¡}| |¡ | ¡ | _	|  
¡  d S )Nz    length %s is %d)rÂ   rÃ   ré   r   r4   ÚdecompilerClassrc   rk   ZgetDictr¥   ÚpostDecompile)r   r¾   Údecr   r   r   rk   
  s
    

zBaseDict.decompilec                 C   s   d S r   r   rl   r   r   r   r'  

  s    zBaseDict.postDecompilec                 C   s   | j | |||d�S r  r	  r  r   r   r   r|   
  s    zBaseDict.getCompilerc                 C   sˆ   |d d… |dd …   kr$dkr0n nt |ƒ‚| j |d ¡}|d u rR| j |¡}|d u rbt |ƒ‚| j| }| | |¡}t| ||ƒ |S )Nr#   éþÿÿÿÚ__)r„  r¥   r{  r	  r  rV   r(   )r   ru   rˆ   rN  r   r   r   Ú__getattr__
  s    (
zBaseDict.__getattr__c                 C   sŠ   | j D ]F}|| jv rqt| |d ƒ}|d u r4|dkr4q| j| }| |||¡ qt| jƒt| j ƒ }|r†| dd t	|ƒ¡ ¡ | 
¡  d S )Nry   zsome keys were ignored: %srf  )r£   r%  rµ   r  rY  r  r¥   r  rw  r<  r�   )r   r‘   ru   rˆ   rN  r   r   r   r   r�   !
  s    



ÿzBaseDict.toXMLc                 C   s*   | j | }| |||| ¡}t| ||ƒ d S r   )r  r*  r(   )r   ru   r›   rœ   rN  rˆ   r   r   r   r—   9
  s    
zBaseDict.fromXML)NNNN)N)
r   r   r   r   rk   r'  r|   r+  r�   r—   r   r   r   r   r$  ô	  s   

r$  c                       sj   e Zd ZdZeeƒZeeƒZe	Z
eeƒZeZd‡ fdd„	Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z‡  ZS )r–   a  The ``TopDict`` represents the top-level dictionary holding font
	information. CFF2 tables contain a restricted set of top-level entries
	as described `here <https://docs.microsoft.com/en-us/typography/opentype/spec/cff2#7-top-dict-data>`_,
	but CFF tables may contain a wider range of information. This information
	can be accessed through attributes or through the dictionary returned
	through the ``rawDict`` property:

	.. code:: python

		font = tt["CFF "].cff[0]
		font.FamilyName
		# 'Linux Libertine O'
		font.rawDict["FamilyName"]
		# 'Linux Libertine O'

	More information is available in the CFF file's private dictionary, accessed
	via the ``Private`` property:

	.. code:: python

		tt["CFF "].cff[0].Private.BlueValues
		# [-15, 0, 515, 515, 666, 666]
	
	Nc                    s^   t t| ƒj||||d� || _|| _|rFttƒ| _|ƒ | _t	tƒ| _
nttƒ| _t	tƒ| _
d S r  )rç   r–   r   rj   rg   rS  r¢   r	  ry   r¡   r£   r¤   )r   rc   rh   rÝ   rg   rj   rP   rè   r   r   r   _
  s    

zTopDict.__init__c                 C   s   | j S )z.Returns a list of glyph names in the CFF font.)ry   rl   r   r   r   re   l
  s    zTopDict.getGlyphOrderc                 C   sH   | j  d¡}|d u rd S | j |¡ | jr8t| jƒ| _nt| jƒ| _d S rö   )r¥   r{  rh   r[   rû   rü   r3  rý   )r   rÝ   r   r   r   r'  p
  s    zTopDict.postDecompilec                 C   sR   t | dƒr|  ¡  t | dƒr$dg| _t | dƒr8t | dƒsBg d¢| _t | |¡ d S )Nr¨   rŠ  r³  )rì  rî  rð  rò  )r*   ÚdecompileAllCharStringsr%  r$  r�   )r   r‘   r   r   r   r�   {
  s    


zTopDict.toXMLc                 C   sD   t | j ¡ ƒD ]0\}}z| ¡  W q   t d|¡ ‚ Y q0 qd S )NzError in charstring %s)Ú	enumerater¨   ro   rk   rÂ   Úerror)r   r  r6   r   r   r   r,  ‡
  s    zTopDict.decompileAllCharStringsc                 C   sp   d }| j  ¡ D ]0}| | j ¡}|d ur|d ur:t||ƒ}q|}q|d u r^| jd d d … | _ntt|ƒƒ| _d S )Nrã  )r¨   ro   Z
calcBoundsr   r	  rã  r]   r   )r   ZfontBBoxr6   Zboundsr   r   r   rz   �
  s    zTopDict.recalcFontBBox)NNNNNN)r   r   r   r½   rS  r¤   r	  rT  r  r  r
  r¡   r£   r  r&  r   re   r'  r�   r,  rz   rë   r   r   rè   r   r–   ?
  s     ÿ	r–   c                       sH   e Zd Zi ZeeƒZeZg d¢Z	dgZ
eZd‡ fdd„	Zdd„ Z‡  ZS )	r«   )rÛ  rà  rÜ  r•   r•   Nc                    s,   t t| ƒj||||d� || _|  |¡ d S r  )rç   r«   r   r™   r¬   )r   rc   rh   rÝ   rg   rP   r™   rè   r   r   r   Ã
  s    zFontDict.__init__c                 C   s&   |r| j | _d| _n| j| _d| _d S )NTF)Ú	orderCFF2r£   rû   ÚorderCFFr¿   r   r   r   r¬   É
  s
    zFontDict.setCFF2)NNNNNN)r   r   r   r	  rT  r¤   r  r  r
  r0  r/  r  r&  r   r¬   rë   r   r   rè   r   r«    
  s     ÿr«   c                       sT   e Zd ZeeƒZeeƒZeeƒZ	e
ZeZd‡ fdd„	Zedd„ ƒZd	dd„Z‡  ZS )
rƒ  Nc                    s\   t t| ƒj||||d� || _|rDttƒ| _ttƒ| _d  | _	| _
nttƒ| _ttƒ| _d S r  )rç   rƒ  r   r™   rS  r­   r	  r¡   r£   r  r  r®   )r   rc   rh   rÝ   rP   r™   rè   r   r   r   Ú
  s    


zPrivateDict.__init__c                 C   s   | j S r   )rû   rl   r   r   r   r2   è
  s    zPrivateDict.in_cff2c                 C   s.   |d u rt | dƒr| j}nd}| j |¡}|S )Nrü  r   )r*   rü  r™   r-  )r   Úvir,  r   r   r   r-  ì
  s    
zPrivateDict.getNumRegions)NNNNN)N)r   r   r   rS  r®   r	  rT  r  r¡   r£   r  r&  r"  r
  r   Úpropertyr2   r-  rë   r   r   rè   r   rƒ  Ó
  s     ÿ
rƒ  c                   @   sJ   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dS )rb   zSID -> string mapping.Nc                 C   s.   |d u rg }ndd„ t |dd�D ƒ}|| _d S )Nc                 S   s   g | ]}t |d d�‘qS )r×   rØ   rI   rJ   r   r   r   rn  ÿ
  s   ÿz+IndexedStrings.__init__.<locals>.<listcomp>FrO   )r^   rc   )r   rh   rc   r   r   r   r   û
  s    
þzIndexedStrings.__init__c                 C   s   t | d | dd�S )NFrO   )rß   rl   r   r   r   r|     s    zIndexedStrings.getCompilerc                 C   s
   t | jƒS r   )r4   rc   rl   r   r   r   rm     s    zIndexedStrings.__len__c                 C   s"   |t k rt| S | j|t   S d S r   )ÚcffStandardStringCountÚcffStandardStringsrc   )r   rª  r   r   r   rv     s    zIndexedStrings.__getitem__c                 C   sn   t | dƒs|  ¡  t|dd�}|tv r0t| }n:|| jv rF| j| }n$t| jƒt }| j |¡ || j|< |S )NÚstringMappingr×   rØ   )	r*   ÚbuildStringMappingr
   ÚcffStandardStringMappingr5  r4   rc   r3  r5   )r   rL   rª  r   r   r   r£    s    



zIndexedStrings.getSIDc                 C   s   | j S r   rà   rl   r   r   r   Ú
getStrings  s    zIndexedStrings.getStringsc                 C   s2   i | _ tt| jƒƒD ]}|t | j | j| < qd S r   )r5  rÿ   r4   rc   r3  rB   r   r   r   r6  "  s    z!IndexedStrings.buildStringMapping)N)r   r   r   r½   r   r|   rm   rv   r£  r8  r6  r   r   r   r   rb   ÷
  s   

rb   (‡  r•  ÚspaceÚexclamÚquotedblÚ
numbersignÚdollarÚpercentÚ	ampersandÚ
quoterightÚ	parenleftÚ
parenrightÚasteriskÚplusÚcommaÚhyphenÚperiodÚslashÚzeroÚoneÚtwoÚthreeÚfourÚfiveÚsixÚsevenÚeightÚnineÚcolonÚ	semicolonÚlessÚequalÚgreaterÚquestionÚatÚArH   ÚCÚDÚEÚFÚGÚHÚIÚJÚKÚLÚMÚNÚOÚPÚQÚRÚSÚTÚUÚVÚWÚXÚYÚZÚbracketleftÚ	backslashÚbracketrightÚasciicircumÚ
underscoreÚ	quoteleftÚaÚbr¸   rJ  ÚeÚfr·   Úhr  ÚjÚkrR  rÂ  r“  ÚoÚpÚqÚrrL   ÚtÚur  ÚwÚxÚyÚzÚ	braceleftÚbarÚ
bracerightÚ
asciitildeÚ
exclamdownÚcentÚsterlingÚfractionÚyenÚflorinÚsectionÚcurrencyÚquotesingleÚquotedblleftÚguillemotleftÚguilsinglleftÚguilsinglrightÚfiÚflÚendashÚdaggerÚ	daggerdblÚperiodcenteredÚ	paragraphÚbulletÚquotesinglbaseÚquotedblbaseÚquotedblrightÚguillemotrightÚellipsisÚperthousandÚquestiondownÚgraveÚacuteÚ
circumflexÚtildeÚmacronÚbreveÚ	dotaccentÚdieresisÚringÚcedillaÚhungarumlautÚogonekÚcaronÚemdashÚAEÚordfeminineÚLslashÚOslashÚOEÚordmasculineÚaeÚdotlessiÚlslashÚoslashÚoeÚ
germandblsÚonesuperiorÚ
logicalnotÚmuÚ	trademarkÚEthÚonehalfÚ	plusminusÚThornÚ
onequarterÚdivideÚ	brokenbarÚdegreeÚthornÚthreequartersÚtwosuperiorÚ
registeredÚminusÚethÚmultiplyÚthreesuperiorÚ	copyrightÚAacuteÚAcircumflexÚ	AdieresisÚAgraveÚAringÚAtildeÚCcedillaÚEacuteÚEcircumflexÚ	EdieresisÚEgraveÚIacuteÚIcircumflexÚ	IdieresisÚIgraveÚNtildeÚOacuteÚOcircumflexÚ	OdieresisÚOgraveÚOtildeÚScaronÚUacuteÚUcircumflexÚ	UdieresisÚUgraveÚYacuteÚ	YdieresisÚZcaronÚaacuteÚacircumflexÚ	adieresisÚagraveÚaringÚatildeÚccedillaÚeacuteÚecircumflexÚ	edieresisÚegraveÚiacuteÚicircumflexÚ	idieresisÚigraveÚntildeÚoacuteÚocircumflexÚ	odieresisÚograveÚotildeÚscaronÚuacuteÚucircumflexÚ	udieresisÚugraveÚyacuteÚ	ydieresisÚzcaronÚexclamsmallÚHungarumlautsmallÚdollaroldstyleÚdollarsuperiorÚampersandsmallÚ
AcutesmallÚparenleftsuperiorÚparenrightsuperiorÚtwodotenleaderÚonedotenleaderÚzerooldstyleÚoneoldstyleÚtwooldstyleÚthreeoldstyleÚfouroldstyleÚfiveoldstyleÚsixoldstyleÚsevenoldstyleÚeightoldstyleÚnineoldstyleÚcommasuperiorÚthreequartersemdashÚperiodsuperiorÚquestionsmallÚ	asuperiorÚ	bsuperiorÚcentsuperiorÚ	dsuperiorÚ	esuperiorÚ	isuperiorÚ	lsuperiorÚ	msuperiorÚ	nsuperiorÚ	osuperiorÚ	rsuperiorÚ	ssuperiorÚ	tsuperiorÚffÚffiÚfflÚparenleftinferiorÚparenrightinferiorÚCircumflexsmallÚhyphensuperiorÚ
GravesmallÚAsmallÚBsmallÚCsmallÚDsmallÚEsmallÚFsmallÚGsmallÚHsmallÚIsmallÚJsmallÚKsmallÚLsmallÚMsmallÚNsmallÚOsmallÚPsmallÚQsmallÚRsmallÚSsmallÚTsmallÚUsmallÚVsmallÚWsmallÚXsmallÚYsmallÚZsmallÚcolonmonetaryÚ	onefittedÚrupiahÚ
TildesmallÚexclamdownsmallÚcentoldstyleÚLslashsmallÚScaronsmallÚZcaronsmallÚDieresissmallÚ
BrevesmallÚ
CaronsmallÚDotaccentsmallÚMacronsmallÚ
figuredashÚhypheninferiorÚOgoneksmallÚ	RingsmallÚCedillasmallÚquestiondownsmallÚ	oneeighthÚthreeeighthsÚfiveeighthsÚseveneighthsÚonethirdÚ	twothirdsÚzerosuperiorÚfoursuperiorÚfivesuperiorÚsixsuperiorÚsevensuperiorÚeightsuperiorÚninesuperiorÚzeroinferiorÚoneinferiorÚtwoinferiorÚthreeinferiorÚfourinferiorÚfiveinferiorÚsixinferiorÚseveninferiorÚeightinferiorÚnineinferiorÚcentinferiorÚdollarinferiorÚperiodinferiorÚcommainferiorÚAgravesmallÚAacutesmallÚAcircumflexsmallÚAtildesmallÚAdieresissmallÚ
AringsmallÚAEsmallÚCcedillasmallÚEgravesmallÚEacutesmallÚEcircumflexsmallÚEdieresissmallÚIgravesmallÚIacutesmallÚIcircumflexsmallÚIdieresissmallÚEthsmallÚNtildesmallÚOgravesmallÚOacutesmallÚOcircumflexsmallÚOtildesmallÚOdieresissmallÚOEsmallÚOslashsmallÚUgravesmallÚUacutesmallÚUcircumflexsmallÚUdieresissmallÚYacutesmallÚ
ThornsmallÚYdieresissmallz001.000z001.001z001.002z001.003ZBlackZBoldZBookZLightZMediumZRegularZRomanZSemiboldi‡  )år•  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  rH   r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r¸   rJ  r{  r|  r·   r}  r  r~  r  rR  rÂ  r“  r€  r�  r‚  rƒ  rL   r„  r…  r  r†  r‡  rˆ  r‰  rŠ  r‹  rŒ  r�  rŽ  r�  r�  r‘  r’  r“  r”  r•  r–  r—  r˜  r™  rš  r›  rœ  r�  rž  rŸ  r   r¡  r¢  r£  r¤  r¥  r¦  r§  r¨  r©  rª  r«  r¬  r­  r®  r¯  r°  r±  r²  r³  r´  rµ  r¶  r·  r¸  r¹  rº  r»  r¼  r½  r¾  r¿  rÀ  rÁ  rÂ  rÃ  rÄ  rÅ  rÆ  rÇ  rÈ  rÉ  rÊ  rË  rÌ  rÍ  rÎ  rÏ  rÐ  rÑ  rÒ  rÓ  rÔ  rÕ  rÖ  r×  rØ  rÙ  rÚ  rÛ  rÜ  rÝ  rÞ  rß  rà  rá  râ  rã  rä  rå  ræ  rç  rè  ré  rê  rë  rì  rí  rî  rï  rð  rñ  rò  ró  rô  rõ  rö  r÷  rø  rù  rú  rû  rü  rý  rþ  rÿ  r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  éå   )¦r•  r9  r  r  r  r  r  r  r  r  r  r  rE  rF  rG  r‘  r  r  r  r   r!  r"  r#  r$  r%  r&  rS  rT  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r›  rœ  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rÌ  rÉ  rÑ  rm  rn  ro  rp  rq  rr  rs  rt  rÄ  rÒ  r×  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r€  r�  r‚  rƒ  r„  r…  r†  r‡  rˆ  r‰  rŠ  r‹  rŒ  r�  rŽ  r�  r�  r‘  r’  r“  r”  r•  r–  r—  r˜  r™  rš  r›  rœ  r�  rž  rŸ  r   r¡  r¢  r£  r¤  r¥  r¦  r§  r¨  é¦   )Wr•  r9  r  r  r  r  r  r  rE  rF  rG  r‘  r  r  r  r   r!  r"  r#  r$  r%  r&  rS  rT  r'  r(  r)  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r›  rœ  r9  r:  r;  r<  r>  rZ  r[  r\  r_  rh  ri  rÌ  rÉ  rÑ  rn  ro  rp  rq  rr  rs  rt  rÄ  rÒ  r×  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r€  r�  r‚  rƒ  r„  r…  r†  r‡  rˆ  éW   )‰r½   ZfontTools.miscr   r   ZfontTools.misc.arrayToolsr   r   ZfontTools.misc.textToolsr   r   r   r	   r
   r   ZfontTools.ttLibr   ZfontTools.ttLib.tables.otBaser   r   ZfontTools.ttLib.tablesr   r%  Úior   rY   Úloggingrg  rÃ   Ú	getLoggerr   rÂ   rU   r#  Ú	Exceptionr   r   r   r$  rC   r{   rÆ   rÎ   rß   rÄ   rì   rï   ró   rõ   r^   rf   r  r`   r§   r  r.  r¨   rþ   rý   rü   rÜ   rÛ   rÚ   rE  rG  rH  rO  rQ  r¡   rS  rT  rU  r\  rb  rj  rr  rs  r~  r  r‚  r†  r‡  r‰  r”  r   r¢  r¤  r—  r˜  rŒ  r�  r°  r´  r¹  rº  r±  r²  rÄ  rÅ  rÇ  rÊ  rÌ  rÍ  rÎ  rÏ  rÑ  r¤   r¢   rx  r  r®   r­   r  ZDictDecompilerr  r  r  r  r  r  r"  r$  r–   r«   rƒ  rb   r4  r3  r4   r7  rÿ   Z_ir�  rœ  r�  r�  r‘  rž  r   r   r   r   Ú<module>   sš   

K  j1K$)	Hd45@ .=%=
""Û*ùéï (=,Ka3$4
A
 
"
