
    <`                        d dl mZmZ d dlmZ d dlZd dlmZmZ d dl	Z	d dl
Z
d dlmZ d dlmZ 	 g dZdZed	z   Zd
 Zd Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Zd Zd Zd Z G d de          Zd Z G d de          Z  G d de          Z! G d  d!e          Z" G d" d#ee          Z#dS )$    )tobytestostr)LogMixinN)BytesIOStringIO)etree)plistlib)DesignSpaceDocumentErrorDesignSpaceDocumentSourceDescriptorInstanceDescriptorAxisDescriptorRuleDescriptorBaseDocReaderBaseDocWriterz&{http://www.w3.org/XML/1998/namespace}langc                     t          j        |                     t          j        j                   }|                     d          rd|z   }n|                     d          rd|z   }|S )z<Normalize paths using forward slash to work also on Windows./z\\z//)	posixpathjoinsplitospathsep
startswith)r   new_paths     Alib/python3.11/site-packages/fontTools/designspaceLib/__init__.pyposixr      s_    ~tzz"'+667Hs #>			 #(?O    c                 8      fd} fd}t          ||          S )Nc                 $    t          |           S N)getattr)selfprivate_names    r   getterz"posixpath_property.<locals>.getter+   s    t\***r   c                 L    |t          |          }t          | |           d S r"   )r   setattr)r$   valuer%   s     r   setterz"posixpath_property.<locals>.setter/   s,    %LLElE*****r   )property)r%   r&   r*   s   `  r   posixpath_propertyr,   *   sG    + + + + ++ + + + + FF###r   c                       e Zd ZddZd ZdS )r
   Nc                 "    || _         || _        d S r"   )msgobj)r$   r/   r0   s      r   __init__z!DesignSpaceDocumentError.__init__9   s    r   c                 R    t          | j                  | j        
d| j        z  ndz   S )Nz: %r )strr/   r0   r$   s    r   __str__z DesignSpaceDocumentError.__str__=   s-    48}}!%!5FTX2? 	?r   r"   )__name__
__module____qualname__r1   r6    r   r   r
   r
   8   s7           ? ? ? ? ?r   r
   c                       e Zd Zd ZdS )AsDictMixinc                 
   i }| j                                         D ]f\  }}|                    d          rt          |d          r|                                }n!t          |t                    rd |D             }|||<   g|S )N_asdictc                 Z    g | ](}t          |d           r|                                n|)S )r?   )hasattrr?   ).0vs     r   
<listcomp>z&AsDictMixin.asdict.<locals>.<listcomp>L   s@       BC'!X"6"6=AHHJJJA  r   )__dict__itemsr   rA   r?   
isinstancelist)r$   dattrr)   s       r   r?   zAsDictMixin.asdictD   s    =..00 		 		KD%s## uh'' E4((  GL   AdGGr   N)r7   r8   r9   r?   r:   r   r   r<   r<   B   s#            r   r<   c                       e Zd ZdZd ZdS )SimpleDescriptorz% Containers for a bunch of attributesc                     | j         D ]f}	 t          | |          t          ||          k    sJ (# t          $ r2 t          d|t          | |          dt          ||                     Y cw xY wd S )Nzfailed attributez!=)_attrsr#   AssertionErrorprint)r$   otherrJ   s      r   comparezSimpleDescriptor.compareX   s    K 	a 	aDatT**geT.B.BBBBBB! a a a($d0C0CT7SXZ^K_K_`````a	a 	as   $09A,+A,N)r7   r8   r9   __doc__rR   r:   r   r   rL   rL   S   s.        //a a a a ar   rL   c                   r    e Zd ZdZdZg dZdddddddddddddddddZ ed          Z ed	          Z	dS )
r   z/Simple container for data related to the sourcesource)filenamer   name	layerNamelocationcopyLib
copyGroupscopyFeaturesmuteKerningmuteInfomutedGlyphNames
familyName	styleNameNFrV   r   fontrW   rY   rX   r`   ra   rZ   copyInfor[   r\   r]   r^   r_   c                    || _         	 || _        	 || _        	 || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        || _        || _        || _        |pg | _        d S r"   rb   )r$   rV   r   rc   rW   rY   rX   r`   ra   rZ   rd   r[   r\   r]   r^   r_   s                   r   r1   zSourceDescriptor.__init__k   s    & !9	:			 	 "$" $(& .4"r   _path	_filename)
r7   r8   r9   rS   flavorrN   r1   r,   r   rV   r:   r   r   r   r   a   s        99F) ) )F #15 15 15 15 15f g&&D!!+..HHHr   r   c                   *    e Zd ZdZg dZdddddZdS )r   a  <!-- optional: list of substitution rules -->
    <rules>
        <rule name="vertical.bars">
            <conditionset>
                <condition minimum="250.000000" maximum="750.000000" name="weight"/>
                <condition minimum="100" name="width"/>
                <condition minimum="10" maximum="40" name="optical"/>
            </conditionset>
            <sub name="cent" with="cent.alt"/>
            <sub name="dollar" with="dollar.alt"/>
        </rule>
    </rules>
    rW   conditionSetssubsNc                8    || _         |pg | _        |pg | _        d S r"   rj   )r$   rW   rk   rl   s       r   r1   zRuleDescriptor.__init__   s%    	*0bJB			r   )r7   r8   r9   rS   rN   r1   r:   r   r   r   r      sK          /..F#4d       r   r   c                 D    t          fd| j        D                       S )zK Return True if any of the rule's conditionsets matches the given location.c              3   8   K   | ]}t          |          V  d S r"   )evaluateConditions)rB   crY   s     r   	<genexpr>zevaluateRule.<locals>.<genexpr>   s.      KK1!!X..KKKKKKr   )anyrk   )rulerY   s    `r   evaluateRuleru      s)    KKKK8JKKKKKKr   c                     | D ]x}||d                  }|                     d          ||d         k    r dS 5|                     d          |d         |k    r dS Z|d         |cxk    r|d         k    sn  dS ydS )z Return True if all the conditions matches the given location.
        If a condition has no minimum, check for < maximum.
        If a condition has no maximum, check for > minimum.
    rW   minimumNmaximumFT)get)
conditionsrY   cdr)   s       r   rp   rp      s    
  	 	F$66)$r)}$$uu %VVI&)}u$$uu %I%88882i=888855 94r   c                     g }| D ]a}t          ||          rO|D ]H}d}|j        D ]\  }}||k    rd} n|r|                    |           3|                    |           I|}g }b|S )zY Apply these rules at this location to these glyphnames
        - rule order matters
    FT)ru   rl   append)	rulesrY   
glyphNamesnewNamesrt   rW   swapabs	            r   processRulesr      s     H  h'' 	" 	* 	* I  DAqqyy# !  *OOA&&&&OOD))))!JHr   c                       e Zd ZdZdZdZg dZddddddddddddddddddddZ ed	          Z	 e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 )r   z1Simple container for data related to the instanceinstanceen)r   rW   rY   r`   ra   postScriptFontNamestyleMapFamilyNamestyleMapStyleNamekerninginfolibNTrV   r   rc   rW   rY   r`   ra   r   r   r   localisedFamilyNamelocalisedStyleNamelocalisedStyleMapFamilyNamelocalisedStyleMapStyleNameglyphsr   r   r   c                   || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        |pi | _
        |pi | _        |pi | _        |pi | _        |pi | _        || _        || _        |pi | _        d S r"   r   )r$   rV   r   rc   rW   rY   r`   ra   r   r   r   r   r   r   r   r   r   r   r   s                      r   r1   zInstanceDescriptor.__init__   s    . !			 $""4"4!2#6#<" "4":+F+L"(*D*J'l	9"88r   rf   rg   c                 4    t          |          | j        |<   d S r"   )r   r   )r$   ra   languageCodes      r   setStyleNamezInstanceDescriptor.setStyleName(  s    05i0@0@---r   c                 6    | j                             |          S r"   )r   ry   r$   r   s     r   getStyleNamezInstanceDescriptor.getStyleName+  s    &**<888r   c                 4    t          |          | j        |<   d S r"   )r   r   )r$   r`   r   s      r   setFamilyNamez InstanceDescriptor.setFamilyName.  s    16z1B1B ...r   c                 6    | j                             |          S r"   )r   ry   r   s     r   getFamilyNamez InstanceDescriptor.getFamilyName1  s    '++L999r   c                 4    t          |          | j        |<   d S r"   )r   r   )r$   r   r   s      r   setStyleMapStyleNamez'InstanceDescriptor.setStyleMapStyleName4  s    8=>O8P8P'555r   c                 6    | j                             |          S r"   )r   ry   r   s     r   getStyleMapStyleNamez'InstanceDescriptor.getStyleMapStyleName7  s    .22<@@@r   c                 4    t          |          | j        |<   d S r"   )r   r   )r$   r   r   s      r   setStyleMapFamilyNamez(InstanceDescriptor.setStyleMapFamilyName:  s    9>?Q9R9R(666r   c                 6    | j                             |          S r"   )r   ry   r   s     r   getStyleMapFamilyNamez(InstanceDescriptor.getStyleMapFamilyName=  s    /33LAAAr   r   )r7   r8   r9   rS   rh   _defaultLanguageCoderN   r1   r,   r   rV   r   r   r   r   r   r   r   r   r:   r   r   r   r      sd       ;;F
 
 
F  $(#'),9 ,9 ,9 ,9 ,9\ g&&D!!+..HA A A A9 9 9 9C C C C: : : :Q Q Q QA A A AS S S SB B B B B Br   r   c                    dt          d          fdt          d          fdt          d          fdt          d	          fd
t          d          fd}|                                 |v r||                                          S t          |           dk     r| ddt          |           z
  z  z   }n
| d d         }|t          |           fS )NwghtWeightr   wdthWidthopszzOptical SizeslntSlantitalItalic)weightwidthopticalslantitalic   *)dictlowerlen)rW   namestags      r   tagForAxisNamer   A  s     Tx0001Tw///0T~6667Tw///0Tx0001 E zz||uTZZ\\""
4yy1}}SAD		M**2A2hr   c            	       J    e Zd ZdZdZg dZddddddddddZd Zd	 Zd
 Z	dS )r   zH Simple container for the axis data
        Add more localisations?
    axis)r   rW   rx   rw   defaultmapNF)r   rW   
labelNamesrw   r   rx   hiddenr   c                ~    || _         || _        |pi | _        || _        || _        || _        || _        |pg | _        d S r"   )r   rW   r   rw   rx   r   r   r   )	r$   r   rW   r   rw   r   rx   r   r   s	            r   r1   zAxisDescriptor.__init__Z  sI     	$*9"r   c           
          t          | j        | j        | j        | j        | j        | j        | j        | j                  S )N)r   rW   r   rx   rw   r   r   r   )	r   r   rW   r   rx   rw   r   r   r   r5   s    r   	serializezAxisDescriptor.serializer  sA    LLL;	
 	
 	
 		
r   c                 V    ddl m} | j        s|S  ||d | j        D                       S )Nr   piecewiseLinearMapc                     i | ]\  }}||	S r:   r:   rB   krC   s      r   
<dictcomp>z.AxisDescriptor.map_forward.<locals>.<dictcomp>      %@%@%@tq!a%@%@%@r   fontTools.varLib.modelsr   r   r$   rC   r   s      r   map_forwardzAxisDescriptor.map_forward  G    >>>>>>x 	H!!!%@%@tx%@%@%@AAAr   c                 V    ddl m} | j        s|S  ||d | j        D                       S )Nr   r   c                     i | ]\  }}||	S r:   r:   r   s      r   r   z/AxisDescriptor.map_backward.<locals>.<dictcomp>  r   r   r   r   s      r   map_backwardzAxisDescriptor.map_backward  r   r   )
r7   r8   r9   rS   rh   rN   r1   r   r   r   r:   r   r   r   r   S  s          FDDDF
     0
 
 
B B BB B B B Br   r   c                       e Zd ZdZeZeZeZ	e
Zed             Zed             Zed             Zed             Zd Zdd	ZddZd Zd Zd Zd Zd Zd Zd Zd
S )r   z    c                 *    |                                  S r"   )axisDescriptorClassclss    r   getAxisDecriptorzBaseDocWriter.getAxisDecriptor      &&(((r   c                 *    |                                  S r"   )sourceDescriptorClassr   s    r   getSourceDescriptorz!BaseDocWriter.getSourceDescriptor  s    ((***r   c                 *    |                                  S r"   )instanceDescriptorClassr   s    r   getInstanceDescriptorz#BaseDocWriter.getInstanceDescriptor  s    **,,,r   c                 *    |                                  S r"   )ruleDescriptorClassr   s    r   getRuleDescriptorzBaseDocWriter.getRuleDescriptor  r   r   c                     || _         || _        d| _        t          j        d          | _        | j        | j        j        d<   g | _        g | _        d S )Nz4.1designspaceformat)	r   documentObjectdocumentVersionETElementrootattrib_axes_rules)r$   documentPathr   s      r   r1   zBaseDocWriter.__init__  sN     	,$J}--	%)%9	"
r   TUTF-8c                    | j         j        r,| j                            t	          j        d                     | j         j        D ]}|                     |           | j         j        rJt          | j         dd          rddi}ni }| j                            t	          j        d|                     | j         j        D ]}| 	                    |           | j         j
        r,| j                            t	          j        d                     | j         j
        D ]}|                     |           | j         j        r,| j                            t	          j        d                     | j         j        D ]}|                     |           | j         j        r|                     | j         j                   t	          j        | j                  }	|	                    | j        |d	||
           d S )NaxesrulesProcessingLastF
processinglastr~   sources	instancesxml)encodingmethodxml_declarationpretty_print)r   r   r   r}   r   r   _addAxisr~   r#   _addRuler   
_addSourcer   _addInstancer   _addLibElementTreewriter   )
r$   prettyr   r   
axisObject
attributes
ruleObjectsourceObjectinstanceObjecttrees
             r   r  zBaseDocWriter.write  s   # 	1IRZ//000-2 	& 	&JMM*%%%%$ 	>t*,A5II  *F3


IRZ<<===-3 	& 	&JMM*%%%%& 	4IRZ	22333 /7 	* 	*LOOL))))( 	6IRZ44555"1; 	. 	.Nn----" 	2LL,0111~di((

I+ 	 	
 	
 	
 	
 	
r   Nc                 T   t          j        d          }|
||j        d<   | j                                        }|                                D ]\  }}||v r|||<   |                                D ]\  }}t          j        d          }	||	j        d<   t          |          t          k    rG|                     |d                   |	j        d<   |                     |d                   |	j        d<   n|                     |          |	j        d<   |	                    |	           ||fS )	z, Convert Location dict to a locationElement.rY   NrW   	dimensionr   xvalue   yvalue)
r   r   r   r   newDefaultLocationrF   typetuple
intOrFloatr}   )
r$   locationObjectrW   
locElementvalidatedLocationaxisName	axisValuedimensionNamedimensionValue
dimElements
             r   _makeLocationElementz"BaseDocWriter._makeLocationElement  s;   Z
++
(,Jf% /BBDD#1#7#7#9#9 	8 	8Hi,,,.7!(+->-D-D-F-F 	* 	*)M>K00J(5Jf%N##u,,.2oonQ>O.P.P
!(+.2oonQ>O.P.P
!(++.2oon.M.M
!(+j)))),,,r   c                 <    t          |          |k    rd|z  S d|z  S )Nz%dz%fint)r$   nums     r   r  zBaseDocWriter.intOrFloat  s%    s88s??#:czr   c                 D   | j                             |           t          j        d          }|j        |j        |j        d<   |j        D ];}t          j        d          }|D ]}|                    d          |                    d          -t          j        d          }|                    d          |j        d<   |                    d          0|                     |                    d                    |j        d<   |                    d          0|                     |                    d                    |j        d<   |                    |           t          |          r|                    |           =|j
        D ]K}t          j        d          }|d         |j        d<   |d	         |j        d
<   |                    |           Lt          |          r5| j                            d          d                             |           d S d S )Nrt   rW   conditionsetrw   rx   	conditionsubr   r  with.rules)r   r}   r   r   rW   r   rk   ry   r  r   rl   r   findall)	r$   r  ruleElementrz   conditionsetElementcondconditionElementr)  
subElements	            r   r  zBaseDocWriter._addRule  s   :&&&j((?&)3Kv&$2 	8 	8J"$*^"<"<" 
= 
=88I&&.488I3F3F3N#%:k#:#: 26((62B2B '/88I&&29=R[I\I\9]9]$+I688I&&29=R[I\I\9]9]$+I6#**+;<<<<&'' 8""#6777? 	+ 	+CE**J(+AJf%(+AJf%z****{ 	?Ih''*11+>>>>>	? 	?r   c                    | j                             |           t          j        d          }|j        |j        d<   |j        |j        d<   |                     |j                  |j        d<   |                     |j	                  |j        d<   |                     |j
                  |j        d<   |j        r
d|j        d<   t          |j                                                  D ]D\  }}t          j        d	          }||j        t          <   ||_        |                    |           E|j        rp|j        D ]h\  }}t          j        d
          }|                     |          |j        d<   |                     |          |j        d<   |                    |           i| j                            d          d                             |           d S )Nr   r   rW   rw   rx   r   1r   	labelnamer   inputoutputz.axesr   )r   r}   r   r   r   r   rW   r  rw   rx   r   r   sortedr   rF   XML_LANGtextr   r   r,  )	r$   r
  axisElementr   	labelNamelanguageElement
inputValueoutputValue
mapElements	            r   r  zBaseDocWriter._addAxis
  s   
*%%%j(($.N5!%/_6"(,
8J(K(K9%(,
8J(K(K9%(,
8J(K(K9% 	/+.Kx('-j.C.I.I.K.K'L'L 	0 	0#L) j55O/;O"8,#,O ////> 	/+5> / /'
KZ..
-1__Z-H-H
!'*.2ook.J.J
!(+"":....	'""1%,,[99999r   c                 2
   t          j        d          }|j        |j        |j        d<   |j        |j        |j        d<   |j        |j        |j        d<   |j        rt          |j                                                  }|	                                 |D ][}|dk    r	t          j        d          }||j        t          <   |                    |          |_        |                    |           \|j        rt          |j                                                  }|	                                 |D ][}|dk    r	t          j        d          }||j        t          <   |                    |          |_        |                    |           \|j        rt          |j                                                  }|	                                 |D ][}|dk    r	t          j        d          }||j        t          <   |                    |          |_        |                    |           \|j        rt          |j                                                  }|	                                 |D ][}|dk    r	t          j        d          }||j        t          <   |                    |          |_        |                    |           \|j        7|                     |j                  \  }	|_        |                    |	           |j        |j        |j        d<   |j        |j        |j        d	<   |j        |j        |j        d<   |j        |j        |j        d<   |j        r|                    d
          g k    r)t          j        d          }
|                    |
           |                    d
          d         }
t9          |j                                                  D ]2\  }}|                     ||||          }|
                    |           3|j        r)t          j        d          }|                    |           |j         r)t          j        d          }|                    |           |j!        rWt          j        d          }|                    tE          j#        |j!        d                     |                    |           | j$                            d          d                             |           d S )Nr   rW   
familyname	stylenamer   stylemapstylenamestylemapfamilynamerV   postscriptfontnamez.glyphsr   r   r   r   r   r   indent_levelz
.instances)%r   r   rW   r   r`   ra   r   rH   keyssortr8  r   r9  r}   r   r   r   r   r   r   rY   r!  rV   r   r   r   r   r,  r7  rF   _writeGlyphElementr   r   r   r	   totreer   )r$   r  instanceElementlanguageCodescodelocalisedStyleNameElementlocalisedFamilyNameElement!localisedStyleMapStyleNameElement"localisedStyleMapFamilyNameElementlocationElementglyphsElement	glyphNamedataglyphElementkerningElementinfoElement
libElements                    r   r  zBaseDocWriter._addInstance!  s-   *Z00*-;-@O"6*$03A3LO"<0#/2@2JO";/, 		B !B!G!G!I!IJJM   % B B4<<,.J{,C,C)=A)0:1?1L1LT1R1R).&&'@AAAA- 		C !C!H!H!J!JKKM   % C C4<<-/Z-E-E*>B*1(;2@2N2Nt2T2T*/&&'ABBBB4 		J !J!O!O!Q!QRRM   % J J4<<46J?R4S4S1EI18B9G9\9\]a9b9b16&&'HIIII5 		K !K!P!P!R!RSSM   % K K4<<57Z@T5U5U2FJ29(C:H:^:^_c:d:d27&&'IJJJJ".7;7P7PQ_Qh7i7i4O^4""?333".1?1HO":.,8;I;\O"#78,8;I;\O"#78+7:H:ZO"#67  	3&&y11R77 "
8 4 4&&}555+33I>>qAM#).*?*E*E*G*G#H#H 3 3	4#66Xacghh$$\2222! 	3Z	22N"">222 	0*V,,K"";/// 	/E**Jhon.@qQQQRRR"":...	,''*11/BBBBBr   c                 8   t          j        d          }|j        |j        |j        d<   |j        -|j                            d          dk    r|j        |j        d<   |j        |j        |j        d<   |j        |j        |j        d<   |j        |j        |j        d<   |j	        r3t          j        d	          }d
|j        d<   |
                    |           |j        r3t          j        d          }d
|j        d<   |
                    |           |j        r3t          j        d          }d
|j        d<   |
                    |           |j        s|j        rKt          j        d          }|j        r
d
|j        d<   |j        r
d
|j        d<   |
                    |           |j        r3t          j        d          }d
|j        d<   |
                    |           |j        rG|j        D ]?}t          j        d          }	||	j        d<   d
|	j        d<   |
                    |	           @|                     |j                  \  }
|_        |
                    |
           | j                            d          d         
                    |           d S )NrU   rV   temp_masterr   rW   rA  rB  layerr   r3  copygroupsfeaturesr   muter   glyphz.sources)r   r   rV   r   rW   findr`   ra   rX   rZ   r}   r[   r\   rd   r^   r]   r_   r!  rY   r   r,  )r$   r  sourceElementrZ  groupsElementfeaturesElementrY  rX  rW   rW  rS  s              r   r  zBaseDocWriter._addSourcer  s   
8,, ,/;/DM ,( %%m4499/;/@$V,".1=1HM .!-0<0FM -!-,8,BM ) 	-E**J(+Jf%  ,,," 	0Jx00M+.M (  ///$ 	2 j44O-0O"6*  111  	.L$9 	.*V,,K$ 1-0"6*$ 1-0"6*  ---# 	1Z	22N,/N!&)  000' 	3$4 3 3!z'22.2#F+.1#F+$$\2222151J1J<K`1a1a.._---	*%%a(//>>>>>r   c                     t          j        d          }|                    t          j        |d                     | j                            |           d S )Nr      rF  )r   r   r}   r	   rK  r   )r$   r   rZ  s      r   r  zBaseDocWriter._addLib  sP    Z&&
(/$Q???@@@	$$$$$r   c                    t          j        d          }|                    d          r
d|j        d<   |                    d          :d                    d |                    d          D                       |j        d<   |                    d          C|                     |                    d                    \  }|d<   |                    |           |
||j        d	<   |                    d
          Ct          j        d
          }|                    d
          |_        |                    |           |                    d          &t          j        d          }|                    d          D ]}	t          j        d          }
|	                    d          |	                    d          |
j        d<   |	                    d          |	                    d          |
j        d<   |	                    d          C|                     |	                    d                    \  }|	d<   |
                    |           |                    |
           |                    |           |S )Nrb  ra  r3  unicodes c                 ,    g | ]}t          |          S r:   )hexrB   us     r   rD   z4BaseDocWriter._writeGlyphElement.<locals>.<listcomp>  s    6\6\6\!s1vv6\6\6\r   unicodeinstanceLocationrW   notemastersmasterrU  	glyphnamerc   rU   rY   )r   r   ry   r   r   r!  r}   r9  )r$   rL  r  rU  rV  rW  rS  noteElementmastersElementmmasterElements              r   rJ  z BaseDocWriter._writeGlyphElement  sG   z'**88F 	.*-L'88J+-0XX6\6\txxPZG[G[6\6\6\-]-]L	*88&''38<8Q8QRVRZRZ[mRnRn8o8o5OT"45000 *3L'88F'*V,,K#xx//K,,,88I*Z	22NXXi(( 	5 	5 "
8 4 455%%189k8J8JM(555==,56UU6]]M(255$$0595N5NquuU_O`O`5a5a2OQz]!((999%%m4444///r   )Tr   Tr"   )r7   r8   r9   _whiteSpacer   r   r   r   r   r   r   r   classmethodr   r   r   r   r1   r  r!  r  r  r  r  r  r  rJ  r:   r   r   r   r     sD       K((,0) ) [) + + [+ - - [- ) ) [)  #
 #
 #
 #
J- - - -*  
? ? ?:: : :.OC OC OCb-? -? -?^% % %
    r   r   c                       e Zd ZeZeZeZe	Z
d Zed             Zd Zd ZddZd Zd Zd	 Zd
 ZddZddZd Zd Zd Zd Zd ZdS )r   c                 .   || _         || _        t          j        | j                   }|                                | _        | j        j                            dd          | j        _        g | _	        g | _
        g | _        g | _        i | _        d| _        d S )Nr   z3.0T)r   r   r   parsegetrootr   r   ry   formatVersionr   r~   r   r   axisDefaults_strictAxisNames)r$   r   r   r  s       r   r1   zBaseDocReader.__init__  s     	,x	""LLNN	,0I,<,@,@5,Q,Q)

 $r   c                 h    t          t          |d                    } | ||          }d |_        |S )Nutf-8)r   )r   r   r   )r   stringr   fr$   s        r   
fromstringzBaseDocReader.fromstring  s9    GFW55566s1n%%	r   c                     |                                   |                                  |                                  |                                  |                                  d S r"   )readAxes	readRulesreadSourcesreadInstancesreadLibr5   s    r   readzBaseDocReader.read  sT    r   c                 v   g }| j                             d          }|A|j                            dd          }|dvrt	          d|z            |dk    | j        _        | j                             d          D ]1}|                                 }|j                            d          x}|_	        | 
                    ||          }|r4|j                            |           | j                            d	           |                    d
          D ]4}| 
                    ||          }	|	|j                            |	           5|                    d          D ]8}
|
j        d         }|
j        d         }|j                            ||f           9|                    |           3|| j        _        d S )Nr+  r   first>   r   r  zO<rules> processing attribute value is not valid: %r, expected 'first' or 'last'r   z.rules/rulerW   zWFound stray rule conditions outside a conditionset. Wrapped them in a new conditionset.z.conditionsetz.subr*  )r   rc  r   ry   r
   r   r   r,  r   rW   _readConditionElementsrk   r}   logr   rl   r~   )r$   r~   rulesElementprocessingValuer-  r  ruleNameexternalConditionsconditionSetElementconditionSetr1  r   r   s                r   r  zBaseDocReader.readRules  s   y~~h//#*155lGLLO&777.13BCD D D 7F6OD39,,];; 	% 	%K1133J)4);)?)?)G)GGHz!%!<!<" " " (//0BCCC:  
 (3':':?'K'K B B##::'     +,33LAAA)11&99 / /
%f-%f-&&1v....LL$$$$$)!!!r   Nc                    g }|                     d          D ]}i }|j                            d          }|t          |          |d<   nd |d<   |j                            d          }|t          |          |d<   nd |d<   |j                            d          |d<   |                    d          .|                    d          t	          d|d|z  ndz             |                    |           |S )Nz
.conditionrw   rx   rW   z5condition missing required minimum or maximum in rulez '%s'r3   )r,  r   ry   floatr
   r}   )r$   parentElementr  cdsr0  r{   cdMincdMaxs           r   r  z$BaseDocReader._readConditionElements  s    - 5 5l C C 	 	B$+//	::E  %e9 !%9$+//	::E  %e9 !%9)044V<<BvJvvi  (RVVI->->-F.K+3+?Wx''RIJ J J JJrNNNN
r   c                 (   | j                             d          }|sd S |D ]}|                                 }|j                            d          |_        t          |j                            d                    |_        t          |j                            d                    |_        |j                            dd          rd|_	        t          |j                            d                    |_
        |j                            d	          |_        |                    d
          D ]R}t          |j        d                   }t          |j        d                   }|j                            ||f           S|                    d          D ]C}|                                D ],\  }}	|t          k    rt!          |j                  |j        |	<   -D| j        j                            |           |j
        | j        |j        <   d S )Nz
.axes/axisrW   rw   rx   r   FTr   r   r   r5  r6  r4  )r   r,  r   r   ry   rW   r  rw   rx   r   r   r   r   r}   rF   r8  r   r9  r   r   r   r  )
r$   axisElementsr:  r
  r?  r   r   labelNameElementkeyr   s
             r   r  zBaseDocReader.readAxes'  s	   y((66 	F' 	D 	DK1133J)044V<<JO!&{'9'='=i'H'H!I!IJ!&{'9'='=i'H'H!I!IJ!%%h66 )$(
!!&{'9'='=i'H'H!I!IJ(/33E::JN)11%88 . .
*+G455*+H566%%q!f----$/$7$7$D$D S S  "2!7!7!9!9 S SICh6;<L<Q6R6R
-d3S $++J7771;1CDjo..)	D 	Dr   c                    t          | j                            d                    D ]:\  }}|j                            d          }|g| j        `t          j                            t          j                            t          j        	                    | j                  |                    }nd }|j                            d          }|d|z  }| 
                                }||_        ||_        ||_        |j                            d          }|||_        |j                            d          }|||_        |                     |          |_        |j                            d          }	|	|	|_        |                    d          D ]'}
|
j                            d	          d
k    rd|_        (|                    d          D ]'}|j                            d	          d
k    rd|_        (|                    d          D ]L}|j                            d	          d
k    rd|_        |j                            d          d
k    rd|_        M|                    d          D ]'}|j                            d	          d
k    rd|_        (|                    d          D ]W}|j                            d          }||j                            d          d
k    r|j                            |           X|                    d          D ]'}|j                            d          d
k    rd|_        (| j        j                            |           <d S )Nz.sources/sourcerV   rW   ztemp_master.%drA  rB  r]  .libr^  r3  Tz.groupsz.infora  z	.featuresz.glyphz.kerning)	enumerater   r,  r   ry   r   r   abspathr   dirnamer   rV   rW   r`   ra   locationFromElementrY   rX   rZ   r[   rd   r^   r\   r_   r}   r]   r   r   )r$   sourceCountrd  rV   
sourcePath
sourceNamer  r`   ra   rX   rZ  re  rY  rf  rW  rU  rX  s                    r   r  zBaseDocReader.readSourcesB  sf   *3DI4E4EFW4X4X*Y*Y /	= /	=&K$+//
;;H#	(=W__RW\\"'//$):T:TV^-_-_``

!
&-11&99J!-=
5577L *L$,L! *L&-11,??J%*4'%,00==I$)2&$($<$<]$K$KL!%,0099I$)2&+33F;; 0 0
$((00C77+/L(!.!6!6y!A!A 3 3 '++F33s::.2L+,44W== 1 1%))&11S88,0L)%))&11S88,0L)#0#8#8#E#E 5 5")--f55<<04L- - 5 5h ? ? C C(/33F;;	$&**622c99 077	BBB"/"7"7
"C"C 4 4!(,,V44;;/3L,'..|<<<<_/	= /	=r   c                 d    d }|                     d          D ]}|                     |          } |S )Nz	.location)r,  readLocationElement)r$   elementelementLocationrS  s       r   r  z!BaseDocReader.locationFromElementt  s>    &{;; 	 	O"66GGOr   c                 V   | j         r| j        j        st          d          i }|                    d          D ]}|j                            d          }| j         r%|| j        vr| j        	                    d|           Hdx}}	 |j                            d          }t          |          }n+# t          $ r | j        	                    d|           Y nw xY w	 |j                            d          }|t          |          }n# t          $ r Y nw xY w|||f||<   |||<   |S )	z Format 0 location reader zNo axes definedz
.dimensionrW   z#Location with undefined axis: "%s".Nr  z%KeyError in readLocation xValue %3.3fr  )r  r   r   r
   r,  r   ry   r  r  warningr  
ValueError)r$   rS  locdimensionElementdimNamexValueyValues          r   r  z!BaseDocReader.readLocationElement{  sz     	>)<)A 	>*+<=== / 7 7 E E 	& 	&&-11&99G$ 8I)I)I  !H'RRR""FVR)044X>>v R R R  !H&QQQQQR)044X>>%"6]]F   ! &/G%G
s$   )B11%CC+D		
DDTc                 v    | j                             d          }|D ]}|                     ||||           d S )Nz.instances/instance)
makeGlyphsmakeKerningmakeInfo)r   r,  _readSingleInstanceElement)r$   r  r  r  instanceElementsrL  s         r   r  zBaseDocReader.readInstances  sX    9,,-BCC/ 	@ 	@O++O
`kv~+	@ 	@r   c                 0   |j                             d          }|T| j        j        Ht          j                            t          j                            | j        j                  |          }nd }|                                 }||_        ||_        |j                             d          }|||_	        |j                             d          }	|	|	|_
        |j                             d          }
|
|
|_        |j                             d          }|||_        |j                             d          }|||_        |j                             d          }|||_        |                    d          D ]D}|                                D ]-\  }}|t"          k    r|j        }|                    ||           .E|                    d          D ]D}|                                D ]-\  }}|t"          k    r|j        }|                    ||           .E|                    d          D ]D}|                                D ]-\  }}|t"          k    r|j        }|                    ||           .E|                    d          D ]D}|                                D ]-\  }}|t"          k    r|j        }|                    ||           .E|                     |          }|||_        |                    d          D ]}|                     ||           |                    d	          D ]}|                     ||           |                    d
          D ]}|                     ||           | j        j                            |           d S )NrV   rW   rA  rB  rE  rD  rC  z.glyphs/glyphr   r   )r   ry   r   r   r   r   r  r   rV   rW   r`   ra   r   r   r   r,  rF   r8  r9  r   r   r   r   r  rY   readGlyphElementreadInfoElementreadLibElementr   r}   )r$   rL  r  r  r  rV   instancePathr  rW   rA  rB  r   r   r   styleNameElementr  r   ra   familyNameElementr`   styleMapStyleNameElementstyleMapFamilyNameElementrq  rW  rY  rZ  s                             r   r  z(BaseDocReader._readSingleInstanceElement  s	   ")--j99D$7$<$H7<<8K8P(Q(QS[\\LLL5577*"*%))&11"&N$+//==
!(2N%#*..{;;	 '0N$,3778LMM)0BN-,3778LMM)0BN-+2667JKK(/@N, / 7 7 D D 	A 	A-3355 A A	T(?? 0 5I"//	4@@@A "1!8!8!F!F 	C 	C.4466 C C	T(??!2!7J"00TBBBC )8(?(?@S(T(T 	Q 	Q$5;;== Q Q	T(??(@(E%"778I4PPPQ *9)@)@AU)V)V 	S 	S%6<<>> S S	T(??)B)G&"889KTRRRS  33ODD'&6N#+33ODD 	@ 	@L!!,????*226:: 	> 	>K  n====)11%88 	< 	<J
N;;;;%,,^<<<<<r   c                 D    t          j        |d                   |_        dS )z,Read the lib element for the given instance.r   N)r	   fromtreer   )r$   rZ  r  s      r   r  zBaseDocReader.readLibElement  s    %.z!}==r   c                     d|_         dS )z Read the info element.TN)r   )r$   rY  r  s      r   r  zBaseDocReader.readInfoElement  s    "r   c                 Z    |                      |          }|                    |           dS )z Read the kerning element.N)r  
addKerning)r$   rX  r  kerningLocations       r   readKerningElementz BaseDocReader.readKerningElement  s/    22>BB!!/22222r   c                 0   i }|j                             d          }|t          d          |j                             d          }|dk    rd|d<   |j                             d          }|F	 d |                    d	          D             }||d
<   n # t          $ r t          d|z            w xY w|                    d          D ]}|j        |d<    |                     |          }|||d<   d}	|                    d          D ]z}
|
j                             d          }|                     |
          }|
j                             d          }||}t          |||          }|	g }	|		                    |           {|	|	|d<   ||j
        |<   dS )a  
        Read the glyph element.
            <glyph name="b" unicode="0x62"/>
            <glyph name="b"/>
            <glyph name="b">
                <master location="location-token-bbb" source="master-token-aaa2"/>
                <master glyphname="b.alt1" location="location-token-ccc" source="master-token-aaa3"/>
                <note>
                    This is an instance from an anisotropic interpolation.
                </note>
            </glyph>
        rW   Nz#Glyph object without name attributera  r3  Trp  c                 .    g | ]}t          |d           S )   r#  rn  s     r   rD   z2BaseDocReader.readGlyphElement.<locals>.<listcomp>  s     DDD1C2JJDDDr   rk  rj  z"unicode values %s are not integersz.noterr  rq  z.masters/masterrU   ru  )rc   rY   rU  rs  )r   ry   r
   r   r  r,  r9  r  r   r}   r   )r$   rW  r  	glyphDatarU  ra  rj  rv  rq  glyphSourcesry  fontSourceNamesourceLocationmasterGlyphNamerI   s                  r   r  zBaseDocReader.readGlyphElement  s    	 '++F33	*+PQQQ"&&v..3;; $If&**955`DDs0C0CDDD(0	*%% ` ` `./SV^/^___` (//88 	 	K + 0If33LAA',<I())112CDD 	# 	#M*155h??N!55mDDN+266{CCO&"+.,.0 0 0A #!""""##/Ii +4i(((s   0$B B2c                     | j                             d          D ]&}t          j        |d                   | j        _        'dS )z,Read the lib element for the whole document.r  r   N)r   r,  r	   r  r   r   )r$   rZ  s     r   r  zBaseDocReader.readLib  sL    )++F33 	G 	GJ&.&7
1&F&FD##	G 	Gr   r"   )TTT)r7   r8   r9   r   r   r   r   r   r   r   r   r1   r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r:   r   r   r   r     sG       ((,0% % %   [  &* &* &*P   2D D D60= 0= 0=d    :@ @ @ @
9= 9= 9= 9=v> > ># # #3 3 3
35 35 35jG G G G Gr   r   c                       e Zd ZdZd dZed d            Zed d            Zd!dZd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd"dZd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )#r   z+ Read, write data from the designspace fileNc                     d | _         d | _        	 d | _        g | _        g | _        g | _        g | _        d| _        d | _        i | _	        	 ||| _
        nt          | _
        |	|| _        d S t          | _        d S )NF)r   rV   r  r   r   r   r~   r   r   r   readerClassr   writerClassr   )r$   r  r  s      r   r1   zDesignSpaceDocument.__init__"  s    		 "	
#( = "*D,D"*D,Dr   c                 J     | ||          }|                     |           |S N)r  r  )r  )r   r   r  r  r$   s        r   fromfilezDesignSpaceDocument.fromfileB  s*    s{DDD		$r   c                      | ||          }|j                             ||          }|                                 |j        r|                                 |S r  )r  r  r  r   findDefault)r   r  r  r  r$   readers         r   r  zDesignSpaceDocument.fromstringH  s\    s{DDD!,,VT::< 	r   c                 F   |t           u s|)|                                dk    rt                      }d}n-||dk    rt                      }d}d}nt	          d|z            |                     ||           }|                    ||           |                                S )Nrp  Fr  r   Tzunsupported encoding: '%s')r   r   )r4   r   r   r   r  r  r  getvalue)r$   r   r  r   writers        r   tostringzDesignSpaceDocument.tostringQ  s    s?? X^^%5%5%B%B

A#OOW!4!4		AH"OO9HDEEE!!!T**hHHHzz||r   c                 2   t          |d          r|                                }|| _        t          j                            |          | _        |                     ||           }|                                 | j        r| 	                                 d S d S N
__fspath__)
rA   r  r   r   basenamerV   r  r  r   r  )r$   r   r  s      r   r  zDesignSpaceDocument.reada  s    4&& 	%??$$D	((..!!$--< 		 	r   c                     t          |d          r|                                }|| _        t          j                            |          | _        |                                  |                     ||           }|                                 d S r  )	rA   r  r   r   r  rV   updatePathsr  r  )r$   r   r  s      r   r  zDesignSpaceDocument.writek  sy    4&& 	%??$$D	((..!!$--r   c                     t           j                            |t           j                            | j                            }t	          |          S r"   )r   r   relpathr  r   )r$   	otherPathrelatives      r   _posixRelativePathz&DesignSpaceDocument._posixRelativePatht  s3    7??9bgoodi.H.HIIXr   c                     | j         J | j        | j        z   D ](}|j         |                     |j                   |_        )dS )a  
            Right before we save we need to identify and respond to the following situations:
            In each descriptor, we have to do the right thing for the filename attribute.

            case 1.
            descriptor.filename == None
            descriptor.path == None

            -- action:
            write as is, descriptors will not have a filename attr.
            useless, but no reason to interfere.


            case 2.
            descriptor.filename == "../something"
            descriptor.path == None

            -- action:
            write as is. The filename attr should not be touched.


            case 3.
            descriptor.filename == None
            descriptor.path == "~/absolute/path/there"

            -- action:
            calculate the relative path for filename.
            We're not overwriting some other value for filename, it should be fine


            case 4.
            descriptor.filename == '../somewhere'
            descriptor.path == "~/absolute/path/there"

            -- action:
            there is a conflict between the given filename, and the path.
            So we know where the file is relative to the document.
            Can't guess why they're different, we just choose for path to be correct and update filename.


        N)r   r   r   r  rV   )r$   
descriptors     r   r  zDesignSpaceDocument.updatePathsx  sZ    T y$$$,7 	O 	OJ*&*&=&=jo&N&N
#	O 	Or   c                 :    | j                             |           d S r"   )r   r}   )r$   sourceDescriptors     r   	addSourcezDesignSpaceDocument.addSource  s    ,-----r   c                 T     | j         j        di |}|                     |           |S Nr:   )r  r   r  )r$   kwargsrU   s      r   addSourceDescriptorz'DesignSpaceDocument.addSourceDescriptor  s4    7!7AA&AAvr   c                 :    | j                             |           d S r"   )r   r}   )r$   instanceDescriptors     r   addInstancezDesignSpaceDocument.addInstance  s    011111r   c                 T     | j         j        di |}|                     |           |S r  )r  r   r  )r$   r  r   s      r   addInstanceDescriptorz)DesignSpaceDocument.addInstanceDescriptor  s6    ;4#;EEfEE"""r   c                 :    | j                             |           d S r"   )r   r}   )r$   axisDescriptors     r   addAxiszDesignSpaceDocument.addAxis  s    	(((((r   c                 T     | j         j        di |}|                     |           |S r  )r  r   r   )r$   r  r   s      r   addAxisDescriptorz%DesignSpaceDocument.addAxisDescriptor  4    3t3==f==Tr   c                 :    | j                             |           d S r"   )r~   r}   )r$   ruleDescriptors     r   addRulezDesignSpaceDocument.addRule  s    
.)))))r   c                 T     | j         j        di |}|                     |           |S r  )r  r   r  )r$   r  rt   s      r   addRuleDescriptorz%DesignSpaceDocument.addRuleDescriptor  r  r   c                     t          j                    }| j        D ]$}|                    |j                  ||j        <   %|S )z(Return default location in design space.)collectionsOrderedDictr   r   r   rW   )r$   r  r  s      r   r  z&DesignSpaceDocument.newDefaultLocation  sP     %''"i 	 	N'5'A'A&( (C#$$ 
r   TFc                     |r:| j         D ]2}|j        |s| j        |                     |j                  |_        3|r:| j        D ]4}|j        |s| j        |                     |j                  |_        3d S d S r"   )r   rV   r   r  r   )r$   rs  r   forcer  s        r   updateFilenameFromPathz*DesignSpaceDocument.updateFilenameFromPath  s      	S"l S S
&2529(*.*A*A*/*R*RJ' 	S"n S S
&2529(*.*A*A*/*R*RJ'	S 	SS Sr   c                 4    | j                                         S r"   )r  r   r5   s    r   newAxisDescriptorz%DesignSpaceDocument.newAxisDescriptor  s    00222r   c                 4    | j                                         S r"   )r  r   r5   s    r   newSourceDescriptorz'DesignSpaceDocument.newSourceDescriptor  s    33555r   c                 4    | j                                         S r"   )r  r   r5   s    r   newInstanceDescriptorz)DesignSpaceDocument.newInstanceDescriptor  s    55777r   c                 R    g }| j         D ]}|                    |j                   |S r"   )r   r}   rW   )r$   r   r  s      r   getAxisOrderz DesignSpaceDocument.getAxisOrder  s5    "i 	. 	.NLL,----r   c                 8    | j         D ]}|j        |k    r|c S d S r"   )r   rW   )r$   rW   r  s      r   getAxiszDesignSpaceDocument.getAxis  s7    "i 	& 	&N"d**%%%% +tr   c                 |    d| _         |                                 }| j        D ]}|j        |k    r|| _         |c S dS )zSet and return SourceDescriptor at the default location or None.

        The default location is the set of all `default` values in user space
        of all axes.
        N)r   r  r   rY   )r$   default_location_designr  s      r   r  zDesignSpaceDocument.findDefault  s`      #'"9"9";"; $ 	( 	((,CCC/'''' D tr   c                     ddl m} i }| j        D ]jj        |vr|j                 }t	          |t
                    r|d         }fdj        j        j        fD             } |||          |j        <   k|S )Nr   )normalizeValuec                 :    g | ]}                     |          S r:   )r   )rB   rC   r   s     r   rD   z9DesignSpaceDocument.normalizeLocation.<locals>.<listcomp>  s4       ()  ##  r   )	r   r  r   rW   rG   r  rw   r   rx   )r$   rY   r  newr)   tripler   s         @r   normalizeLocationz%DesignSpaceDocument.normalizeLocation  s    ::::::I 	; 	;Dy((TY'E%'' !a   .2lDL$,-W  F ,^E6::C	NN
r   c           
         | j         D ]!}|                     |j                  |_        "| j        D ]}|j                                        D ]L\  }}|                     |d                   |d<   |d         D ] }|                     |d                   |d<   !M|                     |j                  |_        | j        D ]&}g }|j        D ]P\  }}|                     |j        |i          	                    |j                  }	|
                    ||	f           Q|r||_        |                     |j        |j        i          	                    |j                  }
|                     |j        |j        i          	                    |j                  }|                     |j        |j        i          	                    |j                  }|
|_        ||_        ||_        (| j        D ]}g }|j        D ]}g }|D ]}|	                    d          =|                     |d         |d         i          	                    |d                   }
nd }
|	                    d          =|                     |d         |d         i          	                    |d                   }nd }|
                    t!          |d         |
|                     |
                    |           ||_        d S )Nrq  rs  rY   rw   rW   rx   )rW   rw   rx   )r   r   rY   r   r   rF   r   r   rW   ry   r}   rw   rx   r   r~   rk   r   )r$   itemr>   r  glyphMasterr   newMapr=  r>  newOutputValuerw   rx   r   rt   newConditionSetsrz   newConditionsr/  s                     r   	normalizezDesignSpaceDocument.normalize   s)   
 L 	B 	BD 224=AADMMN 	B 	BD $ 1 1 3 3 ^ ^9040F0FyQcGd0e0e	,-#,Y#7 ^ ^K.2.D.D[Q[E\.].]K
++^ 224=AADMMI 	# 	#DF+/8 < <'
K!%!7!7K8P!Q!Q!U!UVZV_!`!`z>:;;;; "!,,di-FGGKKDIVVG,,di-FGGKKDIVVG,,di-FGGKKDIVVG"DL"DL"DLLJ 	2 	2D!"0 7 7
 "& 	d 	dDxx	**6"&"8"8$v,Y9X"Y"Y"]"]^bci^j"k"k"&xx	**6"&"8"8$v,Y9X"Y"Y"]"]^bci^j"k"k"&!((4<Za)b)b)bcccc ''6666!1D	2 	2r   c                 V   i }g }| j         D ]}|j        |                    |j                   $|j        |v r||j                 |_        nB|j        t	          d|j        pdz             ||j        fi ||_        |j        ||j        <   |                    |j                   |S )a  Ensure SourceDescriptor.font attributes are loaded, and return list of fonts.

        Takes a callable which initializes a new font object (e.g. TTFont, or
        defcon.Font, etc.) from the SourceDescriptor.path, and sets the
        SourceDescriptor.font attribute.
        If the font attribute is already not None, it is not loaded again.
        Fonts with the same path are only loaded once and shared among SourceDescriptors.

        For example, to load UFO sources using defcon:

            designspace = DesignSpaceDocument.fromfile("path/to/my.designspace")
            designspace.loadSourceFonts(defcon.Font)

        Or to load masters as FontTools binary fonts, including extra options:

            designspace.loadSourceFonts(ttLib.TTFont, recalcBBoxes=False)

        Args:
            opener (Callable): takes one required positional argument, the source.path,
                and an optional list of keyword arguments, and returns a new font object
                loaded from the path.
            **kwargs: extra options passed on to the opener function.

        Returns:
            List of font objects in the order they appear in the sources list.
        Nz/Designspace source '%s' has no 'path' attributez	<Unknown>)r   rc   r}   r   r
   rW   )r$   openerr  loadedfontsrU   s         r   loadSourceFontsz#DesignSpaceDocument.loadSourceFontsR  s    8 l 	& 	&F{&V[))){f$$$V[1;&2I!;5+7   %fV[;;F;;&,kv{#LL%%%%r   )NNr"   )TTF) r7   r8   r9   rS   r1   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      s       55- - - -@    [
    [          .O .O .O`. . .  
2 2 2  
) ) )  
* * *  
	 	 	S S S S 3 3 36 6 68 8 8      &  $02 02 02d- - - - -r   r   )$fontTools.misc.py23r   r   fontTools.misc.loggingToolsr   r
  ior   r   r   r   fontTools.miscr   r   r	   __all__XML_NSr8  r   r,   	Exceptionr
   objectr<   rL   r   r   ru   rp   r   r   r   r   r   r   r   r:   r   r   <module>r6     s   / . . . . . . . 0 0 0 0 0 0                     				     & & & & & & # # # # # #   
2F?	 	 	$ $ $? ? ? ? ?y ? ? ?    &   "a a a a a{ a a a>/ >/ >/ >/ >/' >/ >/ >/B    %   0L L L
  $  ,WB WB WB WB WB) WB WB WBt  $8B 8B 8B 8B 8B% 8B 8B 8Bvt t t t tF t t tn	XG XG XG XG XGH XG XG XGv
_ _ _ _ _(K _ _ _ _ _r   