
z=]c           @  s  d  d l  m Z d  d l Z d  d l Z d  d l m Z m Z m Z m	 Z	 d  d l j
 j Z d  d l j
 j Z d  d l j
 j Z d  d l j
 j Z d  d l m Z m Z m Z m Z d Z d e f d     YZ d   Z d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ  d Z! i  a" i  a# i  a$ i  a% d   Z& g  a' d   Z( e j) j* j+ d d  d d  Z, e j) j* j+ d d d  d  Z- d e j) j. j/ f d     YZ0 e j1 Z1 e j2 Z2 d S(   i(   t   print_functionN(   t   TAGt   TEXTt	   PARAGRAPHt   DISPLAYABLE(   t   log2vist   WRTLt   RTLt   ONi  t   Blitc           B  s/   e  Z d  Z d e e e e d  Z d   Z RS(   s   
    Represents a blit command, which can be used to render a texture to a
    render. This is a rectangle with an associated alpha.
    g      ?c
   
      C  sU   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ |	 |  _ d  S(   N(	   t   xt   yt   wt   ht   alphat   leftt   rightt   topt   bottom(
   t   selfR
   R   R   R   R   R   R   R   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   __init__-   s    								c         C  s(   d j  |  j |  j |  j |  j |  j  S(   Ns   <Blit ({0}, {1}, {2}, {3}) {4}>(   t   formatR
   R   R   R   R   (   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   __repr__<   s    (   t   __name__t
   __module__t   __doc__t   FalseR   R   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR	   '   s   c         C  s7  |  j  d d    d } d } d } d } g  } x |  D] } | j } | j | j | d }	 | j }
 | j | j | d } | d 8} | |
 k r |
 } | } d } n  | }
 | | k r | } n  | | k r | } n  |	 } | j t | |
 |	 | | |
 | j d | j d | j	 d | j
 d	 | j  q8 W| S(
   s  
    Given a list of blits, adjusts it for the given outline size. That means
    adding borders on the left and right of each line of blits. Returns a second
    list of blit objects.

    We assume that there are a discrete set of vertical areas that divide the
    original blits, and that no blit covers two vertical areas. So something
    like:

     _____________________________________
    |_____________________________________|
    |___________|_________________|_______|
    |_____________________|_______________|

    is fine, but:

     _____________________________________
     |              |_____________________|
     |______________|_____________________|

    is forbidden. That's an invariant that the blit_<method> functions are
    required to enforce.
    t   keyc         S  s   |  j  |  j f S(   N(   R   R
   (   t   b(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   <lambda>Z   s    i    i   i   R   R   R   R   (   t   sortR
   R   R   R   t   appendR	   R   R   R   R   R   (   t   blitst   outlinet   line_yt   top_yt   bottom_yt   max_xt   rvR   t   x0t   x1t   y0t   y1(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   outline_blits@   s0    		
			Rt   DrawInfoc           B  s   e  Z d  Z RS(   s  
    This object is supplied as a parameter to the draw method of the various
    segments. It has the following fields:

    `surface`
        The surface to draw to.

    `override_color`
        If not None, a color that's used for this outline/shadow.

    `outline`
        The amount to outline the text by.

    `displayable_blits`
        If not none, this is a list of (displayable, xo, yo) tuples. The draw
        method adds displayable blits to this list when this is not None.
    (   R   R   R   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR,      s   t   TextSegmentc           B  sY   e  Z d  Z d	 d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   sb   
    This represents a segment of text that has a single set of properties
    applied to it.
    c         C  s  | d k	 r | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j	 |  _	 | j
 |  _
 | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ n$ d |  _ d |  _ t |  _ t |  _ d S(   s   
        Creates a new segment of text. If `source` is given, this starts off
        a copy of that source segment. Otherwise, it's up to the code that
        creates it to initialize it with defaults.
        i    N(   t   Nonet	   antialiast   verticalt   fontt   sizet   boldt   italict	   underlinet   strikethrought   colort   black_colort	   hyperlinkt   kerningt   cpst   ruby_topt   ruby_bottomt   hintingt   outline_colorR   (   R   t   source(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR      s,    			c         C  s   d j  |  j   S(   Ns   <TextSegment font={font}, size={size}, bold={bold}, italic={italic}, underline={underline}, color={color}, black_color={black_color}, hyperlink={hyperlink}, vertical={vertical}>(   R   t   __dict__(   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR      s    c         C  s.  | j  |  _  | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j } t | t	  r | j
 |  |  _ n | j r d |  _ n	 d |  _ | j
 | j  |  _ | j |  _ | j |  _ d |  _ | j | j  |  _ d |  _ | j t k rt j j j |  _ n  |  j | j |  _ d S(   sS   
        Takes the style of this text segment from the named style object.
        i   i    N(   R/   R0   R1   R2   R3   R4   R>   R5   t
   isinstancet   intt	   scale_intR6   R7   R8   R.   R9   t   scaleR:   R?   t   slow_cpst   Truet   renpyt   gamet   preferencest   text_cpsR;   t   slow_cps_multiplier(   R   t   stylet   layoutR5   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt
   take_style   s,    					c      
   C  s   t  j |  j  |  j |  j |  j d |  j |  j |  j | j 	 } | j	 |  } |  j
 rm t j
 | |  j
  n  |  j r x | D] } |  j | _ q} Wn  |  j r t j |  n8 |  j d k r t j |  n |  j r t j |  n  | S(   sN   
        Return the list of glyphs corresponding to unicode string s.
        i    t   alt(   R1   t   get_fontR2   R3   R4   R/   R0   R>   t
   oversamplet   glyphsR:   t   textsupportR9   R=   t   mark_ruby_bottomR<   t   mark_altruby_topt   mark_ruby_top(   R   t   sRN   t   foR&   t   g(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRS      s    ?				c   	   
   C  s   | j  r$ |  j p | j  } d } n |  j } |  j } t j |  j |  j |  j |  j	 | j
 |  j |  j |  j | j 	 } | j | j | | | | |  j |  j |  d S(   s+   
        Draws the glyphs to surf.
        N(   t   override_colorR?   R.   R7   R8   R1   RQ   R2   R3   R4   R!   R/   R0   R>   RR   t   drawt   surfaceR5   R6   (	   R   RS   t   dit   xot   yoRN   R7   R8   RY   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR\     s    				Bc         C  s   t  j | |  j |  S(   s   
        Assigns times to the glyphs. `gt` is the starting time of the first
        glyph, and it returns the starting time of the first glyph in the next
        segment.
        (   RT   t   assign_timesR;   (   R   t   gtRS   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRa     s    c   	      c  s   |  j  } t j j j } | d k	 rZ t j j j | d  } | d k	 rZ | |  } qZ n  t	 | t  j
  s{ |  | f Vd Si  } xh | j |  D]W \ } } | j | d  } | d k r t |   } | | _  | | | <n  | | f Vq Wd S(   s/  
        This is called to break the current text segment up into multiple
        text segments. It yields one or more(TextSegement, string) tuples
        for each sub-segment it creates.

        This is used by the FontGroup code to create new text segments based
        on the font group.
        N(   R1   RH   RI   RJ   t   font_transformR.   t   configt   font_transformst   getRB   t	   FontGroupt   segmentR-   (	   R   RX   t   tfRc   t	   font_funct   segst   ft   sst   seg(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt
   subsegment  s"    
		c      
   C  sO   t  j |  j  |  j |  j |  j d |  j |  j |  j | j 	 } | j	 | |  S(   s7  
        Given an x, y, w, h bounding box, returns the union of the given
        bounding box and the bounding box the glyphs will actually be drawn
        into, not including any offsets or expansions.

        This is used to deal with glyphs that are on the wrong side of the
        origin point.
        i    (
   R1   RQ   R2   R3   R4   R/   R0   R>   RR   t   bounds(   R   RS   Rp   RN   RY   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRp   B  s    
?N(   R   R   R   R.   R   R   RO   RS   R\   Ra   Ro   Rp   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR-      s    		$					$t   SpaceSegmentc           B  sA   e  Z d  Z d d d  Z d   Z d   Z d   Z d   Z RS(   sL   
    A segment that's used to render horizontal or vertical whitespace.
    i    c         C  sh   t  j   |  _ } d | _ d | _ | | _ | | _ | | _ | j rX | j | _ n  | j	 |  _	 d S(   sS   
        `ts`
            The text segment that this SpaceSegment follows.
        i    i   N(
   RT   t   Glypht   glypht	   charactert   ascentt   line_spacingt   advancet   widthR9   R;   (   R   t   tsRx   t   heightRs   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR   U  s    						c         C  s
   |  j  g S(   N(   Rs   (   R   RX   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRS   h  s    c         C  s   | S(   N(    (   R   RS   Rp   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRp   k  s    c         C  s   d  S(   N(    (   R   RS   R^   R_   R`   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR\   n  s    c         C  s3   |  j  d k r# | d |  j  7} n  | |  j _ | S(   Ni    g      ?(   R;   Rs   t   time(   R   Rb   RS   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRa   s  s    (   R   R   R   R   RS   Rp   R\   Ra   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRq   P  s   			t   DisplayableSegmentc           B  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sL   
    A segment that's used to render horizontal or vertical whitespace.
    c         C  s_   | |  _  | | } | j   \ |  _ |  _ | j |  _ | j |  _ | j |  _ | j |  _ d S(   sS   
        `ts`
            The text segment that this SpaceSegment follows.
        N(   t   dt   get_sizeRx   Rz   R9   R;   R<   R=   (   R   Ry   R}   t   renderst   rend(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s    	
c         C  s   t  j   } | j |  j  } | j |  j  } d | _ d | _ | | _ | | _ | | _ |  j	 ru |  j	 | _	 n  | g } |  j
 r t  j |  n8 |  j d k r t  j |  n |  j r t  j |  n  | S(   Ni  i    RP   (   RT   Rr   RD   Rx   Rz   Rt   Ru   Rv   Rw   R9   R=   RU   R<   RV   RW   (   R   RX   RN   Rs   R   R   R&   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRS     s$    									c         C  sZ   | d } | j  d  k	 rV | j  j |  j | j | j | j | j | j | j	 f  n  d  S(   Ni    (
   t   displayable_blitsR.   R   R}   R
   R   Rx   Ru   Rv   R{   (   R   RS   R^   R_   R`   RN   Rs   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR\     s    
c         C  s4   |  j  d k r# | d |  j  7} n  | | d _ | S(   Ni    g      ?(   R;   R{   (   R   Rb   RS   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRa     s    c         C  s   | S(   N(    (   R   RS   Rp   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRp     s    (   R   R   R   R   RS   R\   Ra   Rp   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR|   {  s   				t   FlagSegmentc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sf   
    A do-nothing segment that just exists so we can flag the start and end
    of a run of text.
    c         C  s   g  S(   N(    (   R   RX   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRS     s    c         C  s   d  S(   N(    (   R   RS   R^   R_   R`   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR\     s    c         C  s   | S(   N(    (   R   Rb   RS   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRa     s    c         C  s   | S(   N(    (   R   RS   Rp   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRp     s    (   R   R   R   RS   R\   Ra   Rp   (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s
   			t   Layoutc           B  sq   e  Z d  Z e e e d  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z RS(   s(   
    Represents the layout of text.
    c   <        s     f d   } t  d |  } t  d |  } | r | r t j j r t j j j  _ t j j j  _	 t j j j
  _ | j j d k  _ n6 d  _ t j j j  _	 t j j j  _ t  _ | j }	  j |	 j   _ t  _ t  _ d  _ d  _ g   _  j |  }  j |  } |  _ |  _  j |	  \ }
 } } } } |
  _ |  _ |  _  |  _! |  _" |  j 8} |  j  8} d } d } g    g  } g  } d } | r"| j#  _# | j  _ | j  _ | j  _ | j$  _$ | j  _ n  j% | j& |	 | |   _#  j |	 j'  }  j |	 j(  }  j d k } t } xt)  j#  D]\ } } t j j* r j+ |  \ } } n t } g  } g  } xf | D]^ \ } } | j, |   } | | f }  | j- |   | j- |   | j. |    j. |  qW| rh| j	   x! | D] \ } } | j	   qKWn   j j- t/ |   | rt0 j1 | j | |  n|	 j2 }! |! d k s|! d k rt0 j3 | t d  n |! d	 k rt0 j3 | t d  n |! d
 k rt0 j4 |  n{ |! d k r5t0 j3 | t d  nY |! d k rWt0 j3 | t d  n7 |! d k ryt0 j3 | t d  n t5 d j6 |!    |	 j7 }" |" d k rt8 j9 | | | | | t  n |" d k s|" d k rt8 j9 | | | | | t  n[ |" d k r't0 j: | | | | |  n1 |" d k rCt0 j; |  n t5 d j6 |"    x~ | D]v \ } } | s j | k r_t } qq_n  |  j k rt } n  | rt0 j< | d |  q_| j< | |  } q_W| rt0 j= |  } n  t0 j> | d | |  }# |# | k r|# } n  t0 j? | |  j |	 j@   j |	 jA   \ }$ } | j. |$  |	 jB s| } qqW j |	 j@  }% |	 j@ d k  rt j jC r| |% tD |  7} n | |% 7} | | d jE | d _ n   j |	 jF  }& |& |  j k r|&  j } n  tG jH |  } t0 jI | | |	 jJ |	 jK  | j jL }' | r-|' r- j | jM d | j  }(  j | jM d | j   }) |( | }* |) | }+ |' d k rd }+ n |' d k rd }* n  t0 jN   | |* |+ | |  |( } |) } t0 jO   d tP tQ | jR  j   |    n  |  j |  j  f \ }, }- }. |.  _M |    _R | rpd S j rt0 jS    j |	 jT j"   j |	 jU j"  |, |-  n  d d | | f }/ x) | D]! \ } } | jV | |/   }/ qWtW |/ d d   _X tW |/ d d   _Y tW |/ d | d   _Z tW |/ d | d   _[ |,  jX  jZ 7}, |-  jY  j[ 7}- i   _\ t]   }0 x* j D]\ }1 }2 }3 }4 |1 |2 f }5 |5  j\ k r	q	n  t j j^ j_ |, |1 |- |1 f t  }6 |6 |0 __ |2 |0 _` |1 |0 _a |2 d k r/
g   _b  jb |0 _b n	 d |0 _b xF | D]> \ } } |  j k r^
Pn  | j | |0  jX  jY   q?
Wt j j jc |6  t j j jd |6  }7 |7  j\ |5 <q	Wt0 je |   _f |  _g  j r
t0 jh |   _i n	 g   _i t j jj r jM \ }8 }9 |8 | k s/|9 | k rt jk jl   \ }: }; t j jm jn d  t j jm jn d |: |;  t j jm jn d | | |, |-  t j jm jn d | jo  qn  d S(    s^  
        `text`
            The text object this layout is associated with.

        `width`, `height`
            The height of the laid-out text.

        `renders`
            A map from displayable to its render.

        `size_only`
            If true, layout will stop once the size field is filled
            out. The object will only be suitable for sizing, as it
            will be missing the textures required to render it.

        `splits_from`
            If true, line-split information will be copied from this
            Layout (which must be another Layout of the same text).
        c            s,   x%   D] }  |  j  r |  j  j Sq Wd S(   Ni    (   Ru   R   t   yoffset(   RZ   (   t
   all_glyphsR   (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   find_baseline  s    	i  t   linearg      ?i    g        t   unicodet	   eastasians   korean-with-spacest   westerns   japanese-loosei   s   japanese-normali   s   japanese-stricti   s   Unknown language: {0}t   text   subtitles   tex-subtitlet   greedyt   nobreaks   Unknown layout: {0}it
   horizontalR0   Nt    s"   File "%s", line %d, text overflow:s+        Available: (%d, %d) Laid-out: (%d, %d)s        Text: %r(p   t   minRH   Rd   t   drawable_resolution_textt   displayR\   t   draw_per_virtRR   t   draw_to_virtt   reverset   virt_to_drawt   forwardRM   t   outline_scalingt   outline_stept   rendert   IDENTITYRG   RD   t   line_overlap_splitR   t   has_hyperlinkst   has_rubyR.   t   start_segmentt   end_segmentt   paragraph_glyphsRx   Rz   t   figure_outlinest   outlinest   xbordert   ybordert   xoffsetR   t
   paragraphst   hyperlink_targetsRh   t   tokenst   first_indentt   rest_indentt	   enumeratet   rtlt   rtl_paragraphRS   R   t   extendt   listRT   t   copy_splitst   languaget   annotate_unicodet   annotate_westernt	   ExceptionR   RN   t   texwrapt   linebreak_text   linebreak_greedyt   linebreak_nobreakRa   t   reverse_linest   place_horizontalt   place_verticalRv   t   line_leadingt   newline_indentt   broken_line_spacingt   lenR   t	   min_widtht   matht   ceilt   align_and_justifyt
   text_alignt   justifyt   adjust_spacingR2   t   tweak_glyph_spacingt   offset_glyphsRC   t   roundt   baselinet
   place_rubyt
   ruby_stylet   altruby_styleRp   t   maxt   add_leftt   add_topt	   add_rightt
   add_bottomt   texturesR,   t   pgrenderR]   R[   R!   R   t   mutated_surfacet   load_texturet	   max_timest   max_timet   linest   hyperlink_areast
   hyperlinkst   debug_text_overflowt   exportst   get_filename_linet   to_logt   writet   text(<   R   R   Rx   Rz   R   t	   size_onlyt   splits_fromt   drawable_resR   RM   R   R   R   R   R   t   maxxR   t   par_seg_glyphsR   Rb   R   R   t   startedt   endedt   p_numt   pR   t
   par_glyphst
   seg_glyphsRy   RX   RS   t   tR   RN   R   t   lRv   R   R   t   target_xt   target_yt   target_x_deltat   target_y_deltat   swt   shR2   Rp   R^   t   oR7   t   _xot   _yoR   t   surfR   t   owt   oht   filenamet   line(    (   R   R   sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     sv   															
		!!			6	

		3$		:		&					#			c         C  s   | d  k r | S| |  j S(   N(   R.   RR   (   R   t   n(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRE   K  s    c         C  sI   | d  k r | St | t j j j  r2 t |  St t | |  j   S(   N(	   R.   RB   RH   R   t   coret   absoluteRC   R   RR   (   R   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRD   Q  s
    
c         C  s   | d  k r | St | t j j j  r2 t |  S|  j r_ |  j d k  rN | S| t |  j  S| d k ro d St	 | |  j  } | d k  r | d k r d } n  | d k r | d k  r d } n  | Sd  S(   Ni   i    i(
   R.   RB   RH   R   R   R  RC   R   RR   R   (   R   R   R&   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   scale_outlineZ  s     
			c         C  s   | |  j  | |  j  f S(   N(   RR   (   R   R
   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   unscale_pairu  s    c           s	  i  |  _  g  } g    t d1  } | j | _ | j d1 k sK | j t k r` t j j j	 | _ n  | j
 | |   | g   f d   }    f d   } x| D]\ }	 }
 y|	 t k r |   | j    g    w na |	 t k r  j  d j |
   w n5 |	 t k r=  j t  d |
 |  d f  w n  |
 j d  \ } } } | r| d d k r j    sC	t d |
   qC	n| d	 k rt   }   j | d
 f  | |  _ n~| d k rt   }   j | d
 f  | |  _ nJ| d k r"|   | j    g    n!| d k rt |  d k  rSt d |   n  |  j t |   }   j t  d d | d f  n| d k rt |  d k  rt d |   n  |  j t |   }   r| j    n  t  d d | d f g   | j    g    n$| d k r.n| d k r=n| d k rLn| d k rt |  _ | j d } | r| |  } n | } | j } t |  j   d } | |  j  | <| j |  s| j  d  nJ t j! j" j#   | k rt j! j" j$ | k r| j  d  n | j  d  |   } | j% } | j& } | j
 | |   | | _% | | _' t j( j) rp| | _& n  | j  |  n| d k rt |   _* n| d k rt |   _+ n| d k r| r|  j t |   |   _, qC	|  j d  |   _, nE| d k rt |   _- n*| d k rU|   } t. | _* t. | _+ t. | _, t. | _- n| d
 k rt/ t j0 j1 |  } |   j
 | |   n| d k r| |   _2 n| d  k rt |  d k  rt d |   n  | d d! k r|   j& t |  7_& qC	t |  |   _& n+| d" k rdt |  d k  rIt d |   n  t j3 j4 |  |   _4 n| d# k rt |  d k  rt d |   n  t j3 j4 |  |   _5 n| d$ k rdt |  d k  rt d |   n  |   } | d d! k r| j4 j6 t7 |  } n9 | d d% k r@| j4 j6 t7 | d  } n t7 |  } | j4 j8 |  | _4 n| d& k rt |  d k  rt d |   n  |  j9 t7 |   |   _: n| d' k r|   } | j% } | j
 | j; |   | | _% t | _< t |  _= nA| d( k rQ|   } | j% } | j
 | j> |   | | _% d) | _< t |  _= n | d* k rlt |   _? n | d+ k rt |  d k  rt d |   n  |   } | d d% k r| j t7 | d  9_ qC	t7 |  | _ n_ | d, k rt |   _% nD | d- k r 	|   } t. | _% n# | d d. k r3	n t d/ |
   Wq d0 j@ |
 | jA    t j _B   q Xq W|   | j    | S(2   s   
        Breaks the text up into segments. This creates a list of paragraphs,
        which each paragraph being represented as a list of TextSegment, glyph
        list tuples.
        c            s!   t    d  }    j |   |  S(   s   
            Creates a new text segment, and pushes it onto the text segement
            stack. Returns the new text segment.
            i(   R-   R   (   Ry   (   t   tss(    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   push  s    c            sO   x.   D]& }  t  |  d t t t f  r d  Sq W  j  d j d   d  S(   Ni    iu   ​(   RB   R-   Rq   R|   R   Ro   (   t   i(   R   R  (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   fill_empty_line  s    iu    t   =i    t   /s%   %r closes a text tag that isn't open.t   _startR   t   _endR   t   spacei   s   empty value supplied for tag %rRx   t   vspaceRz   R   t   fastt   nwt   at   insensitive_t   hover_t   idle_R   R  t   uRX   t   plainR1   R2   s   +-R7   t   outlinecolorR   t   *t   kt   rtt   artRP   t   rbR;   t   vertt   horizt   #s   Unknown text tag %rs,   While processing text tag {{{!s}}} in {!r}.:N(C   R   R-   R.   RF   R;   RG   RH   RI   RJ   RK   RO   R   R   R   R   Ro   R   R|   t	   partitiont   popR   R   R   R   R   RD   RC   Rq   R   t   hyperlink_functionst   prefixt   hyperlink_sensitivet
   set_prefixR   t   focust   get_focusedt   argumentR0   R2   R9   Rd   t   hyperlink_inherit_sizeR3   R4   R5   R6   R   t   getattrt   storeRM   R1   t   easyR7   R?   R   t   floatt   replace_opacityRE   R:   R   R<   R   R   R=   R   t   get_all_textt   exception_info(   R   R   RM   R   t   text_displayableR   Ry   R  R  t   typeR   t   tagt   _t   valuet   fsRx   Rz   t   hyperlink_stylert   hlst
   old_prefixt   linkt
   vert_styleR2   (    (   R   R  sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRh   x  sT   			#
			&			-																				c         C  sm   t  } g  } x< | D]4 \ } } t | |  \ } } | j | | f  q W| t k p` | t k } | | f S(   s  
        Given a paragraph (a list of segment, text tuples) handles
        RTL and ligaturization. This returns the reversed RTL paragraph,
        which differers from the LTR one. It also returns a flag that is
        True if this is an rtl paragraph.
        (   R   R   R   R   R   (   R   R   t	   directionR   Ry   RX   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s    c         C  s  | j  } | j } | r6 | r6 d g d d d d f Sg  } | r t | t  s] | g } n  xE | D]: \ } } | j d | j |  j |  |  j |  f  qd Wn  xN | D]F \ } } }	 }
 | j |  j |  | |  j |	  |  j |
  f  q Wd } d } d } d } x | D] \ } } } } | | } | | } | | } | | } | | k  rd| } n  | | k ry| } n  | | k  r| } n  | | k r| } qqW| j d  | | | | | | | f S(   s4  
        Return a list containing the outlines, including an outline
        representing the drop shadow, if we have one, also including
        an entry for the main text, with color None. Also returns the
        space reserved for outlines - to be deducted from the width
        and the height.
        i    N(   i    Ni    i    (   i    Ni    i    (	   R   t   drop_shadowR.   RB   R   R   t   drop_shadow_colorRD   R  (   R   RM   t   style_outlinest   dslistR   t   dsxt   dsyR2   R7   R_   R`   R   R   R   R   R   t   _cR
   R   R   t   rR   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s>    			58



			c         C  s"  |  j  \ } } g  } |  j s" | Sd } t } xJ |  j D]9 } | j | k rQ Pn  t | j | j |  j |  } q8 Wd } | r | j	 t
 d d | | d | d t d t d | d k  t } n  | d k r | S| } d }	 t }
 t } x | j D] } | j d k rq n  | j | k r&q n  | | j d k rBt }
 n  | | j d k r^t } n  | j | j |	 k r| j | j }	 n  | j | k  r | j } q q Wt | j | j |  j |  } | |	 k  r| j	 t
 | | |	 | | | d |
 d | d | d | |  j d k  n  | S(   s   
        Given a st and an outline, returns a list of blit objects that
        can be used to blit those objects.

        This also sets the extreme points when creating a Blit.

        i    R   R   R   R   iN(   R2   R   RG   R   R   R   Rz   R   R.   R   R	   R   RS   R{   R
   Rw   (   R   t   stRx   t
   max_heightR&   t   max_yR   R   t   min_xR%   R   R   RZ   t   ly(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   blits_typewriter  sJ    		$:			 Lc         C  s>   x7 |  j  D]( } | j s q
 n  | j | k r
 Pq
 q
 Wd Sd S(   sS   
        Return the time of the first glyph that should be shown after st.
        i    N(   R   RS   R   R.   (   R   RD  R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   redraw_typewriter4  s    	(   R   R   R   R   R.   RG   R   RE   RD   R  R  Rh   R   R   RI  RJ  (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s    w						 *		8	Gi2   c           C  s   i  a  i  a i  a i  a d S(   s/   
    Clears the old and new layout caches.
    N(   t   layout_cache_oldt   layout_cache_newt   virtual_layout_cache_oldt   virtual_layout_cache_new(    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   layout_cache_clearR  s    c           C  s"   t  a i  a  t  a i  a g  a d S(   sN   
    Called once per interaction, to merge the old and new layout caches.
    N(   RL  RK  RM  RN  t	   slow_text(    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt	   text_tickd  s
    i    i   t   Textc           B  sd  e  Z d  Z d Z e Z e Z e Z d! Z
 d   Z d! d! d! d! d! d  Z d   Z d   Z d   Z d   Z e d  Z d! e e d	  Z d
   Z d   Z d   Z d   Z d   Z e Z d   Z d   Z d   Z d   Z d   Z e d  Z e d  Z d   Z  d   Z! d   Z" d d d d d  Z# d   Z$ d   Z% d   Z& d   Z' d    Z( RS("   s|  
    :name: Text
    :doc: text
    :args: (text, slow=None, scope=None, substitute=None, slow_done=None, **properties)

    A displayable that displays text on the screen.

    `text`
        The text to display on the screen. This may be a string, or a list of
        strings and displayables.

    `slow`
        Determines if the text is displayed slowly, being typed out one character at the time.
        If None, slow text mode is determined by the :propref:`slow_cps` style property. Otherwise,
        the truth value of this parameter determines if slow text mode is used.

    `scope`
        If not None, this should be a dictionary that provides an additional scope for text
        interpolation to occur in.

    `substitute`
        If true, text interpolation occurs. If false, it will not occur. If
        None, they are controlled by :var:`config.new_substitutions`.
    i   c         C  s|   | d k  r d  |  _ n  | d k  rx t |  j t  sH |  j g |  _ n  d  |  _ t |  _ d  |  _ d  |  _	 t
 |  _ n  d  S(   Ni   i   (   R.   t   ctcRB   R   R   t   scopeR   t
   substitutet   startt   endRG   t   dirty(   R   t   version(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   after_upgrade  s    				c   	      K  s}  t  t |   j |   t | t  s1 | g } n  x] | D]U } t | t t j j j	 f  s8 t j
 j r t d j |    q d g } Pq8 q8 W| |  _ t |  _ d  |  _ |  j | | |  t j j s t j j j r t } n  | |  _ d  |  _ d  |  _ d  |  _ d  |  _ | d  k	 r[| j |  _ | j |  _ | j |  _ | j |  _ | j |  _ n  d  |  _ |  j |  _ g  |  _  d  S(   Ns   Cannot display {0!r} as text.R   (!   t   superRR  R   RB   R   t
   basestringRH   R   R   t   DisplayableRd   t	   developerR   R   RU  RG   RX  R.   R   t   set_textRI   t   less_updatesRJ   t   self_voicingR   t   slowt	   slow_doneRS  RV  RW  t   displayablest   _duplicatablet   displayable_offsets(	   R   R   Rb  RT  RU  Rc  t   replacest
   propertiesR  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s:    											c         C  sF   | r | j  r | j   n  |  j rB |  j |  } | j   | S|  S(   N(   t   argst
   extraneousRe  t   _copyt   _unique(   R   Ri  R&   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt
   _duplicate  s    	
c         C  sf   |  j  s |  S|  j   } | j d  k	 rP g  | j D] } | j   ^ q2 | _ n  d  | _ t | _ | S(   N(   t   _uses_scopeRk  Rd  R.   t   _in_current_storeRc  RG   t   locked(   R   R&   R  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRo    s    	(		c         C  s   d } xQ |  j  D]F } t | t  r2 | | 7} n  t |  d k r | d  d } Pq q W| j d d  j d d  j d	 d
  } d j |  S(   NR   i   i   u   …s   \s   \\s   "s   \"s   
s   \nu	   Text "{}"(   R   RB   R\  R   t   replaceR   (   R   RX   R  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   __unicode__  s    *c         C  s:   d } x- |  j  D]" } t | t  r | | 7} q q W| S(   s$   
        Gets all the text,
        u    (   R   RB   R\  (   R   RX   R  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR.    s
    c         C  s)   |  j  r t S|  j |  j | |  j |  S(   s=   
        Called to update the scope, when necessary.
        (   Rp  R   R_  t   text_parameterRU  (   R   RT  t   update(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   _scope  s    	c   
      C  sZ  |  j  r d  St j j j |  _ |  j } t | t  sC | g } n  | |  _ g  } t	 } x | D] } t | t
  r | t	 k	 r t j j | | |  \ } }	 | p |	 } n  t | t  r t | d d  } q t |  } n  | j |  q_ W| |  _ | | k r
t	 S| rV| |  _ |  j sVt |  _ | d  k	 rSt j j j |  d  qSqVn  t S(   Ns   utf-8Rq  i    (   Rp  RH   RI   RJ   R   R   RB   R   Rs  R   R\  t   substitutionsRU  t   strR   R   Rn  RX  RG   R.   R   R   t   redraw(
   R   R   RT  RU  Rt  t   old_textt   new_textt
   uses_scopeR  t   did_sub(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR_  (  s8    							c         C  sd   |  j  t j j j  k rD |  j rD |  j |  j d |  j d t n  |  j	 j
 r` t j |   n  d  S(   NRU  Rt  (   R   RH   RI   RJ   Rn  R_  Rs  RU  RG   RM   t   slow_abortableRP  R   (   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   per_interactY  s    ""c         C  s   | |  _  t |  _ d  S(   N(   RS  RG   RX  (   R   RS  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   set_ctc`  s    	c         C  s  t  |  _ |  j   |  j } |  j d k	 r*| d |  j  } | d |  j |  j !} | d |  j } | rw | d } n  | r d | } n  g  } | r | j |  n  | j |  |  j d k	 r t	 |  j t
  r | j |  j  q | j |  j  n  | r| j |  n  | j | d  | } n" |  j d k	 rL| j |  j  n  |  j |  } t j j st j j st j j d k	 r|  j |  } n  |  j |  \ |  _ |  _ xH |  j D]4 \ } } | t k r| j d  rt |  _ PqqWt  |  _ d S(   sy   
        This needs to be called after text has been updated, but before
        any layout objects are created.
        i    s   {_start}s   {_end}i   s   a=N(   R   RX  t   kill_layoutR   RV  R.   RW  R   RS  RB   R   R   t   tokenizeRH   Rd   t   custom_text_tagst   self_closing_custom_text_tagst   replace_textt   apply_custom_tagst   get_displayablesR   Rd  R   t
   startswithRG   t	   focusable(   R   R   t   start_stringt
   mid_stringt
   end_stringt
   text_splitR   R1  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRt  d  sD    	
		*	c         C  s2   |  j  s |  j d  k r% |  j   n  t |  j  S(   N(   RX  Rd  R.   Rt  R   (   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   visit  s    c         C  s   g  } x3 |  j  D]( } t | t  s+ q n  | j |  q Wd j |  } | j d  \ } } } t j j j	 |  } |  j
 j } | d  k	 r t j j | d i | d 6d } n  | S(   NR   s   {fast}RT  R   i    (   R   RB   R\  R   t   joint
   rpartitionRH   t   translationt   dialoguet   notags_filterRM   RP   R.   Rv  RU  (   R   R&   R  R3  RP   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   _tts  s    &c         C  sP   t  |   } t j | d  t j | d  t j | d  t j | d  d S(   s]   
        Kills the layout of this Text. Used when the text or style
        changes.
        N(   t   idRK  R   R.   RL  RM  RN  (   R   R   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR    s
    c         C  sC   t  |   } t j | d  } | d k r? t j | d  } n  | S(   s>   
        Gets the layout of this text, if one exists.
        N(   R  RL  Rf   R.   RK  (   R   R   R&   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt
   get_layout  s
    c         C  sC   t  |   } t j | d  } | d k r? t j | d  } n  | S(   s>   
        Gets the layout of this text, if one exists.
        N(   R  RN  Rf   R.   RM  (   R   R   R&   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   get_virtual_layout  s
    c         C  s<   | |  j  j k r |  j   n  t t |   j | |  d  S(   N(   RM   R"  R  R[  RR  t   set_style_prefix(   R   R"  t   root(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR    s    c      	   C  s$  t  t |   j   } | d t k r) | S|  j   } | d  k r d } d } d } d } |  j sq |  j d  k r~ |  j   n  i  } x< |  j D]1 } t	 j
 j j | | |  j j | |  | | <q Wt |  | | | d t d t } n  | \ }	 }
 } } } } } |	 |
 | | j | | | f } | S(   Ni   i   i    R   R   (   R[  RR  t   get_placementt   BASELINER  R.   RX  Rd  Rt  RH   R   R   RM   R2   R   RG   R   (   R   R&   RN   Rx   Rz   RD  t   atR   R  t   xpost   ypost   xanchort   yanchorR   R   t   subpixel(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR    s$    /$c         C  s   |  j    } |  j   t j j j |  d  | d k r< d S| s[ t j j |  j	 j
  n  |  j	 j d } | j j t j j j d  } | r | r | d k	 r | |  Sd S(   s6   
        Called when a hyperlink gains focus.
        i    Ni   (   R  R  RH   R   R   Rx  R.   R   t   playRM   t   hover_soundR!  R   Rf   R%  R'  (   R   t   defaultRN   t   hyperlink_focust   target(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR%    s    
c         C  sK   |  j    t j j j |  d  |  j j d } | rG | rG | d  Sd S(   sV   
        Called when a hyperlink loses focus, or isn't focused to begin with.
        i    i   N(   R  RH   R   R   Rx  RM   R!  R.   (   R   R  R  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   unfocus/  s
    
c         C  s,   t  |  _ |  j r( |  j   d |  _ n  d S(   s/   
        Called when slow is finished.
        N(   R   Rb  Rc  R.   (   R   RD  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   call_slow_done<  s    		
c         C  s0   |  j  j } t |  d k  r" t S| d |  S(   sN   
        Returns true of the hyperlink is sensitive, False otherwise.
        i   i   (   RM   R!  R   RG   (   R   R  t   funcs(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR#  G  s    c         C  s  |  j  ru t j j j | d  ru |  j j ru x0 t D]( } | j  r4 | j |  t	 | _  q4 q4 Wt j j
 j    n  |  j   } | d k r d S| j |  d k r |  j  r |  j |  t	 |  _  q n  xJ |  j D]? \ } } }	 | j | | | | |	 |  }
 |
 d k	 r |
 Sq W|  j   rt j j j | d  rt j j |  j j  |  j j d } | d k	 r| j j t j j j d  } |  j |  sd S|  j j d |  }
 |
 d k rt j j
 j    n  |
 Sn  d S(   sD   
        Space, Enter, or Click ends slow, if it's enabled.
        t   dismissNt   button_selecti   (   Rb  RH   R   t   behaviort	   map_eventRM   R}  RP  R  R   R   t   IgnoreEventR  R.   RJ  Rf  t   eventt
   is_focusedR   R  t   activate_soundR!  R   Rf   R%  R'  R#  (   R   t   evR
   R   RD  R  RN   R}   R_   R`   R&   t   clickedR  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR  S  s:    -		 i   i    c      	   C  s   |  j  s |  j d k r% |  j   n  i  } x< |  j D]1 } t j j j | | |  j j | |  | | <q5 Wt	 |  | | | d t
 d t
 } | j | j   S(   s   
        :args: (width=4096, height=4096, st=0, at=0)

        Attempts to figure out the size of the text. The parameters are
        as for render.

        This does not rotate vertical text.
        R   R   N(   RX  Rd  R.   Rt  RH   R   R   RM   R2   R   RG   R  (   R   Rx   Rz   RD  R  R   R  RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR2     s    /!c         C  s#   |  j    } | d k r d S| j S(   sd   
        Returns the amount of time, in seconds, it will take to display this
        text.
        g        N(   R  R.   R   (   R   RN   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   get_time  s    c   -      C  s)  |  j  j r | | } } n  |  j d  k rO |  j  j rC t |  _ qO t |  _ n  |  j sg |  j d  k rt |  j	   n  i  } x< |  j D]1 } t
 j j j | | |  j  j | |  | | <q W|  j   } | d  k s | j | k s | j | k rBt |  | | | d t d t } t t  t k r/t j   n  | t t |   <n  |  j   } | d  k sx| j | k sx| j | k rt |  | | | d | } t t  t k rt j   n  | t t |   <n  | j \ }	 }
 | j \ } } |  j s3t d d | | j | | j d t d t d t d t g } d  } n | j |  } | j |  } t
 j j j |	 |
  } t
 j j  rt
 j j j |	 |
  } | j! d  | j" | _# | j# | _" | j$ | d  n  x| j% D] \ } } } } | j& | | f } | rt' | |  } n | } x| D]} | j( } | j) } | j* } | j+ } | d k  re| | j( 7} d } n  | d k  r| | 7} d } n  | | | k r| | } n  | | | k r| | } n  | d k s| d k rqn  | j, r| | j- 7} | | 7} n  | j. r"| | j/ 7} | | 7} n  | j0 r;| | j1 7} n | | j1 7} | j2 ra| | j3 7} n | | j3 7} | j4 | j5 | | | | f  | j6 | | | j7 | | j1 | | | j8 | | j3   qWqW| j9 rg  |  _: t
 j j j | |  } | j" | _# | j# | _" x | j9 D] \ } } } } }  }! }" |  j rU|" | k rUqn  t
 j j; j< | |  | |! | j=    \ } } | | | j7 } | | | j8 } | j4 | | | | f  |  j: j> | | | f  qW| j$ | d  n  xz | j? D]o \ }# }$ }% }& }' | j6 |$ | j7 |% | j8  \ }( }) | j6 |& |'  \ }* }+ | j@ |  |# |( |) |* |+  qW|  j r| d  k	 rt
 j j jA |  |  qt
 j jB jC d  n  | j# | _# | j" | _" |  j  j r%t
 j j j | j | j  }, tD |, _# tE |, _" |, j$ | | j d f  |, } n  | S(   NR   R   R   i    R   R   R   R   i   i    (   i   i    i    i    (   i    i    (   i    i    (F   RM   R0   Rb  R.   RF   RG   R   RX  Rd  Rt  RH   R   R   R2   R  Rx   Rz   R   R   RN  t   LAYOUT_CACHE_SIZEt   clearR  R  RL  R	   R   R   RI  RJ  t   RenderRd   t   draw_virtual_text_boxt   fillR   R   t   blitR   R   R+   R
   R   R   R   R   R   R   R   R   R   R   R   t   absolute_blitt
   subsurfaceR  R   R   R   Rf  R   t   placeR  R   R   t	   add_focusRx  t	   interfacet   timeoutt   VERT_FORWARDt   VERT_REVERSE(-   R   Rx   Rz   RD  R  R   R  t   virtual_layoutRN   t   vwt   vhR   R   R    Rx  R&   R  R   R7   R_   R`   R   t   oblitsR   t   b_xt   b_yt   b_wt   b_ht   drendR}   R
   R   Ru   Rv   R   R9   t   hxt   hyt   hwt   hht   h_xt   h_yt   h_wt   h_ht   vrv(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR     s    /*!*	>						
					(		%& 				c         C  s   g  } x | D] } t  | t  r; | j t j |   q t  | t  ri | j t j t |    q t  | t j j j	  r | j
 t | f  q t d j |    q W| S(   s9   
        Convert the text into a list of tokens.
        s   Can't display {0!r} as Text.(   RB   R   R   RT   R  Rw  RH   R   R   R]  R   R   R   R   (   R   R   R   R  (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR  c  s    c         C  sg  g  } xZ| rb| j  d  } | \ } } | t k rj t j j rj | j t t t j j |   f  q	 | t k r | j |  q	 | j d  \ } } } t j j	 j
 | d  }	 |	 d k r t j j j
 | d  }	 t }
 n t }
 |	 d k r| j |  q	 n  |
 sg  } d | } d } x | r| j  d  } | \ } } | t k r| j d  \ } } } | | k r| d 7} q| | k r| d 8} | sPqqn  | j |  q'W| rt d j |    n  |	 | | |  } n |	 | |  } g  } xE | D]= \ } } t | t  r5t |  } n  | j | | f  qW| j |  | } q	 W| S(   s3   
        Apply new-style custom text tags.
        i    R  R	  i   s2   Text ended while the '{}' text tag was still open.N(   R   R   RH   Rd   R  R   R   R   R  R  Rf   R.   R  RG   R   R   R   RB   Rw  R   (   R   R   R&   R   t   kindR   R2  R3  R4  t   funct   self_closingt   contentst   closet   countt   t2t   kind2t   text2t   tag2t   new_contentst
   new_tokens(    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR  z  sZ    	(	
	


c         C  s   t    } g  } x | D] } | \ } } | t k rT | j |  | j |  q n  | t k r | j d  \ } } }	 | d k r t j j |	  }
 | j |
  | j t |
 f  q q n  | j |  q W| | f S(   s   
        Goes through the list of tokens. Returns the set of displayables that
        we know about, and an updated list of tokens with all image tags turned
        into displayables.
        R  t   image(	   t   setR   t   addR   R   R  RH   R+  t   displayable(   R   R   Rd  R  R   R  R   R2  R3  R4  R}   (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyR    s"    		N()   R   R   R   t   __version__RG   Rn  R   Re  Rp  R.   R   RZ  R   Rm  Ro  Rr  R.  Ru  R_  R~  R  Rt  R  R  t   _tts_allR  R  R  R  R  R%  R  R  R#  R  R2   R  R   R  R  R  (    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyRR  y  sH   	=				
1			G										1				V(3   t
   __future__R    R   t   renpy.displayRH   t   renpy.text.textsupportR   R   R   R   R   RT   t   renpy.text.texwrapR   t   renpy.text.fontR1   t   renpy.text.extrast   extrast
   _renpybidiR   R   R   R   R  t   objectR	   R+   R,   R-   Rq   R|   R   R   R  RK  RL  RM  RN  RO  RP  RQ  R   R   t   Matrix2DR  R  R   R]  RR  t   language_tailort   ParameterizedText(    (    (    sh   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\text\text.pyt   <module>   sH   ""	J+B   z		   |	