
    Mcg                     F    d Z ddlmZ ddlmZmZ d Zd Z G d de      Zy)	z0ttLib.macUtils.py -- Various Mac-specific stuff.    )BytesIO)ResourceReaderResourceErrorc                     	 t        |       }|j                  d      }|j                          |S # t        $ r g cY S w xY w)z;Determine whether a file has a 'sfnt' resource fork or not.sfnt)r   
getIndicescloser   )pathreaderindicess      S/var/www/html/bid-api/venv/lib/python3.12/site-packages/fontTools/ttLib/macUtils.pygetSFNTResIndicesr      sC    %##F+ 	s   -0 >>c                     ddl m} g }t        |       }|s"|j                  |j	                  |              |S |D ]#  }|j                  |j	                  | |             % |s|j                  d| z        |S )a  Given a pathname, return a list of TTFont objects. In the case
    of a flat TTF/OTF file, the list will contain just one font object;
    but in the case of a Mac font suitcase it will contain as many
    font objects as there are sfnt resources in the file.
    r   ttLibzno fonts found in file '%s')	fontToolsr   r   appendTTFont
TTLibError)r
   r   fontssfntsindexs        r   openTTFontsr      sw      Ed#EU\\$'( L	 ELLdE23 ""#@4#GHHL    c                   "     e Zd ZdZ fdZ xZS )SFNTResourceReaderz3Simple read-only file wrapper for 'sfnt' resources.c                 4   ddl m} t        |      }t        |t              r|j                  d|      }n|j                  d|      }||j                  d|z        |j                          || _	        t        t        | 3  |j                         || _        y )Nr   r   r   zsfnt resource not found: %s)r   r   r   
isinstancestrgetNamedResourcegetIndResourcer   r	   rsrcsuperr   __init__dataname)selfr
   res_name_or_indexr   r   r"   	__class__s         r   r$   zSFNTResourceReader.__init__)   s    #%'-**63DED((1BCD<""#@CT#TUU	 $0;	r   )__name__
__module____qualname____doc__r$   __classcell__)r)   s   @r   r   r   &   s    = r   r   N)	r-   ior   fontTools.misc.macResr   r   r   r   r    r   r   <module>r2      s$    6  ?( r   