
    ]Mh                     N    d Z ddlmZ ddlmZmZ d Zd Z G d de          ZdS )	z0ttLib.macUtils.py -- Various Mac-specific stuff.    )BytesIO)ResourceReaderResourceErrorc                     	 t          |           }|                    d          }|                                 |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      X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/fontTools/ttLib/macUtils.pygetSFNTResIndicesr      s]    %%##F++   			s   9< A
Ac                    ddl m} g }t          |           }|s)|                    |                    |                      nH|D ]+}|                    |                    | |                     ,|s|                    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      s      Ed##E IU\\$''(((( 	4 	4ELLdE223333 	I""#@4#GH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                    ddl m} t          |          }t          |t                    r|                    d|          }n|                    d|          }||                    d|z            |                                 || _	        t          t          |                               |j                   || _        d S )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    ######%%'-- 	D**63DEEDD((1BCCD<""#@CT#TUUU	 $''0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 6       ? ? ? ? ? ? ? ?    (         r   