o
    :a                     @   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rdkr n ndnd|   kr*dkr.n nd	nd
|   kr8dkr<n ndnd|   krFdkrJn ndnqd|   krTdkrXn ndncd|   krbdkrfn ndnUd|   krpdkrtn ndnGd|   kr~d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 {} ({}) missing from current font.asciinamereplacei  i  Z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formatchrencodedecode)Z	codepointblock r   :/usr/lib/python3/dist-packages/matplotlib/_text_helpers.pywarn_on_missing_glyph   s2   
r   )	kern_modec          	      c   s|    d}d}| D ]4}| t|}|dur||||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)	stringZfontr   r	   Zprev_glyph_idxr   r   ZkernZglyphr   r   r   layout&   s   r   )__doc__Zdataclasses r   Zft2fontr   r   Zmake_dataclassr   r   r   r   r   r   r   <module>   s    