a
    Sic	                     @   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)	ft_object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rdkrn ndnd|   krdkrn ndnd|   krdkrn ndnd|   krdkrn ndnd|   krdkrn ndnd|   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rd&krn nd'nd }|rt d(| d) d S )*Nz(Glyph {} ({}) missing from current font.asciinamereplacei  i  Hebrewi   i  Arabici 	  i	  
Devanagarii	  i	  Bengalii 
  i
  Gurmukhii
  i
  Gujaratii   i  Oriyai  i  Tamili   i  Telugui  i  Kannadai   i  	Malayalami  i  Sinhalaz&Matplotlib currently does not support z
 natively.)r   warn_externalformatchrencodedecode)Z	codepointblock r   T/var/www/html/django/DPS/env/lib/python3.9/site-packages/matplotlib/_text_helpers.pywarn_on_missing_glyph   s0         
r!   )	kern_modec                c   s   d}d}| | }|}| D ]v}|||}|t|}|durR||||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   )	_get_fontmapgetget_char_indexordget_kerning
load_glyphr   r   linearHoriAdvance)stringfontr"   r
   Zprev_glyph_idxZchar_to_fontZ	base_fontr   r	   kernglyphr   r   r    layout&   s     
r0   )__doc__dataclasses r   ft2fontr   r   make_dataclassr   r!   r0   r   r   r   r    <module>   s   