U
    \	a                     @   sB   d Z ddlZddlmZmZ eddddd	gZed
ddZdS )z
Text layouting utilities.
    N   )KERNING_DEFAULTLOAD_NO_HINTING
LayoutItemchar	glyph_idxxZ	prev_kern)	kern_modec          	      c   sz   d}d}| D ]h}| t|}|dk	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glyph r   ;/tmp/pip-unpacked-wheel-wjyw_3jo/matplotlib/_text_layout.pylayout   s    r   )__doc__ZdataclassesZft2fontr   r   Zmake_dataclassr   r   r   r   r   r   <module>   s    
