B
    Jd                 @   sV   d Z ddlZddlmZ ddlmZmZ edddd	d
g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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	  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   J/var/www/html/venv/lib/python3.7/site-packages/matplotlib/_text_helpers.pywarn_on_missing_glyph   s(         r   )	kern_modec      	      c   s~   d}d}xp| D ]h}| t|}|dk	r:||||d nd}||7 }|j|td}t||||V  ||jd 7 }|}qW 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)	stringZ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   