
    ^j)                   "   U d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	m
Z
mZmZmZmZ d dlZd dlmZ d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z! d dl"m#Z# d d	l$m%Z% er<d d
l&m'Z'm(Z(m)Z)m*Z* d dlm+Z+m,Z, d dl"m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5m6Z6 d dl7m8Z8m9Z9  e:ed          oej;        Z<dZ=dZ>dZ?dZ@dZA G d de          ZBd;dZCd;dZDd;dZE ejF        d          ZGd eHd!<   d<d&ZI G d' d(          ZJ G d) d*          ZK G d+ d,eK          ZL G d- d.e          ZM G d/ d0eM          ZN G d1 d2eM          ZO G d3 d4          ZP G d5 d6ej#                  ZQ G d7 d8e#          ZR ed d d d           ZS G d9 d:          ZTdS )=    )annotationsN)ABCabstractmethod)TYPE_CHECKINGAnyCallableClassVarIteratorPatternProtocol)graphics)GlyphPosition)GL_BLENDGL_DEPTH_ATTACHMENTGL_DEPTH_COMPONENTGL_LINES
GL_NEARESTGL_ONE_MINUS_SRC_ALPHAGL_SRC_ALPHAGL_TEXTURE0GL_TRIANGLESglActiveTextureglBindTextureglBlendFunc	glDisableglEnable)Group)runlist)AnchorXAnchorYContentVAlignHorizontalAlign)FontGlyph)Batch)ShaderProgram)
VertexList)Texture)AbstractDocumentInlineElement)AbstractRunIteratorRunIteratoris_pyglet_doc_runa  #version 330 core
    in vec3 position;
    in vec4 colors;
    in vec3 tex_coords;
    in vec3 translation;
    in vec3 view_translation;
    in vec2 anchor;
    in float rotation;
    in float visible;

    out vec4 text_colors;
    out vec2 texture_coords;
    out vec4 vert_position;

    uniform WindowBlock
    {
        mat4 projection;
        mat4 view;
    } window;

    void main()
    {
        mat4 m_rotation = mat4(1.0);
        vec3 v_anchor = vec3(anchor.x, anchor.y, 0);
        mat4 m_anchor = mat4(1.0);
        mat4 m_translate = mat4(1.0);

        m_translate[3][0] = translation.x;
        m_translate[3][1] = translation.y;
        m_translate[3][2] = translation.z;

        m_rotation[0][0] =  cos(-radians(rotation));
        m_rotation[0][1] =  sin(-radians(rotation));
        m_rotation[1][0] = -sin(-radians(rotation));
        m_rotation[1][1] =  cos(-radians(rotation));

        gl_Position = window.projection * window.view * m_translate * m_anchor * m_rotation * vec4(position + view_translation + v_anchor, 1.0) * visible;

        vert_position = vec4(position + translation + view_translation + v_anchor, 1.0);
        text_colors = colors;
        texture_coords = tex_coords.xy;
    }
a  #version 330 core
    in vec4 text_colors;
    in vec2 texture_coords;
    in vec4 vert_position;

    out vec4 final_colors;

    uniform sampler2D text;
    uniform bool scissor;
    uniform vec4 scissor_area;

    void main()
    {
        final_colors = texture(text, texture_coords) * text_colors;
        if (scissor == true) {
            if (vert_position.x < scissor_area[0]) discard;                     // left
            if (vert_position.y < scissor_area[1]) discard;                     // bottom
            if (vert_position.x > scissor_area[0] + scissor_area[2]) discard;   // right
            if (vert_position.y > scissor_area[1] + scissor_area[3]) discard;   // top
        }
    }
a  #version 330 core
    in vec4 text_colors;
    in vec2 texture_coords;
    in vec4 vert_position;

    uniform sampler2D image_texture;

    out vec4 final_colors;

    uniform sampler2D text;
    uniform bool scissor;
    uniform vec4 scissor_area;

    void main()
    {
        final_colors = texture(image_texture, texture_coords.xy);
        if (scissor == true) {
            if (vert_position.x < scissor_area[0]) discard;                     // left
            if (vert_position.y < scissor_area[1]) discard;                     // bottom
            if (vert_position.x > scissor_area[0] + scissor_area[2]) discard;   // right
            if (vert_position.y > scissor_area[1] + scissor_area[3]) discard;   // top
        }
    }
ao  #version 330 core
    in vec3 position;
    in vec4 colors;
    in vec3 translation;
    in vec3 view_translation;
    in vec2 anchor;
    in float rotation;
    in float visible;

    out vec4 vert_colors;
    out vec4 vert_position;

    uniform WindowBlock
    {
        mat4 projection;
        mat4 view;
    } window;

    void main()
    {
        mat4 m_rotation = mat4(1.0);
        vec3 v_anchor = vec3(anchor.x, anchor.y, 0);
        mat4 m_anchor = mat4(1.0);
        mat4 m_translate = mat4(1.0);

        m_translate[3][0] = translation.x;
        m_translate[3][1] = translation.y;
        m_translate[3][2] = translation.z;

        m_rotation[0][0] =  cos(-radians(rotation));
        m_rotation[0][1] =  sin(-radians(rotation));
        m_rotation[1][0] = -sin(-radians(rotation));
        m_rotation[1][1] =  cos(-radians(rotation));

        gl_Position = window.projection * window.view * m_translate * m_anchor * m_rotation * vec4(position + view_translation + v_anchor, 1.0) * visible;

        vert_position = vec4(position + translation + view_translation + v_anchor, 1.0);
        vert_colors = colors;
    }
ah  #version 330 core
    in vec4 vert_colors;
    in vec4 vert_position;

    out vec4 final_colors;

    uniform bool scissor;
    uniform vec4 scissor_area;

    void main()
    {
        final_colors = vert_colors;
        if (scissor == true) {
            if (vert_position.x < scissor_area[0]) discard;                     // left
            if (vert_position.y < scissor_area[1]) discard;                     // bottom
            if (vert_position.x > scissor_area[0] + scissor_area[2]) discard;   // right
            if (vert_position.y > scissor_area[1] + scissor_area[3]) discard;   // top
        }
    }
c                  l    e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded<   ded	<   d
ed<   ddZdS )_LayoutVertexListz2Just a Protocol to add completion for VertexLists.listpositioncolorstranslationview_translationanchorrotationvisibleintcountreturnNonec                    d S N selfs    R/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/text/layout/base.pydeletez_LayoutVertexList.delete   s          Nr:   r;   )__name__
__module____qualname____doc____annotations__rB   r>   rC   rA   r/   r/      sr         <<NNNLLLLLLNNNMMMJJJ!!!!!!rC   r/   r:   r&   c                 h    t           j        j                            t          dft
          df          S )z5The default shader used for all glyphs in the layout.vertexfragment)pygletglcurrent_contextcreate_programlayout_vertex_sourcelayout_fragment_sourcer>   rC   rA   get_default_layout_shaderrS      s2    9$335I84T5KZ4XZ Z ZrC   c                 h    t           j        j                            t          dft
          df          S )zjThe default shader used for an InlineElement image. Used for HTML Labels that insert images via <img> tag.rK   rL   )rM   rN   rO   rP   rQ   layout_fragment_image_sourcer>   rC   rA   get_default_image_layout_shaderrV      s3    9$335I84T5QS]4^` ` `rC   c                 h    t           j        j                            t          dft
          df          S )zQThe default shader for underline and background decoration effects in the layout.rK   rL   )rM   rN   rO   rP   decoration_vertex_sourcedecoration_fragment_sourcer>   rC   rA   get_default_decoration_shaderrZ      s3    9$335Mx4X5OQ[4\^ ^ ^rC   z([-0-9.]+)([a-zA-Z]+)zPattern[str]_distance_redistancestr | floatdpir8   c                x   t          | t                    r| S t          | t                    rt          |           S t                              |           }|sJ d|              |sdS |                                \  }}t          |          }|dk    rt          |          S |dk    rt          ||z  dz            S |dk    rt          ||z  dz            S |dk    rt          ||z            S |d	k    rt          ||z  d
z            S |dk    rt          ||z  dz            S d| }t          |          )zRParse a distance string and return corresponding distance in pixels as an integer.zCould not parse distance r   pxptg      R@pcg      @inmmgc6P(?cmg$d2?zUnknown distance unit )
isinstancer8   floatr[   matchgroups	Exception)r\   r^   rh   valueunitmsgs         rA   _parse_distancern      sX   (C   (E"" 8}}x((E888h88885 q,,..KE4%LLEt||5zzt||53;%&&&t||53;$%%%t||53;t||53;-...t||53;,---
)4
)
)C
C..rC   c                      e Zd ZU ded<   ded<   ded<   dZded	<   d
Zded<   d
Zded<   d
Zded<   d
Zded<   d
Z	ded<   d
Z
ded<   dZded<   dZded<   ded<   ded<   d$dZd%dZd&dZd'd"Zd#S )(_Linelist[_AbstractBox]boxeszlist[VertexList]vertex_listsr8   startleftr"   alignr   margin_leftmargin_rightlengthrg   ascentdescentwidthFboolparagraph_beginparagraph_endxyr:   r;   c                L    || _         d| _        d| _        g | _        g | _        d S Nr   )rt   r   r   rs   rr   )r@   rt   s     rA   __init__z_Line.__init__   s*    



rC   strc                    d| j          dS )Nz_Line())rr   r?   s    rA   __repr__z_Line.__repr__'  s    %
%%%%rC   box_AbstractBoxc                
   | j                             |           | xj        |j        z  c_        t          | j        |j                  | _        t          | j        |j                  | _        | xj        |j        z  c_        d S r=   )	rr   appendry   maxrz   minr{   r|   advancer@   r   s     rA   add_boxz_Line.add_box*  sj    
#sz!$+sz224<55

ck!



rC   layout
TextLayoutc                v    | j         D ]}|                    |           | j                                         d S r=   )rr   rB   rs   clear)r@   r   r   s      rA   rB   z_Line.delete2  sE     : 	 	CJJv!!!!!rC   N)rt   r8   r:   r;   r:   r   r   r   r:   r;   r   r   r:   r;   )rE   rF   rG   rI   rv   rw   rx   ry   rz   r{   r|   r~   r   r   r   r   rB   r>   rC   rA   rp   rp     s.        """"JJJ#E####KLFOOOOFGE!O!!!!M
FFF
FFF   & & & &" " " "
" 
" 
" 
" 
" 
"rC   rp   c                  F    e Zd ZddZedd            Zedd            ZdS )_LayoutContextr   r   documentr)   colors_iterr,   background_iterr+   r:   r;   c                    || _         || _        |                    d          }t          j        ||f          | _        t          j        |                    d          d d          | _        d S )N	underlinebaselinec                
    | d uS r=   r>   rk   s    rA   <lambda>z)_LayoutContext.__init__.<locals>.<lambda>H  s    %t+ rC   r   )r   r   get_style_runsr   ZipRunIteratordecoration_iterFilteredRunIteratorbaseline_iter)r@   r   r   r   r   underline_iters         rA   r   z_LayoutContext.__init__@  sp    &!00==&56WXX$8##J//++Q0 0rC   vertex_listr'   c                    d S r=   r>   r@   r   s     rA   add_listz_LayoutContext.add_listJ      rC   r   r   c                    d S r=   r>   r   s     rA   r   z_LayoutContext.add_boxN  r   rC   N
r   r   r   r)   r   r,   r   r+   r:   r;   )r   r'   r:   r;   r   )rE   rF   rG   r   r   r   r   r>   rC   rA   r   r   ?  sh        0 0 0 0    ^    ^  rC   r   c                  0     e Zd Zd fdZddZddZ xZS )_StaticLayoutContextr   r   r   r)   r   r,   r   r+   r:   r;   c                    t                                          ||||           |j        | _        |j        | _        d S r=   )superr   _vertex_listsrs   _boxesrr   )r@   r   r   r   r   	__class__s        rA   r   z_StaticLayoutContext.__init__U  s9    ;HHH"0]


rC   r   r/   c                :    | j                             |           d S r=   )rs   r   r   s     rA   r   z_StaticLayoutContext.add_list[  s      -----rC   r   r   c                    d S r=   r>   r   s     rA   r   z_StaticLayoutContext.add_box^      rC   r   )r   r/   r:   r;   r   )rE   rF   rG   r   r   r   __classcell__r   s   @rA   r   r   S  se        # # # # # #. . . .       rC   r   c                  >   e Zd ZU dZded<   ded<   ded<   ded<   ded	<   d.dZed/d            Zed0d            Zed1d"            Z	ed2d%            Z
ed3d&            Zed4d'            Zed5d(            Zed6d)            Zed7d*            Zed8d,            Zd-S )9r   z8A box has two cases, A GlyphBox and an InlineElementBox.zTexture | Noneownerrg   rz   r{   r   r8   ry   r:   r;   c                L    d | _         || _        || _        || _        || _        d S r=   )r   rz   r{   r   ry   )r@   rz   r{   r   ry   s        rA   r   z_AbstractBox.__init__j  s)    
rC   r   r   ir   r   zline_xline_yr6   r7   r}   anchor_xanchor_ycontextr   c                    d S r=   r>   r@   r   r   r   r   r   r   r   r6   r7   r   r   r   s                rA   placez_AbstractBox.placeq  s	     	rC   c                    d S r=   r>   r@   r   r   r   s       rA   update_translationz_AbstractBox.update_translationv  r   rC   r2   	list[int]rt   endc                    d S r=   r>   )r@   r2   rt   r   s       rA   update_colorsz_AbstractBox.update_colorsz  r   rC   translate_xtranslate_yc                    d S r=   r>   r@   r   r   s      rA   update_view_translationz$_AbstractBox.update_view_translation~  r   rC   c                    d S r=   r>   r@   r6   s     rA   update_rotationz_AbstractBox.update_rotation  r   rC   c                    d S r=   r>   r@   r7   s     rA   update_visibilityz_AbstractBox.update_visibility  r   rC   c                    d S r=   r>   r@   r   r   s      rA   update_anchorz_AbstractBox.update_anchor  r   rC   c                    d S r=   r>   r@   r   s     rA   rB   z_AbstractBox.delete  r   rC   c                    d S r=   r>   r@   r   s     rA   get_position_in_boxz _AbstractBox.get_position_in_box  r   rC   r1   c                    d S r=   r>   r@   r1   s     rA   get_point_in_boxz_AbstractBox.get_point_in_box  r   rC   N)
rz   rg   r{   rg   r   rg   ry   r8   r:   r;   r   r   r   r8   r   rg   r   rg   r   rg   r   rg   r   rg   r6   rg   r7   r}   r   rg   r   rg   r   r   r:   r;   r   rg   r   rg   r   rg   r:   r;   r2   r   rt   r8   r   r8   r:   r;   r   rg   r   rg   r:   r;   r6   rg   r:   r;   r7   r}   r:   r;   r   rg   r   rg   r:   r;   r   r   rg   r:   r8   r1   r8   r:   rg   )rE   rF   rG   rH   rI   r   r   r   r   r   r   r   r   r   rB   r   r   r>   rC   rA   r   r   b  s        BBMMMNNNNNNKKK       ^    ^    ^    ^    ^    ^    ^    ^    ^    ^  rC   r   c                       e Zd ZU ded<   ded<   ded<   ded<   d	ed
<   d4 fdZd5dZd6d!Zd7d"Zd8d'Zd9d*Z	d:d+Z
d;d,Zd<d-Zd=d.Zd>d0Zd?d1Zd@d3Z xZS )A	_GlyphBoxr(   r   r#   font&list[tuple[int, Glyph, GlyphPosition]]glyphsr8   r   list[_LayoutVertexList]rs   r:   r;   c                    t                                          |j        |j        |t	          |                     |sJ || _        || _        || _        || _        g | _	        dS )a`  Create a run of glyphs sharing the same texture.

        Args:
            owner:
                Texture of all glyphs in this run.
            font:
                Font of all glyphs in this run.
            glyphs:
                Pairs of ``(kern, glyph)``, where ``kern`` gives horizontal
                displacement of the glyph in pixels (typically 0).
            advance:
                Width of glyph run; must correspond to the sum of advances
                and kerns in the glyph list.
            offsets:
                A list of all position transformations done to each glyph.
        N)
r   r   rz   r{   lenr   r   r   r   rs   )r@   r   r   r   r   r   s        rA   r   z_GlyphBox.__init__  s`    " 	dlGS[[IIIu
	rC   r   _LayoutVertexList | VertexListr   r   c                d    | j                             |           |                    |           d S r=   )rs   r   r   )r@   r   r   s      rA   _add_vertex_listz_GlyphBox._add_vertex_list  s3      ---%%%%%rC   r   r   r   r   rg   r   r   r   r   r6   r7   r}   r   r   c                
  4 | j         sJ | j        rJ 	 |j        | j                 }nG# t          $ r: |                    | j        |j        d|j                  }||j        | j        <   Y nw xY w| j        }g }g }d}|}|j	        
                    |||z             D ]$\  }}}|                    |          }t          | j         ||z
  ||z
                     ||z
  k    sJ | j         ||z
  ||z
           D ]\  }}}||z  }|j        \  }}}}|||j        z   z  }|||j        z   z  }|||z   |j        z   z  }|||z   |j        z   z  }|                    t#          t$          ||d||d||d||dg                     |j        }|                    |           ||j        |j        z   z  }||j        z  }||j        z  }Ȑ&g }|j        
                    |||z             D ]O\  }}}|d}t          |          dk    rd| } t1          |           |                    |||z
  dz  z             Pg }!t3          |          D ]#4|!                    4fddD                        $|||f}"|j                            |dz  t6          |!|j        |d	|fd	|"dz  |z  fd
|fd	|fd	|fdz  |z  fd	|	fdz  |z  fd	|
|fdz  |z  f          }#|                     |#|           g }$g }%g }&g }'|| j        z   |z   }(|| j        z   |z   })|}|j         
                    |||z             D ]\  }}}*|*\  }+},|}-| j         ||z
  ||z
           D ]\  }}}|-|j        |z   |j        z   z  }-|+`t          |+          dk    rd|+ } t1          |           |$                    ||(d|-|(d|-|)d||)dg           |%                    |+dz             |,ft          |,          dk    rd|, } t1          |           |&                    |||z   dz
  d|-||z   dz
  dg           |'                    |,dz             |-}|$rt          |$          dz  }.d t3          |.dz            D             }/tC                      }0|0                    |.t6          |/|j        |j"        d	|$fd	|"|.z  fd
|%fd	|f|.z  fd	|	f|.z  fd	|
|f|.z  f          }1|                     |1|           |&rt          |&          dz  }2tC                      }0|0#                    |2tH          |j        |j%        d	|&fd	|"|2z  fd
|'fd	|f|2z  fd	|	f|2z  fd	|
|f|2z  f
  
        }3|                     |3|           d S d S )N   orderparentr   )r   r   r         z6Color requires 4 values (R, G, B, A). Value received: c                     g | ]
}|d z  z   S )r  r>   ).0element	glyph_idxs     rA   
<listcomp>z#_GlyphBox.place.<locals>.<listcomp>  s"    XXX'Gy1}5XXXrC   r   r      r   r     fBn)r1   r3   r2   
tex_coordsr6   r7   r5   zABackground color requires 4 values (R, G, B, A). Value received: z@Underline color requires 4 values (R, G, B, A). Value received: r  r	  c                $    g | ]}d |dz           S )r     r>   )r  r   s     rA   r  z#_GlyphBox.place.<locals>.<listcomp>%  s"    !Y!Y!Y"4QU";!Y!Y!YrC   )r1   r3   r2   r6   r7   r5   )&r   rs   group_cacher   KeyErrorgroup_classprogramgroupry   r   rangesrn   r   verticesx_offsety_offsetextendmaproundr  r   	x_advance	y_advancer   
ValueErrorrangevertex_list_indexedr   batchr   r{   rz   r   rZ   background_decoration_groupr   r   foreground_decoration_group)5r@   r   r   r   r   r   r   r   r6   r7   r   r   r   r  n_glyphsr  r  r   x1rt   r   	baseline_kernglyph	glyph_posv0v1v2v3tr2   colorrm   indices
t_positionr   background_verticesbackground_colorsunderline_verticesunderline_colorsy1y2
decorationbgr   x2bg_countbackground_indicesdecoration_programbackground_listul_countunderline_listr  s5                                                       @rA   r   z_GlyphBox.place  s=   
 {{$$$$	3&tz2EE 	3 	3 	3&&tz6>SYS_&``E-2Ftz***	3 ;
%,%:%A%A!Q\%R%R 	* 	*!E3	--i88Ht{519S1W#4566#+EEEE,0K	#'8I,J * *(uid
!&BBb9---b9---fx')*<<<fx')*<<<EBAr2q"b!RQSUV+W X XYYY$!!!$$$emi&999i))i))* !(!4!;!;Aq8|!L!L 	7 	7E3}&5zzQVuVV oo%MM%C%K1#456666x 	Z 	ZINNXXXXEWXXXYYYYAY
n88A|U\^d^jlqCF/FI:XY>\dKdEeAEvEH*DUCF(WX\dHdBeBE
UVZbGbAcADRZG[^_G_ckFk@l 9 n n 	k7333 !dl"X-dk!H,&-&=&D&DQH&U&U 	 	"E3
&MB	B,0K	#'8I,J A A(uiemd*Y-@@@~r77a<<b^`bbC$S//)#**BAr2q"b!RQSUV+WXXX!((a000$y>>Q&&h]fhhC$S//)"))2v/@1/DaVV^M^abMbde*fggg ''	A666BB 	<.//14H!Y!YU8VW<EXEX!Y!Y!Y!>!@!@0DDX|]oEK\SYSuORTgNhRUWadlWlQmMQSdLeORU]T_bjTjNkNQT[S]`hShMiMPS[]eRfiqRqLr E t tO !!/7;;; 	;-..!3H!>!@!@/;;Hh<BL&JlFIK]E^ILj[cNcHdDHJZC[FIH;YaKaEbEH7*W_J_D`DG(T\I]`hIhCi < k kN !!.':::::	; 	;s   ( AA,+A,c                L    |||f}| j         D ]}||j        z  |j        d d <   d S r=   )rs   r9   r3   )r@   r   r   r   r3   _vertex_lists         rA   r   z_GlyphBox.update_translation>  sI    !Qi - 	K 	KL*58J*JL$QQQ''	K 	KrC   r2   r   rt   r   c                    | j         D ]F}|j        | j        z  }|dk    r/||z
  dz  }||z  dz  }||z  dz  }|d|         |z  |j        ||<   GdS )zUpdate the glyph colors only when specified by a single color attribute in set_style.

        Update just the specific range of glyphs with the colors.
        r  N)rs   r9   ry   r2   )	r@   r2   rt   r   rA  vertices_per_charcolor_end_indexvertex_start_indexvertex_end_indexs	            rA   r   z_GlyphBox.update_colorsC  s     !- 	x 	xL , 2dk A A%%#&;!"3 &+->%>%B"#&):#:Q#>  LRRbSbRbKcfwKw#$67G$GH	x 	xrC   r   r   c                P    | | df}| j         D ]}||j        z  |j        d d <   d S r   )rs   r9   r4   )r@   r   r   r4   rA  s        rA   r   z!_GlyphBox.update_view_translationV  sO    (L;,: - 	U 	UL/?,BT/TL)!!!,,	U 	UrC   c                H    |f}| j         D ]}||j        z  |j        d d <   d S r=   )rs   r9   r6   )r@   r6   rotrA  s       rA   r   z_GlyphBox.update_rotation[  sE    k - 	@ 	@L'*\-?'?L!!!!$$	@ 	@rC   c                H    |f}| j         D ]}||j        z  |j        d d <   d S r=   )rs   r9   r7   )r@   r7   visible_tuplerA  s       rA   r   z_GlyphBox.update_visibility`  sE     
 - 	I 	IL&3l6H&HL ##	I 	IrC   c                J    ||f}| j         D ]}||j        z  |j        d d <   d S r=   )rs   r9   r5   )r@   r   r   r5   rA  s        rA   r   z_GlyphBox.update_anchore  sH    H% - 	A 	AL%+l.@%@L""	A 	ArC   c                t    | j         D ]}|                                 | j                                          d S r=   )rs   rB   r   )r@   r   rA  s      rA   rB   z_GlyphBox.deletej  sD     - 	" 	"L!!!!!!!!!rC   r1   c                j    d}| j         D ](\  }}}|dk    r n|dz  }||j        |z   |j        z   z  })|S )Nr   r   r   r   r  )r@   r1   r   r&  r'  offsets         rA   r   z_GlyphBox.get_point_in_boxp  sV    %)[ 	9 	9!T5&1}}MH%(888AArC   c                    d}d}| j         D ]7\  }}}||z  }||j        z   |j        dz  z   |k    r|c S |dz  }||j        z  }8|S )Nr   r  r   rO  )r@   r   r1   last_glyph_xr&  r'  rP  s          rA   r   z_GlyphBox.get_position_in_boxy  sr    %)[ 	* 	*!T5&D Lem+f.>!.CCaGGMHEM)LLrC   r   c                    d| j          dS )Nz
_GlyphBox(r   )r   r?   s    rA   r   z_GlyphBox.__repr__  s    *DK****rC   )
r   r(   r   r#   r   r   r   r8   r:   r;   )r   r   r   r   r:   r;   r   r   r   r   r   r   r   r   )r1   r8   r:   r8   r   r   )rE   rF   rG   rI   r   r   r   r   r   r   r   r   r   rB   r   r   r   r   r   s   @rA   r   r     s        NNNJJJ2222LLL))))     2& & & &}; }; }; };~K K K K
x x x x&U U U U
@ @ @ @
I I I I
A A A A
" " " "   	 	 	 	+ + + + + + + +rC   r   c                       e Zd ZU ded<   ded<   d+ fdZd,dZd-dZd.dZd/d!Zd0d"Z	d1d#Z
d2d$Zd3d%Zd4d'Zd5d(Zd6d*Z xZS )7_InlineElementBoxr*   r  r}   placedr:   r;   c                    t                                          |j        |j        |j        d           || _        d| _        dS )z,Create a glyph run holding a single element.r   FN)r   r   rz   r{   r   r  rV  )r@   r  r   s     rA   r   z_InlineElementBox.__init__  s;    '/1MMM rC   r   r   r   r8   r   rg   r   r   r   r   r6   r7   r   r   r   r   c                Z    | j                             ||||||||	|
|
  
         d| _        d S )NT)r  r   rV  r   s                rA   r   z_InlineElementBox.place  s8     	61aFFHgxYabbbrC   c                P    | j         r| j                            |||           d S d S r=   )rV  r  r   r   s       rA   r   z$_InlineElementBox.update_translation  s6    ; 	5L++Aq!44444	5 	5rC   r2   r   _start_endc                L    | j         r| j                            |           d S d S r=   )rV  r  update_color)r@   r2   rZ  r[  s       rA   r   z_InlineElementBox.update_colors  s2    ; 	.L%%f-----	. 	.rC   r   r   c                N    | j         r| j                            ||           d S d S r=   )rV  r  r   r   s      rA   r   z)_InlineElementBox.update_view_translation  s7    ; 	KL00kJJJJJ	K 	KrC   c                L    | j         r| j                            |           d S d S r=   )rV  r  r   r   s     rA   r   z!_InlineElementBox.update_rotation  s2    ; 	3L((22222	3 	3rC   c                L    | j         r| j                            |           d S d S r=   )rV  r  r   r   s     rA   r   z#_InlineElementBox.update_visibility  s2    ; 	4L**733333	4 	4rC   c                N    | j         r| j                            ||           d S d S r=   )rV  r  r   r   s      rA   r   z_InlineElementBox.update_anchor  s4    ; 	;L&&x:::::	; 	;rC   c                Z    | j         r#| j                            |           d| _         d S d S )NF)rV  r  remover   s     rA   rB   z_InlineElementBox.delete  s7    ; 	 L'''DKKK	  	 rC   r1   c                     |dk    rdS | j         S r   r   r   s     rA   r   z"_InlineElementBox.get_point_in_box  s    q==1|rC   c                &    || j         dz  k     rdS dS )Nr  r   r   re  r   s     rA   r   z%_InlineElementBox.get_position_in_box  s    t|q   1qrC   r   c                    d| j          dS )Nz_InlineElementBox(r   )r  r?   s    rA   r   z_InlineElementBox.__repr__  s    3DL3333rC   )r  r*   r:   r;   r   r   )r2   r   rZ  r8   r[  r8   r:   r;   r   r   r   r   r   r   r   r   )rE   rF   rG   rI   r   r   r   r   r   r   r   r   rB   r   r   r   r   r   s   @rA   rU  rU    s4        LLL        5 5 5 5. . . .K K K K3 3 3 34 4 4 4; ; ; ;       
      4 4 4 4 4 4 4 4rC   rU  c                  T    e Zd ZU ded<   ded<   ddZddZdd	Zdd
ZddZddZ	dS )_InvalidRanger8   rt   r   r:   r;   c                6    t           j        | _        d| _        d S r   )sysmaxsizert   r   r?   s    rA   r   z_InvalidRange.__init__  s    [
rC   ry   c                    | j         |k    r| xj         |z  c_         | j        |k    r| xj        |z  c_        |                     |||z              d S r=   )rt   r   
invalidate)r@   rt   ry   s      rA   insertz_InvalidRange.insert  sZ    :JJ& JJ8uHHHHuv~.....rC   c                    | j         |k    r| xj         ||z
  z  c_         n| j         |k    r|| _         | j        |k    r| xj        ||z
  z  c_        d S | j        |k    r	|| _        d S d S r=   )rt   r   r@   rt   r   s      rA   rB   z_InvalidRange.delete  s|    :JJ#+%JJJZ%DJ8c>>HHe#HHHHXDHHH rC   c                ~    ||k    rd S t          | j        |          | _        t          | j        |          | _        d S r=   )r   rt   r   r   rq  s      rA   rn  z_InvalidRange.invalidate  s:    %<<FU++
tx%%rC   tuple[int, int]c                V    | j         | j        }}t          j        | _         d| _        ||fS r   )rt   r   rk  rl  rq  s      rA   validatez_InvalidRange.validate  s)    Zs[
czrC   r}   c                "    | j         | j        k    S r=   )r   rt   r?   s    rA   
is_invalidz_InvalidRange.is_invalid  s    x$*$$rC   NrD   )rt   r8   ry   r8   r:   r;   rt   r8   r   r8   r:   r;   )r:   rs  r:   r}   )
rE   rF   rG   rI   r   ro  rB   rn  ru  rw  r>   rC   rA   ri  ri    s         JJJHHH   / / / /   & & & &   % % % % % %rC   ri  c                  R     e Zd ZdZ	 	 dd fdZddZddZddZddZddZ	 xZ
S )TextLayoutGroupzCreate a text layout rendering group.

    The group is created internally when a :py:class:`~pyglet.text.Label`
    is created; applications usually do not need to explicitly create it.
    r   Ntexturer(   r  r&   r   r8   r   graphics.Group | Noner:   r;   c                j    t                                          ||           || _        || _        d S Nr   )r   r   r|  r  )r@   r|  r  r   r   r   s        rA   r   zTextLayoutGroup.__init__  s2    uV444rC   c                   | j                                          d| j         d<   t          t                     t	          | j        j        | j        j                   t          t                     t          t          t                     d S NFscissor)r  user   r   r   r|  targetidr   r   r   r   r   r?   s    rA   	set_statezTextLayoutGroup.set_state  sn    "'Y$$$dl)4<?;;;L"899999rC   c                `    t          t                     | j                                         d S r=   r   r   r  stopr?   s    rA   unset_statezTextLayoutGroup.unset_state	  *    (rC   r   c                0    | j         j         d| j         dS )N(r   )r   rE   r|  r?   s    rA   r   zTextLayoutGroup.__repr__  s     .);;DL;;;;rC   otherobjectr}   c                    |j         | j         u oi| j        |j        u o[| j        j        |j        j        u oC| j        |j        k    o3| j        j        |j        j        k    o| j        j        |j        j        k    S r=   )r   r   r  r  r   r|  r  )r@   r  s     rA   __eq__zTextLayoutGroup.__eq__  s~    4>1 4u|+45=#334 
ek)4 #u}';;	4
 5=#33	5rC   c                    t          t          | j                  | j        j        | j        | j        j        | j        j        f          S r=   )hashr  r   r  r   r|  r  r?   s    rA   __hash__zTextLayoutGroup.__hash__  s5    R__dlotz4<CVX\XdXghiiirC   )r   N)
r|  r(   r  r&   r   r8   r   r}  r:   r;   rD   r   )r  r  r:   r}   r:   r8   )rE   rF   rG   rH   r   r  r  r   r  r  r   r   s   @rA   r{  r{    s          OP15      : : : :   < < < <5 5 5 5j j j j j j j jrC   r{  c                  :     e Zd ZdZ	 	 dd fdZddZddZ xZS )TextDecorationGroupzCreate a text decoration rendering group.

    The group is created internally when a :py:class:`~pyglet.text.Label`
    is created; applications usually do not need to explicitly create it.
    r   Nr  r&   r   r8   r   r}  r:   r;   c                \    t                                          ||           || _        d S r  )r   r   r  )r@   r  r   r   r   s       rA   r   zTextDecorationGroup.__init__#  s+    uV444rC   c                    | j                                          d| j         d<   t          t                     t	          t
          t                     d S r  )r  r  r   r   r   r   r   r?   s    rA   r  zTextDecorationGroup.set_state(  sG    "'YL"899999rC   c                `    t          t                     | j                                         d S r=   r  r?   s    rA   r  zTextDecorationGroup.unset_state/  r  rC   )r   N)r  r&   r   r8   r   r}  r:   r;   rD   )rE   rF   rG   rH   r   r  r  r   r   s   @rA   r  r    s|          =>15      
: : : :       rC   r  c                     e Zd ZU dZded<   ded<   ded<   dZd	ed
<   dZded<   dZded<   eZ	ded<   e
Zded<   dZded<   dZded<   dZded<   dZded<   dZded<   ded<   ded<   ded<   dZded<   dZd ed!<   dZd ed"<   d#Zd$ed%<   d&Zd'ed(<   d)Zd*ed+<   dZded,<   dZded-<   	 	 	 	 	 	 dddEZeddG            ZddHZeddJ            Zej        ddL            ZeddM            Zej        ddN            ZddOZ eddQ            Z!e!j        ddR            Z!eddT            Z"e"j        ddV            Z"eddW            Z#e#j        ddX            Z#ddYZ$eddZ            Z%e%j        dd[            Z%dd\Z&edd]            Z'e'j        dd^            Z'dd_Z(edd`            Z)e)j        dda            Z)ddbZ*ddcZ+edde            Z,e,j        ddg            Z,ddhZ-ddiZ.ddjZ/eddk            Z0e0j        ddm            Z0eddn            Z1eddo            Z2eddp            Z3e3j        ddq            Z3eddr            Z4e4j        dds            Z4eddt            Z5e5j        ddu            Z5eddv            Z6e6j        ddw            Z6eddx            Z7e7j        ddy            Z7eddz            Z8e8j        dd|            Z8edd}            Z9edd~            Z:edd            Z;edd            Z<ddZ=ddZ>ddZ?ddZ@edd            ZAeAj        dd            ZAddZBeCeCfddZDddZEddZFddZGddZHddZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVddZWdS )r   aB  Lay out and display documents.

    This class is intended for displaying documents.

    :py:func:`~pyglet.text.Label` and :py:func:`~pyglet.text.HTMLLabel` provide a convenient interface to this class.

    Some properties may cause the document to be recreated rather than updated. Refer to property documentation for
    details.

    Attributes:
        group_class:
            Default group used to set the state for all glyphs.
        decoration_class:
            Default group used to set the state for all decorations including background colors and underlines.
    r   r   rq   r   zdict[Texture, graphics.Group]r  NzAbstractDocument | None	_documentTr}   _update_enabledF
_own_batchzClassVar[type[TextLayoutGroup]]r  z#ClassVar[type[TextDecorationGroup]]decoration_classr   rg   _ascent_descentr8   _line_count_anchor_left_anchor_bottom_x_y_z	_rotation
int | None_width_heightru   r   	_anchor_xbottomr    	_anchor_ytopr!   _content_valign
_multiline_visibler   r)   r   r   r   r|   heightr   r   r6   	multiliner^   float | Noner   Batch | Noner  r}  r  ShaderProgram | None
wrap_linesinit_documentr:   r;   c                    || _         || _        || _        || _        || _        || _        || _        |	| _        |
| _        |pd| _	        d| _
        d| _        || _        g | _        g | _        g | _        i | _        |                                  |t%          j                    }d| _        || _        |pt-                      | _        || _        |                                  |                     |           |r|                                  dS dS )a  Create a text layout.

        Args:
            document:
                Document to display.
            x:
                X coordinate of the label.
            y:
                Y coordinate of the label.
            z:
                Z coordinate of the label.
            width:
                Width of the layout in pixels, or None
            height:
                Height of the layout in pixels, or None
            anchor_x:
                Anchor point of the X coordinate.
            anchor_y:
                Anchor point of the Y coordinate.
            rotation:
                The amount to rotate the label in degrees. A positive amount
                will be a clockwise rotation, negative values will result in
                counter-clockwise rotation.
            multiline:
                If False, newline and paragraph characters are ignored, and
                text is not word-wrapped.
                If True, text is wrapped only if the `wrap_lines` is True.
            dpi:
                Font resolution; defaults to 96.
            batch:
                Optional graphics batch to add this layout to.
            group:
                Optional Group to parent all internal Groups that this text
                layout uses.  Note that layouts with the same Groups will
                be rendered simultaneously in a Batch.
            program:
                Optional graphics shader to use. Will affect all glyphs in the layout.
            wrap_lines:
                If True and `multiline` is True, the text is word-wrapped using the specified width.
            init_document:
                If True the document will be initialized. If subclassing then
                you may want to avoid duplicate initializations by changing to False.
        `   r   NT)r  r  r  r  r  r  r  r  r  _dpi_content_width_content_height_user_groupr   r   _linesr  _initialize_groupsr   r%   r  _batchrS   _program_wrap_lines_flag_wrap_lines_invariant_set_document_init_document)r@   r   r   r   r   r|   r  r   r   r6   r  r^   r   r  r  r  r  s                    rA   r   zTextLayout.__init__f  s(   d !!!#I2	      !!!=N$$E"DO>#<#>#> *""$$$8$$$ 	"!!!!!	" 	"rC   r   c                ,    | j         r| j        S | j        S r=   )r  _flow_glyphs_wrap_flow_glyphs_single_liner?   s    rA   _flow_glyphszTextLayout._flow_glyphs  s    ? 	*)),,rC   c                    t                      }|                     |d| j                  | _        |                     |d| j                  | _        d S )Nr   r   r  )rZ   r  r  r!  r"  )r@   decoration_shaders     rA   r  zTextLayout._initialize_groups  sZ    9;;+/+@+@ARZ[dhdt+@+u+u(+/+@+@ARZ[dhdt+@+u+u(((rC   Group | Nonec                    | j         S )znGet the Group specified by the user.

        Changing a group will cause the layout to be recreated.
        )r  r?   s    rA   r  zTextLayout.group  s     rC   r   c                    || _         |                                  | j                                         |                                  d S r=   )r  r  r  r   _update)r@   r  s     rA   r  zTextLayout.group  sB     !!!   rC   c                    | j         S )zDocument to display.

        For :py:class:`~pyglet.text.layout.IncrementalTextLayout` it is
        far more efficient to modify a document in-place than to replace
        the document instance on the layout.
        )r  r?   s    rA   r   zTextLayout.document       ~rC   c                X    |                      |           |                                  d S r=   )r  r  r@   r   s     rA   r   zTextLayout.document  s.    8$$$rC   c                    | j         r.| j                             |            |                                  |                    |            || _         d S r=   )r  remove_handlers_uninit_documentpush_handlersr  s     rA   r  zTextLayout._set_document  sS    > 	$N**4000!!###t$$$!rC   r%   c                    | j         S )z|The Batch that this Layout is assigned to.

        If no Batch is assigned, an internal Batch is created and used.
        )r  r?   s    rA   r   zTextLayout.batch  s     {rC   c                    | j         |k    rd S |5t          j                    | _         d| _        |                                  d S |$|| _         d| _        |                                  d S d S )NTF)r  r   r%   r  r  )r@   r   s     rA   r   zTextLayout.batch  sm    ;%F=".**DK"DOLLNNNNNDK#DOLLNNNNN rC   r&   c                    | j         S )zThe ShaderProgram that is assigned to this Layout.

        If set, the shader will impact all Glyphs. InlineElements will not be affected.
        )r  r?   s    rA   r  zTextLayout.program	  s     }rC   shader_programc                V    | j         |k    rd S || _         |                                  d S r=   )r  r  )r@   r  s     rA   r  zTextLayout.program  s,    =N**F&rC   c                    | j         S )zjX coordinate of the layout.

        See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`.
        )r  r?   s    rA   r   zTextLayout.x       wrC   c                0    |                      |           d S r=   )_set_xr   s     rA   r   zTextLayout.x!      ArC   c                <    || _         |                                  d S r=   )r  _update_translationr   s     rA   r  zTextLayout._set_x%  !      """""rC   c                    | j         S )zjY coordinate of the layout.

        See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_y`.
        )r  r?   s    rA   r   zTextLayout.y)  r  rC   c                0    |                      |           d S r=   )_set_yr@   r   s     rA   r   zTextLayout.y1  r  rC   c                <    || _         |                                  d S r=   )r  r  r  s     rA   r  zTextLayout._set_y5  r  rC   c                    | j         S )zZ coordinate of the layout.)r  r?   s    rA   r   zTextLayout.z9  s     wrC   c                0    |                      |           d S r=   )_set_zr@   r   s     rA   r   zTextLayout.z>  r  rC   c                <    || _         |                                  d S r=   )r  r  r  s     rA   r  zTextLayout._set_zB  r  rC   c                    | j         S )a   Rotation of the layout in degrees. Rotated based on the anchor of the layout.

        Negative values will rotate in reverse.

        See :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`, and :py:attr:`~pyglet.text.layout.TextLayout.anchor_y`.
        )r  r?   s    rA   r6   zTextLayout.rotationF  r  rC   c                0    |                      |           d S r=   )_set_rotationr   s     rA   r6   zTextLayout.rotationP      8$$$$$rC   c                <    || _         |                                  d S r=   )r  _update_rotationr   s     rA   r  zTextLayout._set_rotationT  s!    !rC   c                N    | j         D ]}|                    | j                   d S r=   )r   r   r  r   s     rA   r  zTextLayout._update_rotationX  s6    ; 	0 	0C////	0 	0rC   tuple[float, float, float]c                *    | j         | j        | j        fS )zThe (X, Y, Z) coordinates of the layout, as a tuple.

        See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`,
        and :py:attr:`~pyglet.text.layout.TextLayout.anchor_y`.
        )r  r  r  r?   s    rA   r1   zTextLayout.position\  s     w((rC   r1   c                0    |                      |           d S r=   )_set_positionr   s     rA   r1   zTextLayout.positione  r  rC   c                X    |\  | _         | _        | _        |                                  d S r=   )r  r  r  r  r   s     rA   r  zTextLayout._set_positioni  s,    $,!$'  """""rC   c                f    | j         D ](}|                    | j        | j        | j                   )d S r=   )r   r   r  r  r  r   s     rA   r  zTextLayout._update_translationm  s>    ; 	> 	>C""47DGTW====	> 	>rC   c                   |                                  | _        |                                 | _        |                                 }| j        D ]3}| j        }|j        D ]"}|                    ||           ||j        z  }#4d S r=   )	_get_left_anchorr  _get_bottom_anchorr  _get_top_anchorr  rr   r   r   )r@   r   lineacc_anchor_xr   s        rA   _update_anchorzTextLayout._update_anchorq  s     1133"5577''))K 	, 	,D,Lz , ,!!,999+,	, 	,rC   c                    | j         S )z.True if the layout will be visible when drawn.)r  r?   s    rA   r7   zTextLayout.visible}  s     }rC   rk   c                l    || j         k    r&|| _         | j        D ]}|                    |           d S d S r=   )r  r   r   )r@   rk   r   s      rA   r7   zTextLayout.visible  sP    DM!!!DM{ - -%%e,,,,	 "!- -rC   c                    | j         S )a  Calculated width of the text in the layout.

        This is the actual width of the text in pixels, not the
        user defined :py:attr:`~pyglet.text.layout.TextLayout.width`.
        The content width may overflow the layout width if word-wrapping
        is not possible.
        )r  r?   s    rA   content_widthzTextLayout.content_width  s     ""rC   c                    | j         S )zThe calculated height of the text in the layout.

        This is the actual height of the text in pixels, not the
        user defined :py:attr:`~pyglet.text.layout.TextLayout.height`.
        )r  r?   s    rA   content_heightzTextLayout.content_height  s     ##rC   c                    | j         S )a	  The defined maximum width of the layout in pixels, or None.

        If `multiline` and `wrap_lines` is True, the `width` defines where the
        text will be wrapped. If `multiline` is False or `wrap_lines` is False,
        this property has no effect.
        )r  r?   s    rA   r|   zTextLayout.width  s     {rC   c                d    || _         |                                  |                                  d S r=   )r  r  r  r@   r|   s     rA   r|   zTextLayout.width  s,    ""$$$rC   c                    | j         S )a'  The defined maximum height of the layout in pixels, or None.

        When `height` is not None, it affects the positioning of the
        text when :py:attr:`~pyglet.text.layout.TextLayout.anchor_y` and
        :py:attr:`~pyglet.text.layout.TextLayout.content_valign` are
        used.
        )r  r?   s    rA   r  zTextLayout.height  s     |rC   c                <    || _         |                                  d S r=   )r  r  r@   r  s     rA   r  zTextLayout.height  s    rC   c                    | j         S )zSet if multiline layout is enabled.

        If ``multiline`` is False, newline and paragraph characters are ignored and
        text is not word-wrapped.
        If True, the text is word-wrapped only if the ``wrap_lines`` is True.
        )r  r?   s    rA   r  zTextLayout.multiline  s     rC   c                d    || _         |                                  |                                  d S r=   )r  r  r  )r@   r  s     rA   r  zTextLayout.multiline  s,    #""$$$rC   c                    | j         S )a  Horizontal anchor alignment.

        This property determines the meaning of the ``x`` coordinate.

        The following values are supported:

        ``"left"`` (default)
            The X coordinate gives the position of the left edge of the layout.
        ``"center"``
            The X coordinate gives the position of the center of the layout.
        ``"right"``
            The X coordinate gives the position of the right edge of the layout.

        For the purposes of calculating the position resulting from this
        alignment, the width of the layout is taken to be ``width`` if ``multiline``
        is True and ``wrap_lines`` is True, otherwise ``content_width``.
        )r  r?   s    rA   r   zTextLayout.anchor_x  s    & ~rC   c                <    || _         |                                  d S r=   )r  r  )r@   r   s     rA   r   zTextLayout.anchor_x  !    !rC   c                    | j         S )ad  Vertical anchor alignment.

        This property determines the meaning of the ``y`` coordinate.

        The following values are supported:

        ``"top"``
            The Y coordinate gives the position of the top edge of the layout.
        ``"center"``
            The Y coordinate gives the position of the center of the layout.
        ``"baseline"``
            The Y coordinate gives the position of the baseline of the first
            line of text in the layout.
        ``"bottom"`` (default)
            The Y coordinate gives the position of the bottom edge of the layout.

        For the purposes of calculating the position resulting from this
        alignment, the height of the layout is taken to be the smallest of
        ``height`` and ``content_height``.

        See also :py:attr:`~pyglet.text.layout.TextLayout.content_valign`.
        )r  r?   s    rA   r   zTextLayout.anchor_y  s    0 ~rC   c                <    || _         |                                  d S r=   )r  r  )r@   r   s     rA   r   zTextLayout.anchor_y  r  rC   c                    | j         S )a  Vertical alignment of content within larger layout box.

        This property determines how content is positioned within the layout
        box when ``content_height`` is less than ``height``.

        The following values are supported:

        ``top`` (default)
            Content is aligned to the top of the layout box.
        ``center``
            Content is centered vertically within the layout box.
        ``bottom``
            Content is aligned to the bottom of the layout box.

        This property has no effect when ``content_height`` is greater
        than ``height`` (in which case the content is aligned to the top) or when
        ``height`` is ``None`` (in which case there is no vertical layout box
        dimension).
        )r  r?   s    rA   content_valignzTextLayout.content_valign  s    * ##rC   r  c                <    || _         |                                  d S r=   )r  r  )r@   r  s     rA   r  zTextLayout.content_valign  s    -rC   c                     | j         | j        z   S )z0The x-coordinate of the left side of the layout.)r  r  r?   s    rA   ru   zTextLayout.left#  s     w***rC   c                B    | j         | j        }n| j         }| j        |z   S )z1The x-coordinate of the right side of the layout.)r  r  ru   r  s     rA   rightzTextLayout.right(  s*     ;'EEKEy5  rC   c                     | j         | j        z   S )z2The y-coordinate of the bottom side of the layout.)r  r  r?   s    rA   r  zTextLayout.bottom2  s     w,,,rC   c                B    | j         | j        }n| j         }| j        |z   S )z/The y-coordinate of the top side of the layout.)r  r  r  r  s     rA   r  zTextLayout.top7  s*     <)FF\F{V##rC   c                `    | j         o| j        | _        | j        r| j        sJ d            d S d S )NzbWhen the parameters 'multiline' and 'wrap_lines' are True, the parameter 'width' must be a number.)r  r  _wrap_linesr  r?   s    rA   r  z TextLayout._wrap_lines_invariantA  sZ    ?Dt/D# 	qt{ 	q 	qp	q 	q2 	q 	q 	q 	qrC   r\   str | int | float | Nonec                4    |d S t          || j                  S r=   )rn   r  )r@   r\   s     rA   rn   zTextLayout._parse_distanceF  s    4x333rC   c                    d| _         dS )a  Indicate that a number of changes to the layout or document are about to occur.

        Changes to the layout or document between calls to `begin_update` and
        `end_update` do not trigger any costly relayout of text.  Relayout of
        all changes is performed when `end_update` is called.

        Note that between the `begin_update` and `end_update` calls, values
        such as `content_width` and `content_height` are undefined (i.e., they
        may or may not be updated to reflect the latest changes).
        FN)r  r?   s    rA   begin_updatezTextLayout.begin_updateK  s      %rC   c                <    d| _         |                                  dS )zZPerform pending layout changes since `begin_update`.

        See `begin_update`.
        TN)r  r  r?   s    rA   
end_updatezTextLayout.end_updateX  s    
  $rC   c                    | j         S )zGet DPI used by this layout.)r  r?   s    rA   r^   zTextLayout.dpi`  s     yrC   c                <    || _         |                                  d S r=   )r  r  )r@   rk   s     rA   r^   zTextLayout.dpie  s    	rC   c                    | j         D ]}|                    |            | j                                         | j                                          dS )z:Deletes all vertices and boxes associated with the layout.N)r   rB   r   r   r   s     rA   rB   zTextLayout.deletej  sW    ; 	 	CJJt  """rC   
min_filter
mag_filterr(   c                   t           j                                        }| j        }t	          t          | j                            }t	          t          | j                            }t           j        j        	                    ||||          }t           j        j
                            ||t                    }|                    |           |                    |t                     d| j        z
  d| j        z
  df| _        |                                 |                                  |                                 || _        |S )a  Utilizes a :py:class:`~pyglet.image.framebuffer.Framebuffer` to draw the current layout into a texture.

        .. warning:: Usage is recommended only if you understand how texture generation affects your application.
            Improper use will cause texture memory leaks and performance degradation.

        .. note:: Does not include InlineElements.

        Returns:
            A new texture with the layout drawn into it.

        .. versionadded:: 2.0.11
        )r+  r,  )
attachmentr   )rM   imageFramebufferr1   r8   r  r  r  r(   createbufferRenderbufferr   attach_textureattach_renderbufferr   r  r  binddrawunbind)	r@   r+  r,  framebuffertemp_posr|   r  r|  depth_buffers	            rA   get_as_texturezTextLayout.get_as_texturer  s    l..00=E$-..//U4/0011,&--eV
_i-jj|*77vGYZZ""7+++''AT'UUUT..D4G0GK		 rC   c                    | j         r| j                                         dS | j                            | j                   dS )a6  Draw this text layout.

        .. note:: This method performs very badly if a batch was supplied to the constructor.
            If you add this layout to a batch, you should ideally use only the batch's draw method.

        .. note:: If this is not its own batch, InlineElements will not be drawn.

        N)r  r  r7  draw_subsetr   r?   s    rA   r7  zTextLayout.draw  sG     ? 	8KK##D$677777rC   list[_Line]c           	     z   t          | j        j                  }|                                 \  }}t	          j        |d           }|                     ||d|           t          |                     |||d|                    }d| _	        t          |          | _
        |                     |d| j
                   |S r   )r   r  text_get_glyphsr   RunList_get_owner_runsr0   r  r  r  _flow_lines)r@   len_textr   offsets
owner_runsliness         rA   
_get_lineszTextLayout._get_lines  s    t~*++**,,_Xt44
ZH===T&&vw
AxPPQQu::4#3444rC   c           
        | j         sd S | j        D ]}|                    |            | j                                         | j                                         | j                                         | j                                         | j        r| j        j        sd| _	        d| _
        d| _        d| _        d S |                                 | _        | j        d         j        | _	        | j        d         j        | _
        | j                            d          }| j                            d          }|                                 | _        |                                 | _        |                                 }t)          | | j        ||          }| j        D ]U}| j                            |j                   |                     |j        |j        | j        ||j        |j        |           Vd S )Nr   r.  background_color)r  r   rB   r   r   r  r  r  rA  r  r  r  r  rJ  rz   r{   r   r  r   r  r   r  rr   _create_vertex_listsr   r   rt   )r@   r   r   r   
anchor_topr   r  s          rA   r  zTextLayout._update  s   # 	F; 	 	CJJt  """   ~ 	T^%8 	DLDM !D"#DFoo''{1~,A.n33G<<.778JKK 1133"5577))++
&tT^[/ZZK 	v 	vDKtz***%%dfdfd6GUYU_aeakmtuuuu	v 	vrC   rt   r   c                v   | j                             d          }g }|                    ||          D ]!\  }}}|                    |||z
  z             "d}| j        D ]Z}	|	j        }
||
z   |k    rC||k     r=t          d||z
            }t          |
||z
            }|	                    |||           ||
z  }[d S )Nr.  r   )	r  r   r  r  r   ry   r   r   r   )r@   rt   r   r   r2   
iter_startiter_endr.  
char_indexr   
box_length	box_startbox_ends                rA   _update_colorzTextLayout._update_color  s    n33G<<+6+=+=eS+I+I 	; 	;'J%MM%8j#89::::
 ; 	% 	%CJJ&..:3C3C5:#566	j#
*:;;!!&)W===*$JJ	% 	%rC   c                    | j         r| j        r| j        n| j        }n| j        }| j        dk    rdS | j        dk    r|dz   S | j        dk    r| S d}t          |          )z0Returns the anchor for the X axis from the left.ru   r   centerr  r  z7`anchor_x` must be either "left", "center", or "right".)r  r!  r  r  r  rj   )r@   r|   rm   s      rA   r  zTextLayout._get_left_anchor  s|    ? 	(#'#3LDKK9LEE'E>V##1>X%%aZ= >W$$6MGnnrC   c                   | j         
| j        }d}n{| j         }| j        dk    rd}nf| j        dk    rt          d| j         | j        z
            }n=| j        dk    r!t          d| j         | j        z
            dz  }nd}t	          |          | j        dk    r| S | j        dk    r
| j        |z
  S | j        dk    r||z
  S | j        dk    r/| j        d	k    r| j         | j        dz  | j        d
z  z
  S |dz  |z
  S d}t	          |          )z/Returns the anchor for the Y axis from the top.Nr   r  r  rX  r  =`content_valign` must be either "top", "bottom", or "center".r   r   r  C`anchor_y` must be either "top", "bottom", "center", or "baseline".)	r  r  r  r   rj   r  r  r  r  r@   r  rP  rm   s       rA   r  zTextLayout._get_top_anchor  s=   <)FFF\F#u,,%11Qt/C CDD%11Qt/C CDDIUnn$>U""7N>Z''<&((>X%%F?">X%%1$$)=|q(4=A+===Q;''SnnrC   c                   | j         
| j        }d}n{| j         }| j        dk    rt          d| j         | j        z
            }nK| j        dk    rd}n=| j        dk    r!t          d| j         | j        z
            dz  }nd}t	          |          | j        dk    r| |z   S | j        dk    r| | j        z   S | j        dk    rdS | j        dk    r2| j        d	k    r| j         | j        dz  | j        d
z  z
  |z
  S ||dz  z
  S d}t	          |          )z2Returns the anchor for the Y axis from the bottom.Nr   r  r  rX  r  rZ  r   r   r  r[  )	r  r  r  r   rj   r  r  r  r  r\  s       rA   r   zTextLayout._get_bottom_anchor  sE   <)FFF\F#u,,Qt/C CDD%11%11Qt/C CDDIUnn$>U""7V##>Z''7T\))>X%%1>X%%1$$)=)DMQ,>>&HHFaK''SnnrC   c                .    |                                   d S r=   )r  r?   s    rA   r  zTextLayout._init_document6  s    rC   c                    d S r=   r>   r?   s    rA   r  zTextLayout._uninit_document9  r   rC   rA  r   c                .    |                                   dS )zEvent handler for `AbstractDocument.on_insert_text`.

        The event handler is bound by the text layout; there is no need for
        applications to interact with this method.
        Nr  )r@   rt   rA  s      rA   on_insert_textzTextLayout.on_insert_text<       	rC   c                .    |                                   dS )zEvent handler for `AbstractDocument.on_delete_text`.

        The event handler is bound by the text layout; there is no need for
        applications to interact with this method.
        Nra  rq  s      rA   on_delete_textzTextLayout.on_delete_textD  rc  rC   
attributesdict[str, Any]c                    t          |          dk    rd|v r|                     ||           dS |                                  dS )zEvent handler for `AbstractDocument.on_style_text`.

        The event handler is bound by the text layout; there is no need for
        applications to interact with this method.
        r   r.  N)r   rV  r  )r@   rt   r   rf  s       rA   on_style_textzTextLayout.on_style_textL  sS     z??aGz$9$9uc*****!!!!!rC   =tuple[list[_InlineElementBox | Glyph], list[tuple[int, int]]]c                ,   g }g }t          j        | j                            | j                  | j                                        f          }| j        j        }|                    dt          |                    D ]\  }}\  }}|r=|	                    t          |                     |	                    t                     H|                    |||                   \  }	}
|                    |	           |                    |
           ||fS )Nr^   r   )r   r   r  get_font_runsr  get_element_runsrA  r  r   r   rU  
_empty_pos
get_glyphsr  )r@   r   rG  runsrA  rt   r   r   r  char_glyphschar_offsetss              rA   rB  zTextLayout._get_glyphsX  s   %N((TY(77N++--'/ 0 0 ~"+/;;q#d))+D+D 	- 	-'E3w -/88999z****,0OODsO,L,L)\k***|,,,,wrC   rH  runlist.RunListr   list[_InlineElementBox | Glyph]c                    ||         j         }|}t          |||                   D ]6\  }}||j         k    r&|                    |||z   |           |j         }||z   }7|                    |||           d S r=   )r   	enumerateset_run)	r@   rH  r   rt   r   r   	run_startr   r'  s	            rA   rD  zTextLayout._get_owner_runsj  s    u#	 "&s"344 	& 	&HAu##""9a%i???I	9c511111rC   rG  list[GlyphPosition]Iterator[_Line]c           
   #    K   |                                                     ||          }| j                            | j                  }t          j        | j                            d          d d          }| j        -t          j	        t          | j        j                  d          }	n/t          j        | j                            d          d d          }	t          j        | j                            d	          d
 d          }
t          j        | j                            d          d d          }t          j        | j                            d          d d          }t          j        | j                            d          d d          }t          j        | j                            d          d g           }t          |          }||         |_        |                     |
|                   |_        |                     ||                   |_        |dk    s| j        j        |dz
           dv r0d|_        |xj        |                     ||                   z  c_        |	|         }| j        r| j        |j        z
  |j        z
  }d}g }d}d}d }|D ]\  }}}||         }g }d}g }d}d}|}t)          | j        j        ||         |||         |||                   D ]6\  }}} |rd}!d}n|                     ||                   }!|dk    r|dv r|D ]}"|                    |"           g }d}|dk    rg||         D ]'}#|                     |#          }#|#||j        z   k    r n(d}$||j        z   |$z  dz   |$z  }#t-          |#|z
  |j        z
  |j        z
            }!|                    |!|| f           |                    |           |||j        z   |!z   | j        z   z  }||j        |!z   | j        z   z  }g }d}||j        |!z   | j        z   z  }|dz  }|}%<|dv }&|dk    p|&}'|r | j        r||!z   |j        z   | j        z   |k    s|'r|'s|dk    rU|D ]}"|                    |"           g }d}|                    |           ||z  }g }d}|xj        dz  c_        |}%|'r|%dz  }%|r)|                    t9          ||||                     g }d}|'r|j        s|j        |_        |j        |_        |j        s|'r*|xj         |z  c_         |&rd|_!        |V  	 t          |%          }||%         |_        |                     |
|%                   |_        |                     ||%                   |_        n# tD          $ r Y   d S w xY w|&rd|_        |rKtG          |d          r;|j$        r4|d         j$        d         \  }(})d|)tJ          f|d         j$        d<   ||(z  }n#|r|d         \  }(})}*d|)tJ          f|d<   ||(z  }nd}||z   }| j        r| j        |j        z
  |j        z
  }tM          |tN                    r:|                    |           ||j        | j        z   z  }||j        | j        z   z  }n|&rP|	|%         }|xj        |                     ||%                   z  c_        | j        r| j        |j        z
  |j        z
  }nD|'sB|                    |!|| f           ||j        |!z   | j        z   z  }||j        |!z   | j        z   z  }|dz  }d}8|r%|                    t9          ||||                     |r*|                    t9          ||||                     ||z  }|D ]}"|                    |"           |j        s;|!| j        (                    d| j                  }|j        |_        |j        |_        |V  d S )Nrl  rv   c                
    | dv S N)ru   r  rX  r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    5LgCg rC   ru   Fwrapc                
    | dv S )N)TFcharwordr>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    eOlFl rC   Trw   c                
    | d uS r=   r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    VZIZ rC   r   rx   c                
    | d uS r=   r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    %W[J[ rC   indentc                
    | d uS r=   r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    EQUDU rC   kerningc                
    | d uS r=   r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>      URVEV rC   	tab_stopsc                
    | d uS r=   r>   r   s    rA   r   z.TextLayout._flow_glyphs_wrap.<locals>.<lambda>  s    uTXGX rC   r   u   
 r  u    ​		g      I@u    r   ))get_run_iteratorr  r  rm  r  r   r   r   r  ConstRunIteratorr   r   rA  rp   rv   rn   rw   rx   r~   r!  zipr   r8   r   r   r  r  ry   r   rr   rz   r{   r|   r   
IndexErrorhasattrr   ro  rf   r   get_font)+r@   r   rG  rH  rt   r   owner_iteratorfont_iteratoralign_iteratorwrap_iteratormargin_left_iteratormargin_right_iteratorindent_iteratorkerning_iteratortab_stops_iteratorr  r  r|   r   	run_accumrun_accum_widtheol_wsr   r   owner_accumowner_accum_widthowner_accum_commitowner_accum_commit_widthnokernindexrA  r'  rP  r&  runtab_stoptab
next_startnew_paragraphnew_linekg_s+                                              rA   r  zTextLayout._flow_glyphs_wrapw  s	      $4466==eSII444CC 4T^5R5RSZ5[5[5g5g5;= = ;#4S9K5L5LeTTMM#78U8UV\8]8]8l8l8<> >M  ':4>;X;XYf;g;g;Z;Z\] _  _ ' ;DN<Y<YZh<i<i<[<[]^!` !`!5dn6S6ST\6]6]6U6UWXZ Z"6t~7T7TU^7_7_7V7VXY[ [$89V9VWb9c9c9X9XZ\^ ^U||#E*
//0DU0KLL 001Fu1MNNA::+EAI6*DD#'D  4 4_U5K L LLU# 	GK$"22T5FFE  	  !/ h	5 h	5E3 'D K !
 "$'($ F E
 *-T]-?c	-JFSXY\S\L]_fglmpgp_q)r)r I I%uf ID"FF//0@0GHHD6>>d.>&>&>( * *S)))) "I&'Ot||(:5(A S SH'+';';H'E'EH'!d.>*>>> %  ? #&C*+d.>*>3)F!(Ks'RH"8a<$2B#BU]#RSS&&eV'<===&--k:::,0AEM0QTX0X[a[k0kk,emd2V5EEEF"$K()%-0@@@AQJE
 "'JJ$(J$6M $ 0B]H I[!1 I[a$h6NQWQa6aej6j6jow6j
 $ 0tv~~ (1 2 2 $S 1 1 1 1(*I./O.55kBBB48II4*,K01- KK1,KK).J' 0 *a
 . 9 LL5$@RTl)m)mnnn13.784# 8DJ 8 +/+DK+/<DL  : ![ ![ JJ&0JJ, :59 2"&JJJ	'',Z'8'8-;J-G
373G3GH\]gHh3i3i 0484H4HI^_iIj4k4k 1 1#- ' ' ' !'	'
  - <7; 4  ) 	.WY-I-I 	.iN^ 	.'0|':1'=1:;Q
9K	! 3A 6 /1 4!, .*5a.1a23Q
1CA 1Q 6 1 1)- /2C CA#/ [(,d6F(FIZ(Z!%66 E!((///'5=6;K+KKU]V-===& E,Z8((D,@,@Q[A\,],]]((+ W$(K$2B$BTEV$VE% E $**D%+@AAA)U]T-AFDT-TT)U]T1F4DDDQJEFF " cYud4FH`aabbb 5  5$EV!W!WXXX#44  	 	CLLz 	(|~..qdi.@@+DK<DL




s   /AV
VVc           	   #    K   |                                                     ||          }| j                            | j                  }t          j        | j                            d          d d          }t          |          }	|d         }
| j	        r<t          j        | j
                            d          d d          }||         |	_        |D ]\  }}}||         }
d}g }|                    ||          D ]\  }}}|||         }|||         }|t          d |D                       z  }||||z
  z  z  }|t          d	 |D                       z  }|                    t          |g||z
  z  ||                     ||D ]\  }}}|	                    |           |	                    t!          ||
||                     |	j        s|
j        |	_        |
j        |	_        d
x|	_        |	_        |	V  d S )Nrl  r  c                
    | d uS r=   r>   r   s    rA   r   z5TextLayout._flow_glyphs_single_line.<locals>.<lambda>k  s    %tBS rC   r   rv   c                
    | dv S r~  r>   r   s    rA   r   z5TextLayout._flow_glyphs_single_line.<locals>.<lambda>s  s    e'BB rC   ru   c                    g | ]	}|j         
S r>   re  )r  r  s     rA   r  z7TextLayout._flow_glyphs_single_line.<locals>.<listcomp>~  s    444Aai444rC   c                    g | ]	}|j         
S r>   )r  )r  os     rA   r  z7TextLayout._flow_glyphs_single_line.<locals>.<listcomp>  s    666aak666rC   T)r  r  r   rm  r  r   r   r   rp   r  r  rv   sumr  r  r   r   rr   rz   r{   r~   r   )r@   r   rG  rH  rt   r   r  r  kern_iteratorr  r   r  r   r|   owner_glyphs
kern_startkern_endr&  gsosr  r'  s                         rA   r  z#TextLayout._flow_glyphs_single_lined  sY      $4466==eSII33	3BB3DM4P4PQZ4[4[4S4SUVX X U||Q; 	/$8--g66BB N (.DJ!/ 	J 	JE3 'DEL.;.B.B5#.N.N S S*
HdJx/0Z0144444555J!677662666777##C(Z2G(H"b$Q$QRRRR}#/ ( (KAuaLL''''( YudL%HHIIIIz 	(+DK<DL488t1




rC   rI  c                   t          j        | j                            d          d d          }t          j        | j                            d          d d          }| j                            d          }t          j        | j                            d          d d          }|dk    rd}n||d	z
           }	|                     ||	j                           }
|                     ||	j                           }|	j        }|

||	j        z  }|	j        r#||                     ||	j                           z  }|}||d          D ]}	|	j	        rd||                     ||	j                           z  }|                     ||	j                           }
|                     ||	j                           }n||z  }|
||	j
        z  }n||
z  }|	j        d
k    s|	j        | j        k    r|	j        |	_        nb|	j        dk    r0| j        |	j        z
  |	j        z
  |	j        z
  dz  |	j        z   |	_        n'|	j        dk    r| j        |	j        z
  |	j        z
  |	_        t!          | j        |	j        |	j        z             | _        |	j        |k    r||k    r nL||	_        |

||	j        z  }|	j        r#||                     ||	j                           z  }|d	z  }| | _        |S )N
margin_topc                
    | d uS r=   r>   r   s    rA   r   z(TextLayout._flow_lines.<locals>.<lambda>  s    UYHY rC   r   margin_bottomc                
    | d uS r=   r>   r   s    rA   r   z(TextLayout._flow_lines.<locals>.<lambda>  s    5X\K\ rC   line_spacingleadingc                
    | d uS r=   r>   r   s    rA   r   z(TextLayout._flow_lines.<locals>.<lambda>  r  rC   r   ru   rX  r  r  )r   r   r  r   rn   rt   r   r{   r   r~   rz   rv   r|   rw   r   rx   r   r  r  )r@   rI  rt   r   margin_top_iteratormargin_bottom_iteratorline_spacing_iteratorleading_iteratorr   r  r  r  
line_indexs                rA   rE  zTextLayout._flow_lines  s   %9$.:W:WXd:e:e:Y:Y[\^ ^!(!<T^=Z=Z[j=k=k=\=\^_"a "a $ = =n M M"6t~7T7TU^7_7_7V7VXY[ [ A::AA#D//0Edj0QRRL**+;DJ+GHHGA#T\!! NT))*@*LMMM
%&&M #	& #	&D# T))*=dj*IJJJ#334I$*4UVV../?
/KLLW#T[ \!zV##tzDJ'>'>)x''*t'77$:KKdjX]^^aeaqqw&&d&77$*D"%d&94:HX;X"Y"YDv{{zS00 DF#T\!! NT))*@*LMMM!OJJ$%2D rC   r   r   r   rr   r   r   c                    |}|D ]O}	|	                     | || j        | j        | j        ||| j        | j        |||           ||	j        z  }||	j        z  }Pd S r=   )r   r  r  r  r  r  ry   r   )
r@   r   r   r   r   r   rr   r   r  r   s
             rA   rM  zTextLayout._create_vertex_lists  su     	( 	(CIIdAtw&&$.Z^Zgiu) ) )OACK'LL		( 	(rC   c                    | j         S )z+Get the number of lines in the text layout.)r  r?   s    rA   get_line_countzTextLayout.get_line_count  s    rC   )r   r   r   NNru   r  r   FNNNNTT)"r   r)   r   rg   r   rg   r   rg   r|   r  r  r  r   r   r   r    r6   rg   r  r}   r^   r  r   r  r  r}  r  r  r  r}   r  r}   r:   r;   )r:   r   rD   )r:   r  )r  r   r:   r;   )r:   r)   )r   r)   r:   r;   )r:   r%   )r   r  r:   r;   r:   r&   )r  r&   r:   r;   )r:   rg   )r   rg   r:   r;   )r   rg   r:   r;   )r   rg   r:   r;   r   )r:   r  )r1   r  r:   r;   ry  )rk   r}   r:   r;   r  )r:   r  )r|   r  r:   r;   )r  r  r:   r;   )r  r}   r:   r;   )r:   r   )r   r   r:   r;   )r:   r    )r   r    r:   r;   )r:   r!   )r  r!   r:   r;   )r\   r"  r:   r  )rk   rg   r:   r;   )r+  r8   r,  r8   r:   r(   )r:   r?  rx  )rt   r8   rA  r   r:   r;   )rt   r8   r   r8   rf  rg  r:   r;   )r:   rj  )
rH  rt  r   ru  rt   r8   r   r8   r:   r;   )r   ru  rG  rz  rH  rt  rt   r8   r   r8   r:   r{  )rI  r?  rt   r8   r   r8   r:   r8   )r   rg   r   rg   r   rg   r   rg   r   r8   rr   rq   r   r   r:   r;   )XrE   rF   rG   rH   rI   r  r  r  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   propertyr  r  r  setterr   r  r   r  r   r  r   r  r   r  r6   r  r  r1   r  r  r  r7   r  r
  r|   r  r  r   r   r  ru   r  r  r  r  rn   r%  r'  r^   rB   r   r<  r7  rJ  r  rV  r  r  r   r  r  rb  re  ri  rB  rD  r  r  rE  rM  r  r>   rC   rA   r   r   7  s	          +***....)-I---- O    J3BKBBBB<OOOOOGHKLNIIIIIIIIIIFGI!I!!!!%*O****JH 9:@D]^Z^VZ@D[" [" [" [" ["z - - - X-
v v v v
       X  \   \    X _   _" " " "    X \   \    X ^   ^    X X   X# # # #    X X   X# # # #    X X   X# # # #    X _% % % _%       0 0 0 0 ) ) ) X) _% % % _%# # # #> > > >
, 
, 
, 
,    X ^- - - ^- # # # X# $ $ $ X$    X \   \
    X ]   ]    X    
    X( _   _    X2 _   _ $ $ $ X$,     + + + X+ ! ! ! X! - - - X- $ $ $ X$q q q q
4 4 4 4
% % % %       X 	Z   Z    .8     <8 8 8 8	 	 	 	#v #v #v #vJ% % % %*   "   B   B            
" 
" 
" 
"   $2 2 2 2k k k kZ+ + + +Z< < < <|( ( ( (           rC   r   r  )r\   r]   r^   r8   r:   r8   )U
__future__r   rerk  abcr   r   typingr   r   r   r	   r
   r   r   rM   r   pyglet.font.baser   	pyglet.glr   r   r   r   r   r   r   r   r   r   r   r   r   r   pyglet.graphicsr   pyglet.textr   pyglet.customtypesr   r    r!   r"   r#   r$   r%   pyglet.graphics.shaderr&   pyglet.graphics.vertexdomainr'   pyglet.imager(   pyglet.text.documentr)   r*   pyglet.text.runlistr+   r,   r  r-   _is_pyglet_doc_runrQ   rR   rU   rX   rY   r/   rS   rV   rZ   compiler[   rI   rn   rp   r   r   r   r   rU  ri  r{  r  ro  r   r>   rC   rA   <module>r     s   " " " " " " " 				 



 # # # # # # # #                         * * * * * *                                 " ! ! ! ! !       ESSSSSSSSSSSS,,,,,,,,%%%%%%444444777777$$$$$$DDDDDDDDDDDDDDDDWS"566P3;P * V ,  0' P ," " " " " " " "Z Z Z Z` ` ` `^ ^ ^ ^ (RZ(@AA A A A A   >1" 1" 1" 1" 1" 1" 1" 1"h       (    >   6 6 6 6 63 6 6 6rj+ j+ j+ j+ j+ j+ j+ j+Z<4 <4 <4 <4 <4 <4 <4 <4~(% (% (% (% (% (% (% (%V'j 'j 'j 'j 'jhn 'j 'j 'jT    %   2 ]1aA&&
d  d  d  d  d  d  d  d  d  d rC   