
    Ph                         d dl mZ d dlmZmZ d dlmZmZmZ d dl	m
Z
mZmZ d dl	mZ d dlmZmZ ddlmZ d d	lZ ej*                  e      Zd
Z G d dej&                        Zy	)    )sstruct)floatToFixedToStrstrToFixedToFloat)safeEval
num2binary
binary2num)timestampFromStringtimestampToStringtimestampNow)
epoch_diff)intRect	unionRect   )DefaultTableNa  
		>	# big endian
		tableVersion:       16.16F
		fontRevision:       16.16F
		checkSumAdjustment: I
		magicNumber:        I
		flags:              H
		unitsPerEm:         H
		created:            Q
		modified:           Q
		xMin:               h
		yMin:               h
		xMax:               h
		yMax:               h
		macStyle:           H
		lowestRecPPEM:      H
		fontDirectionHint:  h
		indexToLocFormat:   h
		glyphDataFormat:    h
c                   0    e Zd ZdZg dZd Zd Zd Zd Zy)table__h_e_a_dzFont Header table

    The ``head`` table contains a variety of font-wide information.

    See also https://learn.microsoft.com/en-us/typography/opentype/spec/head
    )maxplocaCFF CFF2c                 X   t        j                  t        ||       \  }}|rt        j	                  d       |dk(  sJ dD ]i  }t        | |      }|dkD  r(t        j	                  d|       |dz  }t        | ||       |dk  sBt        j	                  d|       |dz  }t        | ||       k y )Nz&extra bytes at the end of 'head' tables     createdmodifiedl    z/'%s' timestamp out of range; ignoring top bytesi%|z:'%s' timestamp seems very low; regarding as unix timestamp)r   unpack2
headFormatlogwarninggetattrsetattr)selfdatattFontdummyreststampvalues          jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/_h_e_a_d.py	decompileztable__h_e_a_d.decompile1   s    ooj$=tKK@A7?"? +ED%(Ez!MuU#eU+z!PRW #eU+ +    c                 B   |j                   rd|v rK|d   j                  j                  d   }t        |j                        \  | _        | _        | _        | _        nd|v r|d   j                  j                  d   }|j                  }d }|j                         D ]'  }|j                  |      }||t        ||      }&|}) |$t        |      \  | _        | _        | _        | _        |j                  rt               | _        t!        j"                  t$        |       }|S )Nr   r   r   )recalcBBoxescfftopDictIndexr   FontBBoxxMinyMinxMaxyMaxCharStringsvalues
calcBoundsr   recalcTimestampr   r   r   packr   )r!   r#   topDictcharStringsfontBBox
charStringboundsr"   s           r(   compileztable__h_e_a_d.compileJ   s
    .,,99!<=DWEUEU=V:	49di6! .,,99!<%11"-"4"4"6J'22;?F)#/'06'BH'-H #7 'AHAR>DIty$)TY!!(NDM||J-r*   c                    |j                  d       |j                          t        j                  t              \  }}}|D ]  }t        | |      }||v rt        |||         }nG|dv rt        |      }n7|dv r#|dk  r|dz   }t        |      }|dd  dk(  r|d d }n|d	v rt        |d
      }|j                  ||       |j                           y )Nz7Most of this table will be recalculated by the compilerprecisionBitsr   )magicNumbercheckSumAdjustmentr   l        LmacStyleflags   )r'   )commentnewliner   	getformatr   r   r   r
   hexr   	simpletag)r!   writerr#   _namesfixesnamer'   s           r(   toXMLztable__h_e_a_d.toXMLb   s    PQ!++J75%DD$'Eu})%uT{K00)%0>>19!K/EE
:$!#2JE.."5"-T/NN r*   c                     |d   }t        j                  t              d   }||v rt        |||         }n+|dv rt	        |      }n|dv rt        |      }nt        |      }t        | ||       y )Nr'      r@   r   rF   )r   rL   r   r   r	   r   r   r    )r!   rS   attrscontentr#   r'   rR   s          r(   fromXMLztable__h_e_a_d.fromXMLw   sr    g!!*-a05=%e5;GE,,'.E**u%EUOEdE"r*   N)	__name__
__module____qualname____doc__dependenciesr)   r>   rT   rY    r*   r(   r   r   '   s"     4L,20*#r*   r   )fontTools.miscr   fontTools.misc.fixedToolsr   r   fontTools.misc.textToolsr   r   r   fontTools.misc.timeToolsr	   r
   r   r   mac_epoch_difffontTools.misc.arrayToolsr   r    r   logging	getLoggerrZ   r   r   r   r_   r*   r(   <module>ri      sY    " J E E 
 B 8   g!
,[#\.. [#r*   