�
��g0Y �
� � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
mZ ddlZddl
mZ ddlZ ej e� � Z G d � d
e� � ZdZdZd
ddddddddd� Zefd�Z G d� de� � ZdZ ej e� � ZdZ ej e� � ZdZ ej e� � Z dZ! ej e!� � Z"dZ# ej e#� � Z$ G d� d e� � Z% G d!� d"e%� � Z& G d#� d$e%� � Z' G d%� d&� � Z(d'� Z)d(� Z*d)� Z+ed*k r,ddl,Z,ddl-Z- e,j. e-j/ � � j0 � � dS dS )+a� ttLib/sfnt.py -- low-level module to deal with the sfnt file format.
Defines two public classes:
- SFNTReader
- SFNTWriter
(Normally you don't have to use these classes explicitly; they are
used automatically by ttLib.TTFont.)
The reading and writing of sfnt files is separated in two distinct
classes, since whenever the number of tables changes or whenever
a table's length changes you need to rewrite the whole file anyway.
� )�BytesIO)�SimpleNamespace)�Tag)�sstruct)�
TTLibError�TTLibFileIsCollectionErrorN)�OrderedDictc �J � e Zd Zd� Zd
d�Zd� ZeZd� Zd� Zd� Z d � Z
d
� Zd� ZdS )�
SFNTReaderc �@ � |r�| t u rz|d }|� d� � t |� d� � � � }|� d� � |dk r ddlm} t � |� � S t � | � � S )zmReturn an instance of the SFNTReader sub-class which is compatible
with the input file type.
r � �wOF2)�WOFF2Reader)r �seekr �read�fontTools.ttLib.woff2r �object�__new__)�cls�args�kwargs�infile�sfntVersionr s �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fontTools/ttLib/sfnt.pyr zSFNTReader.__new__ s� � � � 3�C�:�%�%��!�W�F��K�K��N�N�N��f�k�k�!�n�n�-�-�K��K�K��N�N�N��f�$�$�=�=�=�=�=�=��~�~�k�2�2�2��~�~�c�"�"�"� r �����c �> � || _ || _ d | _ d | _ t | _ | j � d� � | j � d� � | _ | j � d� � | j dk r�t | j � � }|j
}d|cxk r|k sn t d|dz
z � � �|| _
| j � |j | � � | j � t � � }t |� � t k rt d� � �t! j t$ || � � n�| j dk rud| _ t&