o
    li	                     @   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x	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  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)	codepointblock r!   V/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/matplotlib/_text_helpers.pywarn_on_missing_glyph   s2   
r#   )	kern_modec                c   s    d}d}| | }|}| D ];}|||}|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   )	_get_fontmapgetget_char_indexordget_kerning
load_glyphr   r   linearHoriAdvance)stringfontr$   r
   prev_glyph_idxchar_to_font	base_fontr   r	   kernglyphr!   r!   r"   layout&   s$   
r5   )__doc__dataclasses r   ft2fontr   r   make_dataclassr   r#   r5   r!   r!   r!   r"   <module>   s    