
    (hqv                     V   S r SSKJr  SSKJrJrJrJrJrJ	r	  SSK
Jr  SSKJrJrJrJr  SSKJr  SSKJrJr  SS	KJr  S
rSrSr/ SQrSR9                  \5      rSrSrSr  " S S5      r! " S S\!5      r" " S S\5      r# " S S\5      r$ " S S\5      r% " S S5      r& " S S5      r'g )!a%  
Routines for organizing lines and larger blocks of text, with manual and
automatic line wrapping.

The contents of this module are internal to fpdf2, and not part of the public API.
They may change at any time without prior warning or any deprecation period,
in non-backward-compatible ways.
    )Number)
NamedTupleAnyListOptionalUnionSequence)uuid4   )AlignCharVPosTextDirectionWrapMode)FPDFException)CoreFontTTFFont)escape_parens   ­- )r   u   ​u    u    u    u    u    u    u    u    u    u    u    u   　	     
c                   j   \ rS rSrSr S4S\\\4   S\S\	S\
\\\4      4S jjrS	 r\S
\\\4   4S j5       r\R$                  S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r \S 5       r!\S 5       r"\S 5       r#\S 5       r$\S 5       r%\S  5       r&\S! 5       r'S"\4S# jr(S$\)4S% jr*S& r+    S5S'\S(\S)\S*\,4S+ jjr-S6S, jr.S7S-\4S. jjr/S/ r0S0 r1S1 r2S2 r3S3r4g)8Fragment-   zK
A fragment of text with font/size/style and other associated information.
N
charactersgraphics_stateklinkc                     [        U[        5      (       a  [        U5      U l        OXl        X l        X0l        X@l        g N)
isinstancestrlistr   r    r!   r"   )selfr   r    r!   r"   s        KC:\Users\13-19\Desktop\PokeDex\pokedex\Lib\site-packages\fpdf/line_break.py__init__Fragment.__init__2   s2     j#&&":.DO(O,	    c           	      p    SU R                    SU R                   SU R                   SU R                   S3	$ )NzFragment(characters=z, graphics_state=z, k=z, link=)r   r    r!   r"   r(   s    r)   __repr__Fragment.__repr__A   sC    "4??"3 4#223 4&&1.	
r,   returnc                      U R                   S   $ Ncurrent_fontr    r0   s    r)   fontFragment.fontH       "">22r,   c                      XR                   S'   g r5   r7   )r(   vs     r)   r8   r9   L   s    ./N+r,   c                 Z    U R                   =(       a    U R                   R                  S:H  $ )NTTF)r8   typer0   s    r)   is_ttf_fontFragment.is_ttf_fontP   s    yy4TYY^^u44r,   c                      U R                   S   $ )N
font_styler7   r0   s    r)   rC   Fragment.font_styleT       ""<00r,   c                      U R                   S   $ )Nfont_familyr7   r0   s    r)   rG   Fragment.font_familyX   s    ""=11r,   c                 v   U R                   S   nU R                   S   nU[        R                  :X  a  XR                   S   -  nU$ U[        R                  :X  a  XR                   S   -  nU$ U[        R                  :X  a  XR                   S   -  nU$ U[        R
                  :X  a  XR                   S   -  nU$ )Nfont_size_pt	char_vpos	sub_scale	sup_scale	nom_scaledenom_scaler    r   SUBSUPNOMDENOM)r(   sizevposs      r)   rJ   Fragment.font_size_pt\   s    "">2"";/8<<''44D  X\\!''44D
 	 X\\!''44D  X^^#''66Dr,   c                 :    U R                   S   U R                  -  $ )NrJ   )r    r!   r0   s    r)   	font_sizeFragment.font_sizej   s    "">2TVV;;r,   c                      U R                   S   $ )Nfont_stretchingr7   r0   s    r)   r\   Fragment.font_stretchingn   s    ""#455r,   c                      U R                   S   $ )Nchar_spacingr7   r0   s    r)   r_   Fragment.char_spacingr   r:   r,   c                      U R                   S   $ )N	text_moder7   r0   s    r)   rb   Fragment.text_modev       "";//r,   c                      U R                   S   $ )N	underliner7   r0   s    r)   rf   Fragment.underlinez   rd   r,   c                      U R                   S   $ )Nstrikethroughr7   r0   s    r)   ri   Fragment.strikethrough~   s    ""?33r,   c                      U R                   S   $ )N
draw_colorr7   r0   s    r)   rl   Fragment.draw_color   rE   r,   c                      U R                   S   $ )N
fill_colorr7   r0   s    r)   ro   Fragment.fill_color   rE   r,   c                      U R                   S   $ )N
text_colorr7   r0   s    r)   rr   Fragment.text_color   rE   r,   c                      U R                   S   $ )N
line_widthr7   r0   s    r)   ru   Fragment.line_width   rE   r,   c                      U R                   S   $ )NrK   r7   r0   s    r)   rK   Fragment.char_vpos   rd   r,   c                 f   U R                   S   nU[        R                  :X  a  U R                   S   nOnU[        R                  :X  a  U R                   S   nOJU[        R                  :X  a  U R                   S   nO&U[        R
                  :X  a  U R                   S   nOSnX R                   S   -  $ )NrK   sub_liftsup_liftnom_lift
denom_liftg        rJ   rP   )r(   rV   lifts      r)   r~   Fragment.lift   s    "";/8<<&&z2DX\\!&&z2DX\\!&&z2DX^^#&&|4DD)).999r,   c                 8    SR                  U R                  5      $ )Nr   )joinr   r0   s    r)   stringFragment.string   s    wwt''r,   c                 "    U R                  5       $ r$   )	get_widthr0   s    r)   widthFragment.width   s    ~~r,   c                      U R                   S   $ )Ntext_shapingr7   r0   s    r)   text_shaping_parameters Fragment.text_shaping_parameters   r:   r,   c                 b    U R                   (       a  U R                   S   $ [        R                  $ )Nparagraph_directionr   r   LTRr0   s    r)   r   Fragment.paragraph_direction   s3     ++ (()>?	
 ""	
r,   c                 b    U R                   (       a  U R                   S   $ [        R                  $ )Nfragment_directionr   r0   s    r)   r   Fragment.fragment_direction   s3     ++ (()=>	
 ""	
r,   indexc                 ,    U R                   S U U l         g r$   )r   )r(   r   s     r)   trimFragment.trim   s    //&51r,   otherc                     U R                   UR                   :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r$   )r   r    r!   r(   r   s     r)   __eq__Fragment.__eq__   sG    OOu/// "##u';';;"%''!	
r,   c                 Z    [        U R                  U R                  U R                  45      $ r$   )hashr   r    r!   r0   s    r)   __hash__Fragment.__hash__   s"    T__d&9&9466BCCr,   startendchars
initial_csc                 r   Uc  U R                   X nU R                  R                  X0R                  U R                  5      u  pVU R
                  nU R                  S:w  a"  X`R                  S-  -  nXpR                  S-  -  nU R
                  S:w  a  U(       a  XgU-  -  nO
XgUS-
  -  -  nX`R                  -  $ )a  
Return the width of the string with the given font/size/style/etc.

Args:
    start (int): Index of the start character. Default start of fragment.
    end (int): Index of the end character. Default end of fragment.
    chars (str): Specific text to get the width for (not necessarily the
        same as the contents of the fragment). If given, this takes
        precedence over the start/end arguments.
d   g{Gz?r   r   )r   r8   get_text_widthrJ   r   r_   r\   r!   )r(   r   r   r   r   char_lenwr_   s           r)   r   Fragment.get_width   s    $ =OOE.E		00$$d&B&B
 ((3&%%,,A00477L! H,,X\2266zr,   c                     U R                   UR                   :H  =(       a5    U R                  UR                  :H  =(       a    [        XR                  5      $ )zFReturns if 2 fragments are equivalent other than the characters/string)r    r!   r%   	__class__r   s     r)   has_same_styleFragment.has_same_style   sC     5#7#77 2%''!25..1	
r,   	characterc                 N    U[         :X  a  U(       d  [        nU R                  XS9$ )z@
Return the width of a single character out of the stored text.
)r   r   )SOFT_HYPHENHYPHENr   )r(   r   print_shr   s       r)   get_character_widthFragment.get_character_width   s$     #HI~~I~EEr,   c                     U R                   (       a4  U R                  (       a  U R                  XEXc5      $ U R                  X5      $ U R	                  X5      $ r$   )r@   r   render_with_text_shapingrender_pdf_text_ttfrender_pdf_text_core)r(   frag_ws
current_wsword_spacingadjust_xadjust_yhs          r)   render_pdf_textFragment.render_pdf_text  sP    ++44  ++GBB((==r,   c           	      r   SnSnU R                    HH  nU R                  R                  R                  [	        U5      5      nU(       d  M:  U[        U5      -  nMJ     U(       Ga   [        SR                  S5      R                  S5      5      nUR                  [        U R                  R                  R                  [	        S5      5      5      5      n/ n	[        U5       H  u  p[        UR                  S5      R                  S5      5      nU
S:X  a  U	R                  SU S35        MK  XR                  -  * S-  U R                  -  nU	R                  US	 SU U S35        M     SR                  U	5      nUS
U S3-  nU$ [        UR                  S5      R                  S5      5      nUSU S3-  nU$ )Nr   r   	utf-16-belatin-1r   (r.     .3f[z] TJ) Tj)r   r8   subsetpickordchrr   encodedecodesplit	enumerateappendr!   rJ   r   )r(   r   r   retmapped_textcharmapped_charu_spacewords
words_strlword_iwordadjescaped_texts                 r)   r   Fragment.render_pdf_text_ttf  s   KKD))**//D	:K{s;//   #CJJ{$;$B$B9$MNG  %%c$))*:*:*?*?C*I&JKEJ )% 0$T[[%=%D%DY%OPQ;%%$qk2#ff,-4t7H7HHC%%S	7)D6&CD !1 88J/LQ|nD))C 
	 )"";/66yAL Q|nD))C
r,   c                   ^  SnSnT R                   R                  R                  [        S5      5      nU 4S jnT R                  T R
                  S-  -  T R                  -  n	T R                   R                  T R                  T R                  T R                  5       GHA  n
U
S   c  M  [        U
S   5      R                  S5      R                  S5      nU
S   S	:w  d	  U
S
   S	:w  a_  U(       a  US[        U5       S3-  nSnX" U
S   5      -   nX(" U
S
   5      -
  nUSUT R                  -  S SX=-
  T R                  -  S S3-  nXk-  nX" U
S   5      U	-   -  nX(" U
S   5      -  nU(       a  U
S   U:X  a  X-  nU
S   (       d  U(       d  M  U
S   U:X  d  M  U(       a  US[        U5       S3-  nSnUSUT R                  -  S SX2-
  T R                  -  S S3-  nGMD     U(       a  US[        U5       S3-  nU$ )Nr   r   c                    > U TR                   R                  -  TR                  -  TR                  S-  -  S-  TR                  -  $ )Nr   r   )r8   scalerJ   r\   r!   )posr(   s    r)   
adjust_pos5Fragment.render_with_text_shaping.<locals>.adjust_pos8  sV    ))//"##$ ''#-/ 	
 &&r,   r   r   r   r   x_offsetr   y_offsetr   z) Tj z1 0 0 1 z.2fz Tm 	x_advance	y_advanceforce_positioningr   )r8   r   r   r   r_   r\   r!   
shape_textr   rJ   r   r   r   r   r   )r(   pos_xpos_yr   r   r   textspace_mapped_coder   r_   tir   offsetxoffsetys   `             r)   r   !Fragment.render_with_text_shaping3  s2    II,,11#c(;	 ((D,@,@3,FG$&&P))&&KK**D,H,H
B - (r-()00=DDYOD*~"bn&9Q}T23599CD*R
^"<<*R
^"<<4661#6a8Ns7SSWX LDZ;0<??EZ;00E= 15F F% %&M!26G!GQ}T23599CD5DFF"23!7q!)tvv9Mc8RRVWW9
< Q}T*+400C
r,   c                 z    SnX:w  a  X1U R                   -  S S3-  n[        U R                  5      nUSU S3-  nU$ )Nr   r   z Tw r   r   )r!   r   r   )r(   r   r   r   r   s        r)   r   Fragment.render_pdf_text_coree  sN     &s+400C$T[[1<.%%
r,   r/   r$   )r   NNT)r   r   )FT)5__name__
__module____qualname____firstlineno____doc__r   r'   r&   dictfloatr   intr*   r1   propertyr   r   r8   setterr@   rC   rG   rJ   rY   r\   r_   rb   rf   ri   rl   ro   rr   ru   rK   r~   r   r   r   r   r   r   r   r   r   boolr   r   r   r   r   r   r   __static_attributes__ r,   r)   r   r   -   s    +/$)$  	
 uS#X'
 3eHg-. 3 3 
[[0 0 5 5 1 1 2 2   < < 6 6 3 3 0 0 0 0 4 4 1 1 1 1 1 1 1 1 0 0 : : ( (     3 3 
 
 
 
2# 2
C 
D
 "" " 	"
 "H
FS F>%N0dr,   r   c                   L   ^  \ rS rSrSrU 4S jrS rS rS\4U 4S jjr	Sr
U =r$ )	TotalPagesSubstitutionFragmentin  aH  
A special type of text fragment that represents a placeholder for the total number of pages
in a PDF document.

A placeholder will be generated during the initial content rendering phase of a PDF document.
This placeholder is later replaced by the total number of pages in the document when the final
output is being produced.
c                 D   > [         TU ]  " U0 UD6  [        5       U l        g r$   )superr*   r
   uuid)r(   argskwargsr   s      r)   r*   'TotalPagesSubstitutionFragment.__init__x  s    $)&)G	r,   c                 "    SU R                    S3$ )z
This method returns a placeholder string containing a universally unique identifier (UUID4),
ensuring that the placeholder is distinct and does not conflict with other placeholders
within the document.
z::placeholder:z::)r  r0   s    r)   get_placeholder_string5TotalPagesSubstitutionFragment.get_placeholder_string|  s      		{"--r,   c                 :    Xl         X l        U R                  5       $ )a;  
This method is invoked during the page content rendering phase, which is common to all
`Fragment` instances. It stores the provided arguments and keyword arguments to preserve
the necessary information and graphic state for the final substitution rendering.

The method then returns the unique placeholder string.
)_render_args_render_kwargsr  )r(   r  r  s      r)   r   .TotalPagesSubstitutionFragment.render_pdf_text  s     !$**,,r,   replacement_textc                 l   > [        U5      U l        [        TU ]  " U R                  0 U R
                  D6$ )z
This method is invoked at the output phase. It calls `render_pdf_text()` from the superclass
to render the fragment with the preserved rendering state (stored in `_render_args` and `_render_kwargs`)
and insert the final text in place of the placeholder.
)r'   r   r  r   r  r  )r(   r  r   s     r)   render_text_substitution7TotalPagesSubstitutionFragment.render_text_substitution  s3     /0w&(9(9QT=P=PQQr,   )r  r  r   r  )r   r   r   r   r   r*   r  r   r&   r  r   __classcell__)r   s   @r)   r  r  n  s+    .
-R R Rr,   r  c                       \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   Sr	\
\S	'   Sr\
\S
'   Sr\\S'   S rSrg)TextLinei  	fragments
text_widthnumber_of_spacesalignheight	max_widthFtrailing_nltrailing_form_feedr   indentc                 n   U R                   (       d
  [        5       $ / nS nU R                    HG  nUR                  U:X  a  US   R                  U5        M)  UR                  U/5        UR                  nMI     U R                   S   R                  [
        R                  :X  dI  U R                   S   R                  (       d3  U R                   S   R                  [
        R                  :X  a  US S S2   n/ nU H1  nUUS   R                  [
        R                  :X  a  US S S2   OU-  nM3     [        U5      $ )Nr   )r  tupler   r   r   r   RTL)r(   directional_runs	directionfragmentordered_fragmentsruns         r)   get_ordered_fragmentsTextLine.get_ordered_fragments  s   ~~7N	H**i7 $++H5 ''
3$77	 ' >>!00M4E4EEq!55q!448I8II/"5#C V66-:K:KKDbD	QT $ &''r,   r  N)r   r   r   r   r#  __annotations__r   r   r   r  r   r  r   r*  r   r  r,   r)   r  r    sH    LMK$$FE(r,   r  c                   R    \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   Srg	)
	SpaceHinti  original_fragment_indexoriginal_character_indexcurrent_line_fragment_indexcurrent_line_character_indexru   r  r  N)r   r   r   r   r   r,  r   r   r  r,   r)   r.  r.    s&      !!!$$"%%r,   r.  c                   z    \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   \\S	'   \\S
'   \\S'   Sr	g)
HyphenHinti  r/  r0  r1  r2  ru   r  curcharcurchar_widthr    r!   r  N)
r   r   r   r   r   r,  r   r&   r   r   r  r,   r)   r4  r4    s<      !!!$$"%%LHr,   r4  c                       \ rS rSrSS\S\S\4S jjr\S 5       r SS\	S	\S
\
S\S\S\S\	4S jjrS rS\\\4   4S jr SS\S\S\4S jjrS rS\4S jrSrg)CurrentLinei  r  r   r   c                 n    Xl         X l        X0l        / U l        SU l        SU l        SU l        SU l        g)z
Per-line text fragment management for use by MultiLineBreak.
    Args:
        print_sh (bool): If true, a soft-hyphen will be rendered
            normally, instead of triggering a line break. Default: False
r   N)r  r   r   r  r  r  space_break_hinthyphen_break_hint)r(   r  r   r   s       r)   r*   CurrentLine.__init__  s;     # )+ ! !%!%r,   c                 n    Sn[        U R                  5       H  u  p#XR                  US:  S9-  nM     U$ )Nr   r   )r   r  r   )r(   r   ir'  s       r)   r   CurrentLine.width  s;    $T^^4KA''1q5'99E 5r,   Nr   character_widthoriginal_fragmentr/  r0  r  urlc                 z   U[         :w  d   eX`l        U R                  (       d@  U R                  R                  UR	                  SUR
                  UR                  US95        Ow[        U[        5      (       ab  UR                  U R                  S   5      (       d?  U R                  R                  UR	                  SUR
                  UR                  US95        U R                  S   nU[        ;   ae  [        UU[        U R                  5      [        UR                  5      U R                  U R                  5      U l        U =R                  S-  sl        OU["        :X  a  [$        nU =R                  S-  sl        OU[&        :X  a|  U R(                  (       dk  [+        UU[        U R                  5      [        UR                  5      U R                  U R                  [,        UUR
                  UR                  5
      U l        U[&        :w  d  U R(                  (       a  UR                  R                  U5        g g )Nr   r/   r"  r   )NEWLINEr  r  r   r   r    r!   r%   r   r   BREAKING_SPACE_SYMBOLS_STRr.  lenr   r   r  r:  NBSPSPACEr   r   r4  r   r;  )	r(   r   rA  rB  r/  r0  r  rC  active_fragments	            r)   add_characterCurrentLine.add_character  s    G###~~NN!!!++!#4#C#C'))	 ,  x
 
#224>>"3EFFNN!!!++!#4#C#C'))	 ,  ..,22$-'(DNN#O../

%%%D! !!Q&!$I!!Q&!+%dmm%/'(DNN#O../

%%!00!##&D" #t}}&&--i8 (5r,   c                 @   U R                   (       d  g U R                   S   nUR                  S   nUS:X  ah  UR                  S5        UR                  (       d  U R                   S	 U R                   (       d  g U R                   S   nUR                  S   nUS:X  a  Mg  g g )Nr"  r   )r  r   r   )r(   	last_frag	last_chars      r)   trim_trailing_spaces CurrentLine.trim_trailing_spaces<  s    ~~NN2&	((,	3NN2''NN2&>>r*I!,,R0I 3r,   
break_hintc                     U R                   SUR                   U l         U R                   (       a(  U R                   S   R                  UR                  5        UR                  U l        g)z
This function mutates the current_line, applying one of the states
observed in the past and stored in
`hyphen_break_hint` or `space_break_hint` attributes.
Nr"  )r  r1  r   r2  r  )r(   rR  s     r)   _apply_automatic_hint!CurrentLine._apply_automatic_hintJ  sO     (P**P*PQ>>NN2##J$K$KL * ; ;r,   r  r  r  c                     [        U R                  U R                  U R                  UU R                  U R
                  U R                  -
  UUU R                  S9	$ )N)	r  r  r  r  r  r  r  r  r   )r  r  r   r  r  r  r   )r(   r  r  r  s       r)   manual_breakCurrentLine.manual_breakU  sO     nnzz!22;;nnt{{2#1;;

 
	
r,   c                 H    U R                   S L=(       d    U R                  S L$ r$   )r;  r:  r0   s    r)   automatic_break_possible$CurrentLine.automatic_break_possibled  s$    %%T1VT5J5JRV5VVr,   c                    U R                  5       (       d   eU R                  Gb  U R                  b.  U R                  R                  U R                  R                  :  a  U R	                  U R                  5        U R                  U R                  R                  U R                  R                  U R                  U R                  R                  U R                  R                  U R                  5        U R                  R                  U R                  R                  U R                  U5      4$ U R	                  U R                  5        U R                  R                  U R                  R                  U R                  U5      4$ r$   )rZ  r;  r:  ru   rT  rK  r5  r6  r/  r0  r  rW  )r(   r  s     r)   automatic_breakCurrentLine.automatic_breakg  sA   ,,....!!-!!)%%0043H3H3S3SS&&t'='=>&&..&&44&&&&>>&&?? &&>>&&??!!%( 
 	""4#8#89!!99!!::e$
 	
r,   )r  r  r;  r   r  r  r   r:  )Fr   r$   )FF)r   r   r   r   r   r   r*   r   r   r&   r   r   rK  rP  r   r.  r4  rT  r   rW  rZ  r]  r   r  r,   r)   r8  r8    s    &% &4 & &8   C9C9 C9 $	C9
 "%C9 #&C9 C9 C9J1	<i6K0L 	< SX

)-
KO
W
U 
r,   r8  c                       \ rS rSr\R
                  S\R                  SSS4S\\	   S\
\\4   S\\   S\S	\S
\S\S\S\4S jjrS rSrg)MultiLineBreaki  Fg      ?r   r  r  marginsr  r   wrapmodeline_heightskip_leading_spacesfirst_line_indentc
                    ^ Xl         [        T5      (       a  TU l        OU4S jU l        X0l        X@l        XPl        X`l        Xpl        Xl        SU l	        SU l
        SU l        Xl        SU l        g)a  Accept text as Fragments, to be split into individual lines depending
on line width and text height.
Args:
    fragments: A sequence of Fragment()s containing text.
    max_width: Either a fixed width as float or a callback function
        get_width(height). If a function, it gets called with the largest
        height encountered on the current line, and must return the
        applicable width for the line with the given height at the current
        vertical position. The height is relevant in those cases where the
        lateral boundaries of the enclosing TextRegion() are not vertical.
    margins (sequence of floats): The extra clearance that may apply at the beginning
        and/or end of a line (usually either FPDF.c_margin or 0.0 for each side).
    align (Align): The horizontal alignment of the current text block.
    print_sh (bool): If True, a soft-hyphen will be rendered
        normally, instead of triggering a line break. Default: False
    wrapmode (WrapMode): Selects word or character based wrapping.
    line_height (float, optional): A multiplier relative to the font
        size changing the vertical space occupied by a line of text. Default 1.0.
    skip_leading_spaces (bool, optional): On each line, any space characters
        at the beginning will be skipped. Default value: False.
    first_line_indent (float, optional): left spacing before first line of text in paragraph.
c                    > T$ r$   r  )r  r  s    r)   <lambda>)MultiLineBreak.__init__.<locals>.<lambda>  s    Ir,   r   NT)r  callabler   ra  r  r   rb  rc  rd  fragment_indexcharacter_indexidx_last_forced_breakre  _is_first_line)
r(   r  r  ra  r  r   rb  rc  rd  re  s
     `       r)   r*   MultiLineBreak.__init__  sj    F #I&DN5DN
  &#6  %)"!2"r,   c           	         SnU R                   nS U l         U R                  [        U R                  5      :X  a  g SnU R	                  U5      n[        UU R                  U R                  (       a  U R                  OSS9nU R                   H  nXF-  nM	     U R                  (       a  X@R                  -  nU R                  (       a  U R                  [        U R                  5      :  a  U R                  [        U R                  U R                     R                  5      :  a  SU l        U =R                  S-  sl        M{  U R                  U R                     R                  U R                     nU[        :X  a  U =R                  S-  sl        OO%U R                  [        U R                  5      :  a  M  U R                  [        U R                  5      :  Ga  U R                  U R                     nUR                  U:  aY  UR                  nU R	                  U5      nXEl        U R                   H  nXF-  nM	     U R                  (       a  X@R                  -  nU R                  [        UR                  5      :  a  SU l        U =R                  S-  sl        M  UR                  U R                     nUR!                  XpR                  U(       + S9n	SnU["        [$        4;   a  U =R                  S-  sl        UR                  (       d  X0R&                  -  Ul        SU l        UR+                  U R,                  [.        R0                  :X  a  [.        R2                  OU R,                  U["        :H  U[$        :H  S9$ UR4                  U	-   U:  GaW  SU l        U[6        ;   a0  U =R                  S-  sl        UR+                  U R,                  5      $ U R8                  [:        R<                  :X  a+  UR?                  5         UR+                  U R,                  5      $ URA                  5       (       a@  URC                  U R,                  5      u  U l        U l        n
U =R                  S-  sl        U
$ X R                  :X  a  [E        S5      eU R                  U l         UR+                  U R,                  [.        R0                  :X  a  [.        R2                  5      $ U R,                  5      $ URG                  UU	UU R                  U R                  X0R&                  -  URH                  5        U =R                  S-  sl        U R                  [        U R                  5      :  a  GM  UR4                  (       aT  SU l        UR+                  U R,                  [.        R0                  :X  a  [.        R2                  5      $ U R,                  5      $ g )	NTr   )r  r   r   r   r>  F)r  r  z8Not enough horizontal space to render a single character)%rm  rk  rG  r  r   r8  r   rn  re  ra  rd  rl  r   rI  rY   r  r   rE  	FORM_FEEDrc  r  rW  r  r   JLr   rF  rb  r   CHARrP  rZ  r]  r   rK  r"   )r(   
first_charrm  current_font_heightr  current_linemarginr   current_fragmentrA  lines              r)   get_lineMultiLineBreak.get_line  s   
 $ : :%)"#dnn"55NN#67	"]]-1-@-@4))a
 llFI #///I## %%DNN(;;''3NN4#6#67BB,  ,-D(''1,' NN4+>+>?JJ((	 %((A-( %%DNN(;; !!C$77#~~d.A.AB)),??&6&@&@# NN+>?	)2&"llF'I +&&!7!77I##s+;+F+F'GG'($##q(#(33D4H4HII.BB==^ C O JWi00$$)$#--*=@P@P*PL'&+##00#zzUWW4EGG$** )W 4'0I'= 1  
 !!O3i?&+#!;;((A-('44TZZ@@==HMM1 !557'44TZZ@@88::
 %44TZZ@	+,((A-(K(,@,@@'R  .2-A-A*#00#zzUWW4EGG :>**  && ##$$#&6&66 %%   A% Q !!C$77T "'D,,::0 6:jj  r,   )rn  r  rl  re  rk  r  r   rm  rc  ra  r   rd  rb  N)r   r   r   r   r   rs  r   WORDr	   r   r   r   rj  r   r   r*   r{  r   r  r,   r)   r`  r`    s     ww%]] $)#$2#H%2# )2# &!	2#
 2# 2# 2# 2# "2# !2#jxr,   r`  N)(r   numbersr   typingr   r   r   r   r   r	   r  r
   enumsr   r   r   r   errorsr   fontsr   r   utilr   r   r   rI  BREAKING_SPACE_SYMBOLSr   rF  rH  rE  rq  r   r  r  r.  r4  r8  r`  r  r,   r)   <module>r     s     C C  ; ; ! $ 	 "  WW%;< 
	~ ~B
)RX )RX (z  (F
 
 
m
 m
`n nr,   