a
    ëÝEbø  ã                   @   sR   d Z ddlZddlmZ ddlmZmZ e dg d¢¡Zdd	„ Z	ed
œdd„Z
dS )z"
Low-level text helper utilities.
é    Né   )Ú_api)ÚKERNING_DEFAULTÚLOAD_NO_HINTINGÚ
LayoutItem)ÚcharÚ	glyph_idxÚxZ	prev_kernc              	   C   s®  t  d | t| ƒ dd¡ d¡¡¡ d|   kr8dkrBn nd�nNd|   krVdkr`n nd	�n0d
|   krtdkr~n nd�nd|   kr’dkršn ndnöd|   kr®dkr¶n ndnÚd|   krÊdkrÒn ndn¾d|   krædkrîn ndn¢d|   k�rdk�rn ndn‚d|   k�r&dk�r.n ndnbd|   k�rFd k�rNn nd!nBd"|   k�rfd#k�rnn nd$n"d%|   k�r†d&k�rŽn nd'nd }|�rªt  d(|› d)�¡ d S )*Nz(Glyph {} ({}) missing from current font.ÚasciiÚnamereplacei�  iÿ  ÚHebrewi   iÿ  ÚArabici 	  i	  Ú
Devanagarii€	  iÿ	  ZBengalii 
  i
  ZGurmukhii€
  iÿ
  ZGujaratii   i  ZOriyai€  iÿ  ZTamili   i  ZTelugui€  iÿ  ZKannadai   i  Z	Malayalami€  iÿ  ZSinhalaz&Matplotlib currently does not support z
 natively.)r   Zwarn_externalÚformatÚchrÚencodeÚdecode)Ú	codepointÚblock© r   úX/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/matplotlib/_text_helpers.pyÚwarn_on_missing_glyph   s0    þÿ     ô
ÿr   )Ú	kern_modec          	      c   sz   d}d}| D ]h}|  t|ƒ¡}|dur8| |||¡d nd}||7 }|j|td�}t||||ƒV  ||jd 7 }|}qdS )a¾  
    Render *string* with *font*.  For each character in *string*, yield a
    (glyph-index, x-position) pair.  When such a pair is yielded, the font's
    glyph is set to the corresponding character.

    Parameters
    ----------
    string : str
        The string to be rendered.
    font : FT2Font
        The font.
    kern_mode : int
        A FreeType kerning mode.

    Yields
    ------
    glyph_index : int
    x_position : float
    r   Né@   g        )Úflagsi   )Zget_char_indexÚordZget_kerningZ
load_glyphr   r   ZlinearHoriAdvance)	ÚstringÚfontr   r	   Zprev_glyph_idxr   r   ÚkernZglyphr   r   r   Úlayout&   s    ÿÿr   )Ú__doc__ÚdataclassesÚ r   Zft2fontr   r   Úmake_dataclassr   r   r   r   r   r   r   Ú<module>   s   ÿ