
    Ph#                     Z    d dl mZ d dlmZ ddlmZ dZdZ G d dej
                        Zy	)
    )sstruct)safeEval   )DefaultTablezJ
		>	# big endian
		tableVersion:           i
		numGlyphs:              H
a~  
		>	# big endian
		maxPoints:              H
		maxContours:            H
		maxCompositePoints:     H
		maxCompositeContours:   H
		maxZones:               H
		maxTwilightPoints:      H
		maxStorage:             H
		maxFunctionDefs:        H
		maxInstructionDefs:     H
		maxStackElements:       H
		maxSizeOfInstructions:  H
		maxComponentElements:   H
		maxComponentDepth:      H
c                   :    e Zd ZdZdgZd Zd Zd Zd Zd Z	d Z
y	)
table__m_a_x_pzMaximum Profile table

    The ``maxp`` table contains the memory requirements for the data in
    the font.

    See also https://learn.microsoft.com/en-us/typography/opentype/spec/maxp
    glyfc                     t        j                  t        ||       \  }}t        | j                        | _        | j
                  dk7  rt        j                  t        ||       \  }}t        |      dk(  sJ y )N P  r   )r   unpack2maxpFormat_0_5int	numGlyphstableVersionmaxpFormat_1_0_addlen)selfdatattFontdummys       jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/_m_a_x_p.py	decompileztable__m_a_x_p.decompile(   s]    oondDAtT^^,
*!//*<dDIKE44yA~~    c                 b   d|v r/|j                  d      r|j                  r| j                  |       n	 t        |j	                               | _        | j                  dk7  rd| _        t        j                  t        |       }| j                  dk(  r|t        j                  t        |       z   }|S )Nr	   r   i   )isLoadedrecalcBBoxesrecalcr   getGlyphOrderr   r   r   packr   r   )r   r   r   s      r   compileztable__m_a_x_p.compile/   s    Vv&6+>+>F#V1134
* *D||ND1
*',,'94@@Dr   c                    |d   }|d   }|d   }t        |      | _        d}|}|}| }| }	d}
d}d}d}d}d}d}|j                         D ](  }||   }|j                  s||   d   |j                  k7  rd}t        ||j                        }t        ||j                        }t        ||j                        }t        |	|j                        }	|j                  dkD  r,|j                         \  }}t        |
|      }
t        ||      }|j                         s|j                  |      \  }}}t        ||      }t        ||      }t        |t        |j                              }t        ||      }+ ||k(  rd|_        d|_        d|_        d|_	        n||_        ||_        ||_        |	|_	        |
| _        || _        || _        || _        || _        || _        |r|j(                  dz  |_        y	|j(                  dz  |_        y	)
zRecalculate the font bounding box, and most other maxp values except
        for the TT instructions values. Also recalculate the value of bit 1
        of the flags field and the font bounding box of the 'head' table.
        r	   hmtxheadi r   r      N)r   r   r   numberOfContoursxMinminyMinmaxxMaxyMaxgetMaxpValuesisCompositegetCompositeMaxpValues
components	maxPointsmaxContoursmaxCompositePointsmaxCompositeContoursmaxComponentElementsmaxComponentDepthflags)r   r   	glyfTable	hmtxTable	headTableINFINITYr'   r)   r+   r,   r1   r2   r3   r4   r5   r6   allXMinIsLsb	glyphNamegnPoints	nContourscomponentDepths                         r   r   ztable__m_a_x_p.recalc=   s&   
 6N	6N	6N	Yyyyy	  --/I)$A!!Y'*aff4#$L4(4(4(4(%%))*):&GY #Iw 7I"%k9"=K]]_9:9Q9Q!:6GY *--?)I&+./CY+O(+./CSEV+W((+,=~(N%) 0* H9ININININ!IN!IN!IN!IN"&"4$8!$8!!2'oo3IO'oo4IOr   c                     t        | j                  j                               }t        d       |D ]  }t        d|z          t        d       y )Nz. . . . . . . . .z  %s: %s)sorted__dict__itemsprint)r   rE   combos      r   testreprztable__m_a_x_p.testrepr|   sB    t}}**,-!"E*u$% !"r   c                    | j                   dk7  r!|j                  d       |j                          t        j                  t
              \  }}}| j                   dk7  r#t        j                  t              \  }}}i ||}|D ]A  }t        | |      }|dk(  rt        |      }|j                  ||       |j                          C y )Nr   z7Most of this table will be recalculated by the compilerr   )value)
r   commentnewliner   	getformatr   r   getattrhex	simpletag)	r   writerr   formatstringnamesfixes	names_1_0namerJ   s	            r   toXMLztable__m_a_x_p.toXML   s    
*NNTUNN%,%6%6~%F"eU
*-4->->?Q-R*L)U*u*	*EDD$'E~%E
T/NN r   c                 6    t        | |t        |d                y )NrJ   )setattrr   )r   rV   attrscontentr   s        r   fromXMLztable__m_a_x_p.fromXML   s    dHU7^45r   N)__name__
__module____qualname____doc__dependenciesr   r    r   rH   rW   r\    r   r   r   r      s/     8L=5~#6r   r   N)	fontTools.miscr   fontTools.misc.textToolsr    r   r   r   r   rb   r   r   <module>rf      s1    " -  $v6\.. v6r   