
    Ph<              
       f   d dl mZ d dlmZ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c mc mZ d dlmZ d	d
lmZ d dlZd dlZ ej6                  e      ZdZ ej>                  e      Z  G d dej0                        Z!d Z"d Z#dNdZ$ G d de%      Z&i dddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4i d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVi dWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxi dydzd{d|d}d~ddddddddddddddddddddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddēddƓddȓddʓdd̓ddΓddГddғddԓdd֓ddؓddړddܓddޓi dddddddddddddddddddddddddddddddddd i ddddddddd	d
dddddddddddddddddddddd d!d"i d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d:d>d?d@dAdBdCi dDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddei dfdgdhdidjdkdldmdndodpdqdrdsdtdsdudvdwdxdydzd{d|d}d~ddddddddi ddddddddddddddddddddddddddddddddddddiZ'i d dd	ddddd֓ddrdd~ddsddjddddddddړdd ddddddƓdd i ddddddddddddddddddĐdddēdƐdsdddȐd6dddʐd˓d̐d,dd\i ddpddГdddѐd(dҐdӓdԐdOdՐdQd֐dדdؐdCddddTdېdddHdݐdddޓdd@ddi dd<dddddddddddddd
dddddddddddddd?ddddJi dd>dddd ddddddܓddddddMd dddddddddʓddddd	d
i ddddddddddddddddddddddddFddVdd d!d&d"d#d$d%i d&dd'dd(d)d*d+d,d-d.dd/dd0dRd1d̓d2d3d4d5d6dГd7d8d9d:d;dd<dBd=dZ(e'jS                         D  ci c]  \  } }|jU                         |  c}} Z+e(jS                         D  ci c]  \  } }|jU                         |  c}} Z,i d d d	d dd dd dd dd dd dd dd dd dddd	dddd dddd dd i dd dd dddddddddddÐdȓdĐdȓdŐdȓdƐdȓdǐdȓdd dd dʐdd̐dd͐dēi dd dd dd dd dҐdȓdԐdȓdd d֐ddؐddِddڐddېddܐddݐddސddߐdddi ddÓddddddddddddƓddddddddddddœddddddddi ddddddddddddddddddd dddddddɓdd dd dd d	di ddǓddǓddǓdd dd dd dd dd dd dd dd dd dd dd d!d d"d d$d i d&dd'dd(dœd*d d,d d.d d/d d0d d1dǓd2d d4d d6d d7d d9dd;d d<d d=d Z- G d> d?e      Z.e.j_                  ej`                  d@fejb                  dAfejd                  dBfejf                  dCfejh                  dDfejj                  dEfejl                  dFff      dG        Z7e.jq                  ejr                        dH        Z7e.jq                   ejt                  dI            dJ        Z7e.jq                   ejt                  dK            dL        Z7e.jq                  ejv                        dM        Z7yc c}} w c c}} w (O      )sstruct)bytechrbyteord	bytesjoinstrjointobytestostrsafeEvalgetEncoding)newTable)	TTVisitor)ttLibN)C_P_A_L_   )DefaultTableze
		>	# big endian
		platformID:	H
		platEncID:	H
		langID:		H
		nameID:		H
		length:		H
		offset:		H
c                        e Zd ZdZdgZd f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dZed        ZddZ	 ddZ	 ddZddZ xZS )table__n_a_m_ea  Naming table

    The ``name`` table is used to store a variety of strings that can be
    associated with user-facing font information. Records in the ``name``
    table can be tagged with language tags to support multilingual naming
    and can support platform-specific character-encoding variants.

    See also https://learn.microsoft.com/en-us/typography/opentype/spec/name
    ltagc                 2    t         |   |       g | _        y N)super__init__names)selftag	__class__s     jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/_n_a_m_e.pyr   ztable__n_a_m_e.__init__3   s    
    c                    t        j                  d|d d       \  }}}d|t        z  z   }||k7  rt        j	                  d||       ||d  }|dd  }g | _        t        |      D ]  }t        |      dk  rt        j	                  d|       (t        j                  t        |t                     \  }	}||	j                  |	j                  |	j                  z    |	_        |	j                  |	j                  z   t        |      kD  rt        j	                  d|       t        |	j                        |	j                  k(  sJ |	`|	`| j
                  j                  |	        y )N   >HHH   z='name' table stringOffset incorrect. Expected: %s; Actual: %s   z"skipping malformed name record #%d)structunpacknameRecordSizelogerrorr   rangelenr   unpack2nameRecordFormat
NameRecordoffsetlengthstringappend)
r   datattFontformatnstringOffsetexpectedStringOffset
stringDatainames
             r   	decompileztable__n_a_m_e.decompile7   s3   "(--bq"B< 1~#55//IIO$
 ,-(
ABx
qA4y2~		>B )94NJD$$T[[4;;3LMDK{{T[[(3z?:		>Bt{{#t{{222
 T[JJd# r   c                    | j                   }|j                          d}d}t        |      }d|t        j                  t
              z  z   }t        j                  d|||      }d}i }	|D ]{  }
|
j                         }||	v r|	|   \  |
_	        |
_
        n5t        |      t        |      fx\  |
_	        |
_
        |	|<   t        ||g      }|t        j                  t
        |
      z   }} ||z   S )Nr   r   r"   r!   )r   sortr*   r   calcsizer,   r$   packtoBytesr.   r/   r   )r   r3   r   r8   r4   r5   r6   r2   
lastoffsetdoner:   r0   s               r   compileztable__n_a_m_e.compileT   s    




J1w//0@AAA{{7FA|<
D\\^F~+/<(T[:=j/3v;:VV(T[4<&
F';<
',,'7>>D  j  r   c                 J    | j                   D ]  }|j                  ||        y r   )r   toXML)r   writerr3   r:   s       r   rE   ztable__n_a_m_e.toXMLh   s    JJDJJvv& r   c                     |dk7  ry t               }| j                  j                  |       |j                  ||||       y )N
namerecord)r-   r   r1   fromXML)r   r:   attrscontentr3   s        r   rI   ztable__n_a_m_e.fromXMLl   s8    <|

$T5'62r   c                     | j                   D ]G  }|j                  |k(  s|j                  |k(  s#|j                  |k(  s3||j                  |k(  sE|c S  y r   )r   nameID
platformID	platEncIDlangID)r   rM   rN   rO   rP   rH   s         r   getNameztable__n_a_m_e.getNames   sW    **J!!V+))Z7((I5>Z%6%6&%@%% % r   c                     d x}}| j                   D ]C  }|j                  |k7  r	 |j                         }|}|j                  |j
                  fdv sA|} n |r|S |r|S y # t        $ r Y Zw xY w)N))r   r   )   	  )r   rM   	toUnicodeUnicodeDecodeErrorrN   rP   )r   rM   englishNamesomeNamer:   unistrs         r   getDebugNameztable__n_a_m_e.getDebugName~   s    !%%hJJD{{f$) H-1EE$  O & s   A  	A,+A,c                 @    |D ]  }| j                  |      }||c S  y r   )rZ   )r   nameIDsrM   r:   s       r   getFirstDebugNamez table__n_a_m_e.getFirstDebugName   s,    F$$V,D  r   c                 $    | j                  d      S )N)      r   r]   r   s    r   getBestFamilyNamez table__n_a_m_e.getBestFamilyName        %%k22r   c                 $    | j                  d      S )N)         ra   rb   s    r   getBestSubFamilyNamez#table__n_a_m_e.getBestSubFamilyName   rd   r   c                    dD ]z  }t        |      dk(  rP| j                  |d         }| j                  |d         }d ||fv r@| d| }|j                         dk(  r| }|c S | j                  |d         }|x|c S  y )N))r_   rf   )r`   rg   )r   rh   )   )r"   rh   r   r    regular)r*   rZ   lower)r   r\   name_famname_subfamr:   s        r   getBestFullNameztable__n_a_m_e.getBestFullName   s     @G7|q ,,WQZ8"//
;Hk22"1[M2$$&)3&ZD((4#K @ r   c           	      F   t        |t              sKt        |t              rt        j	                  d|       n$t        dt        |      j                  d|      | j                  ||||      }|r||_	        y| j                  j                  t        |||||             y)a   Set the 'string' for the name record identified by 'nameID', 'platformID',
        'platEncID' and 'langID'. If a record with that nameID doesn't exist, create it
        and append to the name table.

        'string' can be of type `str` (`unicode` in PY2) or `bytes`. In the latter case,
        it is assumed to be already encoded with the correct plaform-specific encoding
        identified by the (platformID, platEncID, langID) triplet. A warning is issued
        to prevent unexpected results.
        z7name string is bytes, ensure it's correctly encoded: %rz!expected unicode or bytes, found : N)
isinstancestrbytesr'   warning	TypeErrortype__name__rQ   r0   r   r1   makeName)r   r0   rM   rN   rO   rP   rH   s          r   setNameztable__n_a_m_e.setName   s     &#&&%(Mv  F|,,f6  \\&*iH
 &JJJhvvz9fUVr   c                     d|fd|fd|fd|ffD ci c]
  \  }}||| }}}|sy| j                   D cg c]&  t        fd|j                         D              r( c}| _         yc c}}w c c}w )zRemove any name records identified by the given combination of 'nameID',
        'platformID', 'platEncID' and 'langID'.
        rM   rN   rO   rP   Nc              3   B   K   | ]  \  }}|t        |      k7    y wr   )getattr).0argNameargValuerecs      r   	<genexpr>z-table__n_a_m_e.removeNames.<locals>.<genexpr>   s&      KW6GgxGC11<s   )r   anyitems)	r   rM   rN   rO   rP   r   r   argsr   s	           `r   removeNamesztable__n_a_m_e.removeNames   s     6"z*i(6"	&	
&! # X& 	 	
  zz
! KO::<  !

	

s
   A++A1c                 6   t               }|j                  |        t               }| d   j                  D ]F  }|j                  dk  r|j                  |j
                  vs,|j                  |j                         H |D ]  }| d   j                  |        |S )zlRemove any name records which are not in NameID range 0-255 and not utilized
        within the font itself.r:      )NameRecordVisitorvisitsetr   rM   seenaddr   )r3   visitortoDeleterecordrM   s        r   removeUnusedNamesz table__n_a_m_e.removeUnusedNames   s     $%f5Vn**F }}s"}}GLL0V]]+ + F6N&&v. r   c                     | j                   }dt        |D cg c]  }|j                   c}|dz
  gz         z   }|dkD  rt        d      |S c c}w )zFinds an unused name id.

        The nameID is assigned in the range between 'minNameID' and 32767 (inclusive),
        following the last nameID in the name table.
        r   i  znameID must be less than 32768)r   maxrM   
ValueError)r   	minNameIDr   r5   rM   s        r   _findUnusedNameIDz table__n_a_m_e._findUnusedNameID   sW     

SE2Eq!((E2i!m_DEEE>=>> 3s   A
c                 :   t               }t        |j                               D ]  \  }}|rLt        |d|      }	|	=|j	                  |	j
                  |	j                  |	j                  |	j                  f       |sWt        |d||      }
|
h|j	                  |
j
                  |
j                  |
j                  |
j                  f        t               }| j                  D ]  }	 |j                         |j                  |j                  |j                  f}||v s;|j                  |k\  sK|j                  |j                  t                     }|j	                  |        t        |j                               D ]  \  }}||k(  s|c S  y# t        $ r Y w xY w)u  Return the name ID of an existing multilingual name that
        matches the 'names' dictionary, or None if not found.

        'names' is a dictionary with the name in multiple languages,
        such as {'en': 'Pale', 'de': 'Blaß', 'de-CH': 'Blass'}.
        The keys can be arbitrary IETF BCP 47 language codes;
        the values are Unicode strings.

        If 'windows' is True, the returned name ID is guaranteed
        exist for all requested languages for platformID=3 and
        platEncID=1.
        If 'mac' is True, the returned name ID is guaranteed to exist
        for all requested languages for platformID=1 and platEncID=0.

        The returned name ID will not be less than the 'minNameID'
        argument.
        N)r   sortedr   _makeWindowsNamer   r0   rN   rO   rP   _makeMacNamedictr   rU   rV   rM   
setdefault)r   r   windowsmacr   r3   
reqNameSetlangr:   windowsNamemacNamematchingNameskeynameSetrM   s                  r   findMultilingualNamez#table__n_a_m_e.findMultilingualName  sv   . U
 /JD$.tT4@*NN'..'22'11'..	 &tT4@&NN#NN#..#--#NN	 02 JJD~~'$..$++V j T[[I%='224;;FC    &m&9&9&;<OFG*$  =  & s   %2F	FFc                 \   |*| j                  |||||      }||S | j                         }t        |j                               D ]c  \  }}|r-t	        |||      }	|	| j
                  j                  |	       nd}|s8t        ||||      }
|
I| j
                  j                  |
       e |S )u  Add a multilingual name, returning its name ID

        'names' is a dictionary with the name in multiple languages,
        such as {'en': 'Pale', 'de': 'Blaß', 'de-CH': 'Blass'}.
        The keys can be arbitrary IETF BCP 47 language codes;
        the values are Unicode strings.

        'ttFont' is the TTFont to which the names are added, or None.
        If present, the font's 'ltag' table can get populated
        to store exotic language codes, which allows encoding
        names that otherwise cannot get encoded at all.

        'nameID' is the name ID to be used, or None to let the library
        find an existing set of name records that match, or pick an
        unused name ID.

        If 'windows' is True, a platformID=3 name record will be added.
        If 'mac' is True, a platformID=1 name record will be added.

        If the 'nameID' argument is None, the created nameID will not
        be less than the 'minNameID' argument.
        )r   r   r   r3   T)r   r   r   r   r   r   r1   r   )r   r   r3   rM   r   r   r   r   r:   r   r   s              r   addMultilingualNamez"table__n_a_m_e.addMultilingualNameM  s    2 >..wC9V / F !++-F !/JD$.tVTB*JJ%%k2
 C&tVT6B&JJ%%g. 0 r   c           
      &   t        |      dkD  sJ d       t        |t              s$t        dt	        |      j
                  d|      | j                  |dz         }|D ].  \  }}}| j                  j                  t        |||||             0 |S )aV  Add a new name record containing 'string' for each (platformID, platEncID,
        langID) tuple specified in the 'platforms' list.

        The nameID is assigned in the range between 'minNameID'+1 and 32767 (inclusive),
        following the last nameID in the name table.
        If no 'platforms' are specified, two English name records are added, one for the
        Macintosh (platformID=0), and one for the Windows platform (3).

        The 'string' must be a Unicode string, so it can be encoded with different,
        platform-specific encodings.

        Return the new nameID.
        r   zK'platforms' must contain at least one (platformID, platEncID, langID) tuplezexpected str, found rs   r   )
r*   rt   ru   rx   ry   rz   r   r   r1   r{   )r   r0   	platformsr   rM   rN   rO   rP   s           r   addNameztable__n_a_m_e.addName  s     	NQ	YX	Y&#&04V0E0EvN  ''	A6-6)J	6JJhvvz9fUV .7r   r   )NNNN)r   )TTr   N)NNTTr   )))r   r   r   )rS   r   rT      )rz   
__module____qualname____doc__dependenciesr   r;   rC   rE   rI   rQ   rZ   r]   rc   ri   rq   r|   r   staticmethodr   r   r   r   r   __classcell__)r   s   @r   r   r   &   s     8L$:!('3	*33&W4
2  $
 BF@F RS1fr   r   c                 f    t               }| ||||f\  |_        |_        |_        |_        |_        |S r   )r-   r0   rM   rN   rO   rP   )r0   rM   rN   rO   rP   r:   s         r   r{   r{     s<    <DNJDKdot~t{ Kr   c                     t         j                  |j                               }|t        | |dd|      S t        j                  d|z         y)a  Create a NameRecord for the Microsoft Windows platform

    'language' is an arbitrary IETF BCP 47 language identifier such
    as 'en', 'de-CH', 'de-AT-1901', or 'fa-Latn'. If Microsoft Windows
    does not support the desired language, the result will be None.
    Future versions of fonttools might return a NameRecord for the
    OpenType 'name' table format 1, but this is not implemented yet.
    NrS   r   zacannot add Windows name in language %s because fonttools does not yet support name table format 1)_WINDOWS_LANGUAGE_CODESgetrn   r{   r'   rw   )r:   rM   languagerP   s       r   r   r     sR     %(()9:FfaF33"$,-	

 r   c           	         t         j                  |j                               }t        j                  |      }|/|-t	        d||d      }	 t        | |d      }t        | |d||      S |K|j                  j                  d      }|t        d      x}|d<   t        | |dd	|j                  |            S t        j                  d
|z         y# t        $ r Y qw xY w)u  Create a NameRecord for Apple platforms

    'language' is an arbitrary IETF BCP 47 language identifier such
    as 'en', 'de-CH', 'de-AT-1901', or 'fa-Latn'. When possible, we
    create a Macintosh NameRecord that is understood by old applications
    (platform ID 1 and an old-style Macintosh language enum). If this
    is not possible, we create a Unicode NameRecord (platform ID 0)
    whose language points to the font’s 'ltag' table. The latter
    can encode any string in any language, but legacy applications
    might not recognize the format (in which case they will ignore
    those names).

    'font' should be the TTFont for which you want to create a name.
    If 'font' is None, we only return NameRecords for legacy Macintosh;
    in that case, the result will be None for names that need to
    be encoded with an 'ltag' table.

    See the section “The language identifier” in Apple’s specification:
    https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html
    Nr   ascii)defaultstricterrorsr   r   rk   zUcannot store language %s into 'ltag' table without having access to the TTFont object)_MAC_LANGUAGE_CODESr   rn   _MAC_LANGUAGE_TO_SCRIPTr   r   r{   UnicodeEncodeErrortablesr   addTagr'   rw   )	r:   rM   r   fontmacLang	macScriptencoding_r   s	            r   r   r     s    * "%%hnn&67G'++G4Iy4q)WgF	hx8AD&!Y@@ {{v&<"*6"22D4< faDKK,ABB9;CD	
  " 		s   C 	CCc                   R    e Zd ZddZd Zd Zd ZddZddZeZ	d Z
d Zd	 Zd
 Zy)r-   c                 Z    t        | j                  | j                  | j                  |      S )a  Returns the Python encoding name for this name entry based on its platformID,
        platEncID, and langID.  If encoding for these values is not known, by default
        'ascii' is returned.  That can be overriden by passing a value to the default
        argument.
        )r   rN   rO   rP   )r   r   s     r   r   zNameRecord.getEncoding  s!     4??DNNDKKQQr   c                 (    | j                  d       dv S )N)	utf_16_beucs2ber   latin1r   rb   s    r   encodingIsUnicodeCompatiblez&NameRecord.encodingIsUnicodeCompatible  s    %)SSSr   c                 &    | j                  d      S )Nbackslashreplacer   )toStrrb   s    r   __str__zNameRecord.__str__  s    zz!3z44r   c                 b    | j                   dk(  xs | j                   dk(  xr | j                  dv S )Nr   rS   )r   r   
   )rN   rO   rb   s    r   	isUnicodezNameRecord.isUnicode  s2    !# 
OOq AT^^z%A	
r   c                    d | j                         }| j                  }t        |t              r|dk(  rt	        |      dz  dk(  rwt        |d         dk(  r|dd }n`t        fdt        |      D              rd	|z   }n=t        |d         dk(  r,t        fd
|dd D              rt        d |dd D              }t        |||      }t        fdt        |      D              rdj                  d |ddd   D              }|S )a#  
        If self.string is a Unicode string, return it; otherwise try decoding the
        bytes in self.string to a Unicode string using the encoding of this
        entry as returned by self.getEncoding(); Note that  self.getEncoding()
        returns 'ascii' if the encoding is unknown to the library.

        Certain heuristics are performed to recover data from bytes that are
        ill-formed in the chosen encoding, or that otherwise look misencoded
        (mostly around bad UTF-16BE encoded bytes, or bytes that look like UTF-16BE
        but marked otherwise).  If the bytes are ill-formed and the heuristics fail,
        the error is handled according to the errors parameter to this function, which is
        passed to the underlying decode() function; by default it throws a
        UnicodeDecodeError exception.

        Note: The mentioned heuristics mean that roundtripping a font to XML and back
        to binary might recover some misencoded data whereas just loading the font
        and saving it back will not change them.
        c                 &    | dk\  xr | dk  xs | dv S )N    ~   )	   r       )bs    r   isasciiz%NameRecord.toUnicode.<locals>.isascii  s     I+!t)G5G0GGr   r   rh   r   r   Nc              3   l   K   | ]+  \  }}|d z  rt        |      dk(  n t        |             - ywrh   r   Nr   )r   r9   r   r   s      r   r   z'NameRecord.toUnicode.<locals>.<genexpr>-  s9      -DAq $%q5
aggaj.AA-s   14    c              3   @   K   | ]  } t        |              y wr   r   )r   r   r   s     r   r   z'NameRecord.toUnicode.<locals>.<genexpr>2  s      1-7
#Zs   c              3   J   K   | ]  }d t        t        |            z     yw)r   N)r   r   )r   r   s     r   r   z'NameRecord.toUnicode.<locals>.<genexpr>5  s     "S
15771:+>#>
s   !#r   r   c              3   r   K   | ].  \  }}|d z  dk(  rt        |      dk(  n t        |             0 ywr   )ord)r   r9   cr   s      r   r   z'NameRecord.toUnicode.<locals>.<genexpr>;  s9      
GXtq!1q5A:CFaK73q6?:GXs   47 c              3       K   | ]  }|  y wr   r   )r   r   s     r   r   z'NameRecord.toUnicode.<locals>.<genexpr>@  s     51Qs   )r   r0   rt   rv   r*   r   all	enumerater   r	   join)r   r   r   r0   r   s       @r   rU   zNameRecord.toUnicode  s   (	H ##% vu%K'Fa1$ vbz"a' %f-  #q(S 1-3ABZ1 . #"Sqr
"SSv@  
GPQWGX
 

 WW5qt!t55Fr   c                 N    t        | j                  | j                         |      S )aH  If self.string is a bytes object, return it; otherwise try encoding
        the Unicode string in self.string to bytes using the encoding of this
        entry as returned by self.getEncoding(); Note that self.getEncoding()
        returns 'ascii' if the encoding is unknown to the library.

        If the Unicode string cannot be encoded to bytes in the chosen encoding,
        the error is handled according to the errors parameter to this function,
        which is passed to the underlying encode() function; by default it throws a
        UnicodeEncodeError exception.
        r   )r   r0   r   )r   r   s     r   r@   zNameRecord.toBytesD  s      t{{T-=-=-?OOr   c                    	 | j                         }d| j                  fd| j                  fd| j                  fdt        | j                        fg}|| j                         s|j                  d|d uf       |j                  d|       |j                          ||j                  |       n|j                  | j                         |j                          |j                  d       |j                          y # t        $ r d }Y w xY w)NrM   rN   rO   rP   unicoderH   )rU   rV   rM   rN   rO   hexrP   r   r1   begintagnewlinewrite	write8bitr0   endtag)r   rF   r3   rY   rJ   s        r   rE   zNameRecord.toXMLS  s    	^^%F t{{#4??+$..)s4;;'(	
 >!A!A!CLL)V4%789e,LL T[[)l#) " 	F	s   C; ;D	D	c                    t        |d         | _        t        |d         | _        t        |d         | _        t        |d         | _        t        |      j                         }| j                         }| j                         st        |j                  dd            r|j                  |      | _        y |j                  d      | _        y )NrM   rN   rO   rP   r   Falser   )r
   rM   rN   rO   rP   r   stripr   r   r   encoder0   )r   r:   rJ   rK   r3   sr   s          r   rI   zNameRecord.fromXMLl  s    uX/"5#67!%"45uX/G""$##%++-IIi)2
 ((8,DK ((8,DKr   c                    t        |       t        |      k7  rt        S 	 | j                  | j                  | j                  | j
                  f}|j                  |j                  |j                  |j
                  f}	 || j                         fz   }||j                         fz   }||k  S # t        $ r	 t        cY S w xY w# t        $ r&}t        j                  d|z         Y d }~||k  S d }~ww xY w)Nz'NameRecord sorting failed to encode: %s)ry   NotImplementedrN   rO   rP   rM   AttributeErrorr@   r   r'   r(   )r   other	selfTuple
otherTuplees        r   __lt__zNameRecord.__lt__{  s    :e$!!	"	I   	J	E!T\\^$55I#u}}&88J :%%%  	"
 "!	" " 	E II?!CDD :%%	Es*   AB) <(B> )B;:B;>	C-C((C-c                 N    d| j                   | j                  | j                  fz  S )Nz4<NameRecord NameID=%d; PlatformID=%d; LanguageID=%d>)rM   rN   rP   rb   s    r   __repr__zNameRecord.__repr__  s*    EKKOOKKI
 
 	
r   N)r   )r   )rz   r   r   r   r   r   r   rU   r@   r   rE   rI   r  r  r   r   r   r-   r-     s@    RT5

>@P E2-#&J
r   r-   i6  afi  sqi  gswi^  ami  zar-DZi<  zar-BHi  ari  zar-IQi,  zar-JOi4  zar-KWi0  zar-LBi  zar-LYi  aryi   zar-OMi@  zar-QAi  zar-SAi(  zar-SYi  aebi8  zar-AEi$  zar-YEi+  hyiM  asi,  zaz-Cyrli,  azim  bai-  eui#  beiE  bniE  zbn-INi   zbs-Cyrli  bsi~  bri  bgi  cai  zzh-HKi  zzh-MOi  zhi  zzh-SGi  zzh-TWi  coi  hri  zhr-BAi  csi  dai  prsie  dvi  znl-BEi  nli	  zen-AUi	(  zen-BZi	  zen-CAi	$  zen-029i	@  zen-INi	  zen-IEi	   zen-JMi	D  zen-MYi	  zen-NZi	4  zen-PHi	H  zen-SGi	  zen-ZAi	,  zen-TTi	  zen-GBrT   eni	0  zen-ZWi%  eti8  foid  fili  fii  zfr-BEi  zfr-CAi  fri  zfr-LUi  zfr-MCi  zfr-CHib  fyiV  gli7  kai  zde-ATi  dei  zde-LIi  zde-LUi  zde-CHi  elio  kliG  guih  hai  hei9  hii  hui  isip  igi!  idi]  iui]  ziu-Latni<  gai4  xhi5  zui  iti  zit-CHi  jaiK  kni?  kkiS  kmi  quci  rwiA  swiW  koki  koi@  kyiT  loi&  lvi'  lti.  dsbin  lbi/  mki>  zms-BNi>  msiL  mli:  mti  miiz  arniN  mri|  mohiP  mniP  zmn-CNia  nei  nbi  nni  ociH  oric  psi  pli  pti  zpt-PTiF  paik  zqu-BOik  zqu-ECik  qui  roi  rmi  rui;$  smni;  zsmj-NOi;  smji;  zse-FIi;  sei;  zse-SEi;   smsi;  zsma-NOi;  iO  sai  z
sr-Cyrl-BAi  sri  z
sr-Latn-BAi  zsr-Latnil  nsoi2  tni[  sii  ski$  sli
,  zes-ARi
@  zes-BOi
4  zes-CLi
$  zes-COi
  zes-CRi
  zes-DOi
0  zes-ECi
D  zes-SVi
  zes-GTi
H  zes-HNi
  zes-MXi
L  zes-NIi
  zes-PAi
<  zes-PYi
(  zes-PEi
P  zes-PRi
  esi
  i
T  zes-USi
8  zes-UYi
   zes-VEi  zsv-FIi  sviZ  syri(  tgi_  tzmiI  taiD  ttiJ  tei  thiQ  boi  triB  tki  ugi"  uki.  hsbi   uriC  zuz-CyrliC  uzi*  viiR  cyi  woi  sahix  iiij  yorh   rS   rk      r"         r   nor      r#   r         r`   rg         zzh-Hant   r_   rf                              far   !   "   #   $   %   &   cz'   (   )   yi*   +   ,   -   .   /   0   1   2   zaz-Arab3   4   5   mo6   7   8   9   :   ;   <   ks=   ku>   sd?   @   A   B   C   D   E   F   G   H   I   J   K   L   M   myN   O   P   Q   R   tlS   T   zms-ArabU   V   tiW   omX   soY   Z   [   rn\   ny]   mg^   eo            la      gn   ay         dz   jv   su               gd   gv      to   z
el-polyton         c                       e Zd ZdZd Zy)r   )GSUBGPOSfvarCPALSTATc                 "    t               | _        y r   )r   r   rb   s    r   r   zNameRecordVisitor.__init__  s    E	r   N)rz   r   r   TABLESr   r   r   r   r   r     s    5Fr   r   )SubfamilyNameID)UINameID)ElidedFallbackNameID)
AxisNameID)ValueNameID)FeatureNameID)SettingNameIDc                 :    | j                   j                  |       y r   )r   r   r   objattrvalues       r   r   r     s     LLUr   c                 *   dD ])  }t        ||      }| j                  j                  |       + |j                  dk(  s|j                  dk(  ry | j                  j                  t        |j                  |j                  |j                  z                y )N)FeatUILabelNameIDFeatUITooltipTextNameIDSampleTextNameIDr   )r   r   r   FirstParamUILabelNameIDNumNamedParametersupdater)   r  s       r   r   r     s    TT" U ""a'3+A+AQ+FLL''''#*@*@@	
r   r  c                 D   |j                   D ][  }|j                  dk7  r%| j                  j                  |j                         | j                  j                  |j                         ] |j
                  D ]'  }| j                  j                  |j                         ) y )Ni  )	instancespostscriptNameIDr   r   subfamilyNameIDaxes
axisNameID)r   r  instaxiss       r   r   r     st      F*LLT223--. 
 ) r   r	  c                     |j                   dk(  rK| j                  j                  |j                         | j                  j                  |j                         y y )Nr   )versionr   r  paletteLabelspaletteEntryLabels)r   r  s     r   r   r     sC    
{{aC--.C223 r   c                     t        | d      ry|| _        | j                  D ]   }||v s | j                  ||   g|i | " | `y)Nr   F)hasattrr   r  r   )r   r   r   kwargsr   s        r   r   r     sQ    wGL~~$;GMM$s)5d5f5  	r   r   )<fontTools.miscr   fontTools.misc.textToolsr   r   r   r   r   r	   r
   fontTools.misc.encodingToolsr   fontTools.ttLibr   fontTools.ttLib.ttVisitorr   	fontToolsr   fontTools.ttLib.tables.otTablesr   otTablesfontTools.ttLib.tablesr   r   r   r$   logging	getLoggerrz   r'   r,   r>   r&   r   r{   r   r   objectr-   _WINDOWS_LANGUAGES_MAC_LANGUAGESr   rn   r   r   r   r   register_attrsFeatureParamsSizeFeatureParamsStylisticSetr
  
AxisRecord	AxisValueFeatureNameSettingr   registerFeatureParamsCharacterVariantsgetTableClassTTFont)coder   s   00r   <module>rI     s   "   5 $ /  2 2 +    g!  "!!"23r\.. rj	*1hu
 u
DU
DU
DU EU D	U
 GU GU DU GU GU GU GU GU EU GU GU  G!U" G#U$ E%U& G'U( G)U* D+U, D-U. I/U0 D1U2 D3U4 D5U6 D7U8 D9U: G;U< I=U> D?U@ DAUB DCUD DEUF GGUH GIUJ DKUL GMUN GOUP DQUR DSUT GUUV DWUX DYUZ E[U\ D]U^ G_U` DaUb GcUd GeUf GgUh HiUj GkUl GmUn GoUp GqUr GsUt GuUv GwUx GyUz G{U| G}U~ DU@ GAUB DCUD DEUF EGUH DIUJ GKUL GMUN DOUP GQUR GSUT GUUV DWUX DYUZ D[U\ G]U^ D_U` GaUb GcUd GeUf DgUh DiUj DkUl DmUn DoUp DqUr DsUt DuUv DwUx DyUz D{U| I}U~ DU@ DAUB DCUD DEUF GGUH DIUJ DKUL DMUN DOUP EQUR DSUT DUUV EWUX DYUZ D[U\ D]U^ D_U` DaUb EcUd DeUf DgUh GiUj DkUl DmUn DoUp DqUr EsUt DuUv EwUx DyUz G{U| D}U~ DU@ DAUB DCUD DEUF DGUH DIUJ DKUL GMUN DOUP GQUR GSUT DUUV DWUX DYUZ D[U\ E]U^ H_U` EaUb GcUd DeUf GgUh EiUj HkUl EmUn DoUp LqUr DsUt LuUv IwUx EyUz D{U| D}U~ DU@ DAUB GCUD GEUF GGUH GIUJ GKUL GMUN GOUP GQUR GSUT GUUV GWUX GYUZ G[U\ G]U^ G_U` GaUp DqUr DsUt GuUv GwUx GyUz G{U| D}U~ EU@ DAUB ECUD DEUF DGUH DIUJ DKUL DMUN DOUP DQUR DSUT DUUV EWUX DYUZ I[U\ D]U^ D_U` DaUb DcUd EeUf DgUh DiU pxtxtx tx t	x
 tx tx tx tx tx tx x x x x x  !x" #x$ %x& 'x( 	)x* +x, -x. /x0 1x2 3x4 5x6 7x8 9x: ;x< =x> ?x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd 	exf 	gxh ixj kxl mxn oxp qxr sxt uxv wxx yxz {x| }x~ x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd exf gxh ixj 	kxl mxn oxp qxr sxt uxv wxx yxz {x| }x~ x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd exf gxh ixj kxl mxn oxx *<)A)A)C)C:4DJJL$)C  =K<P<P<RS<RjdDtzz|T)<RS xqxqx qx q	x
 qx qx qx qx qx qx x x x x x  !x" #x$ %x& 'x( )x* +x, -x. /x0 1x2 3x4 5x6 7x8 9x: ;x< =x> ?x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd exf gxh ixj kxl mxn oxp qxr sxt uxv wxx yxz {x| }x~ x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd exf gxh ixj kxl mxn oxp qxr sxt uxv wxx yxz {x| }x~ x@ AxB CxD ExF GxH IxJ KxL MxN OxP QxR SxT UxV WxX YxZ [x\ ]x^ _x` axb cxd exf gxh ixj kxl mxn ox v	  !!		#	#%9:		+	+];	12			o.			-.			12			-.

 HCCD E /E//78* 9* /E//784 94 ELL)	 *	O Ts   f'?f-