
    Ph                         d dl mZ d dlmZ ddlmZ ddlmZmZm	Z	m
Z
 ddlmZmZmZ d dlZ G d d	ej                        Zd
 Z G d de      Z G d dee      Z G d dee      Z G d de      ZeeedZy)    )	bytesjoin)sstruct   )E_B_D_T_)BigGlyphMetricsbigGlyphMetricsFormatSmallGlyphMetricssmallGlyphMetricsFormat)BitmapGlyphBitmapPlusSmallMetricsMixinBitmapPlusBigMetricsMixinNc                       e Zd ZdZdZd Zy)table_C_B_D_T_a/  Color Bitmap Data table

    The ``CBDT`` table contains color bitmap data for glyphs. It must
    be used in concert with the ``CBLC`` table.

    It is backwards-compatible with the monochrome/grayscale ``EBDT`` table.

    See also https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt
    CBLCc                 t    	 t         j                  j                  | |      S # t        $ r t        |   cY S w xY w)N)r   table_E_B_D_T_getImageFormatClassKeyErrorcbdt_bitmap_classes)selfimageFormats     jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\fontTools/ttLib/tables/C_B_D_T_.pyr   z"table_C_B_D_T_.getImageFormatClass&   s:    	4**>>t[QQ 	4&{33	4s   " 77N)__name__
__module____qualname____doc__locatorNamer        r   r   r      s     K4r   r   c                 "    t        |       } | d= | S )Nrow)dict)dataFunctionss    r   _removeUnsupportedForColorr$   /   s    'Mer   c                   4    e Zd ZdZ eej                        Zy)ColorBitmapGlyphz.pngN)r   r   r   fileExtensionr$   r   xmlDataFunctionsr   r   r   r&   r&   5   s    M1+2N2NOr   r&   c                       e Zd Zd Zd Zy)cbdt_bitmap_format_17c                    t               | _        t        j                  t        | j
                  | j                        \  }}t        j                  d|d d       \  }|dd  }|t        |      k  sJ d       |d | | _	        y )N>L   zData overun in format 17)
r	   metricsr   unpack2r
   datastructunpacklen	imageDatar   dummyr0   dataLens       r   	decompilezcbdt_bitmap_format_17.decompile;   su    (*oo&=tyy$,,Wt]]4bq2
ABx #d)#?%??#hwr   c                 (   g }|j                  t        j                  t        | j                               |j                  t        j                  dt        | j                                     |j                  | j                         t        |      S Nr,   )	appendr   packr
   r.   r1   r3   r4   r   r   ttFontdataLists      r   compilezcbdt_bitmap_format_17.compileE   s^    %<dllKLD#dnn*=>?'""r   Nr   r   r   r8   r@   r   r   r   r*   r*   :       (#r   r*   c                       e Zd Zd Zd Zy)cbdt_bitmap_format_18c                    t               | _        t        j                  t        | j
                  | j                        \  }}t        j                  d|d d       \  }|dd  }|t        |      k  sJ d       |d | | _	        y )Nr,   r-   zData overun in format 18)
r   r.   r   r/   r   r0   r1   r2   r3   r4   r5   s       r   r8   zcbdt_bitmap_format_18.decompileN   su    &(oo&;TYYUt]]4bq2
ABx #d)#?%??#hwr   c                 (   g }|j                  t        j                  t        | j                               |j                  t        j                  dt        | j                                     |j                  | j                         t        |      S r:   )	r;   r   r<   r   r.   r1   r3   r4   r   r=   s      r   r@   zcbdt_bitmap_format_18.compileX   s^    %:DLLIJD#dnn*=>?'""r   NrA   r   r   r   rD   rD   M   rB   r   rD   c                       e Zd Zd Zd Zy)cbdt_bitmap_format_19c                     t        j                  d| j                  d d       \  }| j                  dd  }|t        |      k  sJ d       |d | | _        y )Nr,   r-   zData overun in format 19)r1   r2   r0   r3   r4   )r   r7   r0   s      r   r8   zcbdt_bitmap_format_19.decompilea   sR    ]]42A7
yy}#d)#?%??#hwr   c                 n    t        j                  dt        | j                              | j                  z   S r:   )r1   r<   r3   r4   )r   r>   s     r   r@   zcbdt_bitmap_format_19.compileh   s%    {{4T^^!45FFr   NrA   r   r   r   rH   rH   `   s    (Gr   rH   )         )fontTools.misc.textToolsr   fontTools.miscr    r   BitmapGlyphMetricsr   r   r	   r
   r   r   r   r1   r   r   r$   r&   r*   rD   rH   r   r   r   r   <module>rR      s    / "   
 4X,, 40P{ P
#79I #&#57G #&	G, 	G 	 r   