o
    j	                     @  sn   d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	 ej
ddG d	d
 d
Zdd ZejdddZdS )z"
Low-level text helper utilities.
    )annotationsN   )_api)FT2FontKerning	LoadFlagsT)frozenc                   @  s6   e Zd ZU ded< ded< ded< ded< ded	< d
S )
LayoutItemr   Z	ft_objectstrcharint	glyph_idxfloatxZ	prev_kernN)__name__
__module____qualname____annotations__ r   r   Y/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/matplotlib/_text_helpers.pyr	      s   
 r	   c              	   C  s  t d|  dt| ddd d| d d|   kr"dkr&n nd	nd
|   kr0dkr4n ndnd|   kr>dkrBn ndnd|   krLdkrPn ndnqd|   krZdkr^n ndncd|   krhdkrln ndnUd|   krvdkrzn ndnGd|   krdkrn ndn9d|   krd krn nd!n+d"|   krd#krn nd$nd%|   krd&krn nd'nd(|   krd)krn nd*nd }|rt d+| d, d S d S )-NzGlyph z (asciinamereplacez) missing from font(s) .i  i  Hebrewi   i  ZArabici 	  i	  Z
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chrencodedecode)	codepointZ	fontnamesblockr   r   r   warn_on_missing_glyph   s4   
r   )	kern_modec                c  s    d}d}| | }|}| D ]<}|||}|t|}|dur*||||d nd}	||	7 }|j|tjd}
t|||||	V  ||
j	d 7 }|}qdS )a  
    Render *string* with *font*.

    For each character in *string*, yield a LayoutItem instance. When such an instance
    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 : Kerning
        A FreeType kerning mode.

    Yields
    ------
    LayoutItem
    r   N@   g        )flagsi   )
Z_get_fontmapgetZget_char_indexordZget_kerningZ
load_glyphr   Z
NO_HINTINGr	   ZlinearHoriAdvance)stringZfontr    r   Zprev_glyph_idxZchar_to_fontZ	base_fontr   r   kernZglyphr   r   r   layout.   s$   
r'   )__doc__
__future__r   dataclasses r   Zft2fontr   r   r   	dataclassr	   r   DEFAULTr'   r   r   r   r   <module>   s    
