
    Bhj                     
   S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
JrJr  SSKJrJr  SS	KJr  S
SKJrJrJr  S
SKJrJrJrJr  S V Vs0 s H  u  pU \S   U-  _M     snn rS
SSS.r\S   \S   :X  d   eSSSSSSSSSS.	SSSSSSSSSS.	S.rS VVVVs0 s H  u  p#pEU\" X55      \" XE5      4_M     snnnnr\" S \RA                  5        5       5      (       d   e\S   r!\"" S \! 5       5      \S'   0 r#SS jr$S  r%S! r&\%" S"5      S# 5       r'\%" S$5      \%" S%5      S& 5       5       r(\%" S'5      S( 5       r)\%" S)5      \%" S5      \%" S*5      S+ 5       5       5       r*\%" S,5      \%" S-5      S. 5       5       r+\%" S/5      \%" S05      \%" S15      \%" S25      \%" S35      \%" S45      \%" S55      \%" S65      \%" S75      \%" S85      \%" S95      \%" S:5      \%" S;5      \%" S<5      \%" S=5      \%" S>5      \%" S?5      \%" S@5      \%" SA5      \%" SB5      \%" SC5      \%" SD5      \%" SE5      SSG j5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       r,\%" SH5      \%" SI5      \%" SJ5      \%" SK5      SL 5       5       5       5       r-\%" SM5      SN 5       r.\%" SO5      SP 5       r/\%" SQ5      SR 5       r0\%" SS5      \%" ST5      \%" SU5      \%" SV5      \%" SW5      \%" SX5      SY 5       5       5       5       5       5       r1\%" SZ5      \%" S[5      S\ 5       5       r2\%" S]5      \%" S^5      S_ 5       5       r3\%" S`5      \%" Sa5      Sb 5       5       r4\%" Sc5      \%" Sd5      Se 5       5       r5\%" Sf5      \%" Sg5      Sh 5       5       r6\%" Si5      \%" Sj5      \%" Sk5      \%" Sl5      Sm 5       5       5       5       r7\%" Sn5      \%" So5      Sp 5       5       r8Sq r9\%" Sr5      Ss 5       r:\%" St5      Su 5       r;\%" Sv5      Sw 5       r<\%" Sx5      Sy 5       r=\%" Sz5      S{ 5       r>\%" S|5      S} 5       r?\%" S~5      S 5       r@S rAS rB\%" S5      \%" S5      S 5       5       rC\%" S5      \%" S5      S 5       5       rD\%" S5      S 5       rE\%" S5      S 5       rF\%" S5      S 5       rG\%" S5      S 5       rH\%" S5      S 5       rI\%" S5      S 5       rJ\%" S5      S 5       rK\%" S5      S 5       rLSS jrMS rNgFs  snn f s  snnnnf )z7Convert specified property values into computed values.    )pi)unquote)parse_color   )LOGGER)
FROM_UNITSffipango)Layoutfirst_line_metrics)get_link_attribute   )INITIAL_VALUESZERO_PIXELS	Dimension)ANGLE_TO_RADIANSLENGTH_UNITSLENGTHS_TO_PIXELSsafe_urljoin))zxx-smallg333333?)zx-smallg      ?)smallgqq?)mediumr   )large333333?)zx-largeg      ?)zxx-larger   	font_size      )thinr   thickborder_top_widthr         )	d      i,  r      iX  r!   i   r"   r#   bolderlighter)/)a10   %   mm)a9r+   4   r,   )a8r.   J   r,   )a7r0   i   r,   )a6r2      r,   )a5r4      r,   )a4r6   )  r,   )a3r8     r,   )a2r:   R  r,   )a1r<   I  r,   )a0r>   i  r,   )b10   ,   r,   )b9rB   >   r,   )b8rD   X   r,   )b7rF   }   r,   )b6rH      r,   )b5rJ      r,   )b4rL   a  r,   )b3rN   r%   r,   )b2r%     r,   )b1rQ     r,   )b0rS   i  r,   )c10   (   r,   )c9rW   9   r,   )c8rY   Q   r,   )c7r[   r   r,   )c6r]      r,   )c5r_      r,   )c4ra   D  r,   )c3rc     r,   )c2re     r,   )c1rg     r,   )c0ri   i  r,   )zjis-b10    -   r,   )zjis-b9rl   @   r,   )zjis-b8rm   [   r,   )zjis-b7rn      r,   )zjis-b6ro      r,   )zjis-b5rp     r,   )zjis-b4rq   l  r,   )zjis-b3rr     r,   )zjis-b2rs     r,   )zjis-b1rt     r,   )zjis-b0ru   i  r,   )letter      !@   in)legalrw      ry   )ledgerrx      ry   c              #   X   #    U  H   u  pUR                   UR                   :  v   M"     g 7fN)value).0widthheights      P/var/www/html/env/lib/python3.13/site-packages/weasyprint/css/computed_values.py	<genexpr>r   y   s!     
O;N-%5;;%;Ns   (*r7   c              #   `   #    U  H$  oR                   [        UR                     -  v   M&     g 7fr   )r   r   unit)r   sizes     r   r   r   |   s&      M:K$JJ"499--:Ks   ,.r   c                     [        U S   U S   U S   U S   U S   U S   U S   U S   U S	   U S
   U S   U S   U S   U S   45      nU(       a   U[        U S   5      [        U S   5      -   -  nU$ )Nfont_family
font_stylefont_stretchfont_weightfont_variant_ligaturesfont_variant_positionfont_variant_capsfont_variant_numericfont_variant_alternatesfont_variant_east_asianfont_feature_settingsfont_variation_settingsfont_language_overridelangr   line_heightstr)styleinclude_sizekeys      r   _font_style_cache_keyr      s    
mlnm&'%&!"$%'('(%&'(&'f C  s5%&U=-A)BBBJ    c                 8   ^  T R                  SS5      m U 4S jnU$ )z9Decorator registering a property ``name`` for a function.-_c                    > U [         T'   U $ )z0Register the property ``name`` for ``function``.)COMPUTER_FUNCTIONS)functionnames    r   	decorator$register_computer.<locals>.decorator   s    #+4 r   )replace)r   r   s   ` r   register_computerr      s     <<S!D r   c                    Uu  p#US:X  d   eUu  pEn U R                   R                  XF5      nUS:X  a   XW4$ US:X  aD  UR                  S5      (       a  S[        USS  5      4nGOS[	        U R
                  U5      4n XW4$ US:X  a  [        UR                  5       5      nXW4$ US	:X  a  [        UR                  5       5      nXW4$ US
:X  a  [        UR                  5       5      nXW4$ US:X  a(  [        [        UR                  5       5      S5      nSnXW4$ U[        ;   a(  [        [        UR                  5       5      U5      nSnXW4$ U[        ;   a%  [        [        UR                  5       5      U5      nSnXW4$ ! [         a     g f = f)Nattr()stringurl#internalr   externalcolorintegernumber%lengthangle)elementget
startswithr   r   base_urlr   stripintfloatr   r   r   	Exception)r   values	func_namer   	attr_nametype_or_unitfallback
attr_values           r   compute_attrr      s   I   (-%IX]]&&y;
8#0 %%/ U"$$S))('*QR.*AB
 U^^Z HJ
& %%# W$$Z%5%5%78J  %% Y&Z--/0J %% X%z//12J %% S "5)9)9);#<cBJ#L %% \)"5)9)9);#<lKJ#L %% --"5)9)9);#<lKJ"L %%  s;   !E: AE: E: $E: E: (+E: /E: /E: :
FFzbackground-imagec                    ^ ^ U H  u  p4US;   a%  [        UU 4S jUR                   5       5      Ul        US:X  d  M8  [        T TUR                  45      u  Ul        UR                  S:X  d  Mi  [        T TUR                  5      Ul        M     U$ )z-Compute lenghts in gradient background-image.)zlinear-gradientradial-gradientc              3   H   >#    U  H  nUb  [        TTU5      OS v   M     g 7fr   r   )r   posr   r   s     r   r   #background_image.<locals>.<genexpr>   s*      )1/C -0OudC(E/s   "r   explicit)tuplestop_positionscompute_positioncenter	size_typelength_or_percentage_tupler   r   r   r   type_r   s   ``   r   background_imager      s     ::#( )1 //)1 $1E  %%,tell_.MEL*,74-
  Mr   zbackground-positionzobject-positionc                 2   ^ ^ [        UU 4S jU 5       5      $ )z'Compute lengths in background-position.c           	   3   b   >#    U  H$  u  pp4U[        TTU5      U[        TTU5      4v   M&     g 7fr   r   )r   origin_xpos_xorigin_ypos_yr   r   s        r   r   #compute_position.<locals>.<genexpr>   s=      8 17,HX 
6%u-	6%u-	/06s   ,/r   r   r   r   s   `` r   r   r      s!      8 178 8 8r   ztransform-originc                 2   ^ ^ [        UU 4S jU 5       5      $ )z5Compute the lists of lengths that can be percentages.c              3   >   >#    U  H  n[        TTU5      v   M     g 7fr   r   r   r   r   r   s     r   r   -length_or_percentage_tuple.<locals>.<genexpr>        @tU++   r   r   s   `` r   r   r      s     @@@@r   zborder-spacingclipc                 2   ^ ^ [        UU 4S jU 5       5      $ )z.Compute the properties with a list of lengths.c              3   <   >#    U  H  n[        TTUS S9v   M     g7f)Tpixels_onlyNr   r   s     r   r   length_tuple.<locals>.<genexpr>   s       JBHudEt4&s   r   r   s   `` r   length_tupler      s#    
  JBHJ J Jr   zbreak-afterzbreak-beforec                     US:X  a  S$ U$ )z<Compute the ``break-before`` and ``break-after`` properties.alwayspage r   r   r   s      r   break_before_afterr      s     h&61E1r   toprightleftbottomz
margin-topzmargin-rightzmargin-bottomzmargin-leftr   r   z	min-widthz
min-heightz	max-widthz
max-heightzpadding-topzpadding-rightzpadding-bottomzpadding-leftztext-indentzhyphenate-limit-zonez
flex-basisztext-underline-offsetztext-decoration-thicknessNc                 0   US;   a  U$ UR                   S:X  a  U(       a  S$ [        $ UR                  nUS:X  a  U(       a  UR                   $ U$ U[        ;   a  UR                   [        U   -  nOUS;   a  Uc  U S   nUS:X  a  [	        U S5      nUR                   U-  U-  nO`US:X  a  [	        U S	5      nUR                   U-  U-  nO;US
:X  a  UR                   U-  nO%US:X  a  UR                   U R
                  S   -  nOU$ U(       a  W$ [        WS5      $ )zCompute a length ``value``.)autocontentz	from-fontr   px)emexchremr   r   xr   0r   r   )r   r   r   r   character_ratio
root_styler   )r   r   r   r   r   r   resultratios           r   r   r      s   2 00{{aq0[0::Dt|)u{{4u4	"	"066	*	*k*I4<#E3/E[[9,u4FT\#E3/E[[9,u4FT\[[9,FU][[5#3#3K#@@F  6=i&==r   z
bleed-leftzbleed-rightz	bleed-topzbleed-bottomc                 ^    US:X  a  [        SU S   ;   a  SS5      $ SS5      $ [        XU5      $ )Nr   cropmarks   r   r   )r   r   r   s      r   bleedr	  2  s:    
 fg6tDDAtDDe5))r   zletter-spacingc                 (    US:X  a  U$ [        XUSS9$ )NnormalTr   r   r   s      r   pixel_lengthr  =  s    e5d;;r   zbackground-sizec                 2   ^ ^ [        UU 4S jU 5       5      $ )z+Compute the ``background-size`` properties.c              3   N   >#    U  H  nUS ;   a  UO[        TTU5      v   M     g7f))containcoverN)r   r   s     r   r   "background_size.<locals>.<genexpr>H  s3       E .."5$6	7s   "%r   r   s   `` r   background_sizer  E  s!         r   zimage-orientationc                 T    US;   a  U$ Uu  p4[        U[        -  S-  5      S-  S-  U4$ )z-Compute the ``image-orientation`` properties.)nonez
from-imager      Z   )roundr   )r   r   r   r   flips        r   image_orientationr  N  s;     ''KE%"*q.!A%*D11r   zborder-top-widthzborder-right-widthzborder-left-widthzborder-bottom-widthzcolumn-rule-widthzoutline-widthc                     XR                  SS5         nUS;   a  gU[        ;   a	  [        U   $ [        U[        5      (       a  U$ [	        XUSS9$ )z*Compute the ``border-*-width`` properties.r   r   )r  hiddenr   Tr   )r   BORDER_WIDTH_KEYWORDS
isinstancer   r   )r   r   r   border_styles       r   border_widthr  W  sZ     gw78L))%%$U++% %u$77r   zborder-image-slicezmask-border-slicec                 B   / nSnU HB  nUS:X  a  UnM  Uu  pgUc  UR                  U5        M'  UR                  [        US5      5        MD     [        U5      S:X  a  US-  nO8[        U5      S:X  a  US-  nO#[        U5      S:X  a  UR                  US   5        / UQUP7$ )z,Compute the ``border-image-slice`` property.Nfillr   r   r  r   r   )appendr   len)r   r   r   computed_valuesr!  r   r   r   s           r   border_image_slicer%  n  s     ODF?D LF|&&v.&&y'=>  ?q 1	_		"1	_		"q12#_#d##r   zborder-image-widthzmask-border-widthc                 .   / nU H6  nUS:X  a  UR                  U5        M  Uu  pVUR                  Uc  UOU5        M8     [        U5      S:X  a  US-  nO8[        U5      S:X  a  US-  nO#[        U5      S:X  a  UR                  US   5        [        U5      $ )z,Compute the ``border-image-width`` property.r   r   r  r   r   )r"  r#  r   )r   r   r   r$  r   r   r   s          r   border_image_widthr'    s     OF?""5) LF""T\6uE  ?q 1	_		"1	_		"q12!!r   zborder-image-outsetzmask-border-outsetc                 .   U Vs/ s H,  n[        U[        [        45      (       a  UO[        XU5      PM.     nn[	        U5      S:X  a  US-  nO8[	        U5      S:X  a  US-  nO#[	        U5      S:X  a  UR                  US   5        [        U5      $ s  snf )z-Compute the ``border-image-outset`` property.r   r  r   r   )r  r   r   r   r#  r"  r   )r   r   r   r   r$  s        r   border_image_outsetr)    s     E EC<00fU%6PP   ?q 1	_		"1	_		"q12!!s   3Bzborder-image-repeatzmask-border-repeatc                 .    [        U5      S:X  a  US-  $ U$ )z-Compute the ``border-image-repeat`` property.r   r   )r#  r   s      r   border_image_repeatr+    s     v;!+FQJ77r   zcolumn-widthzoutline-offsetc                     [        XUSS9$ )z Compute a pixel length property.Tr   r   r   s      r   length_pixels_onlyr-    s     %u$77r   zborder-top-left-radiuszborder-top-right-radiuszborder-bottom-left-radiuszborder-bottom-right-radiusc                 2   ^ ^ [        UU 4S jU 5       5      $ )z+Compute the ``border-*-radius`` properties.c              3   >   >#    U  H  n[        TTU5      v   M     g 7fr   r   r   s     r   r    border_radius.<locals>.<genexpr>  r   r   r   r   s   `` r   border_radiusr1    s     @@@@r   z
column-gapzrow-gapc                 *    US:X  a  U$ [        XU5      $ )z!Compute the ``*-gap`` properties.r  r   r   s      r   gapr3    s     %u%%r   c           
         / nU H  nUS   S;   a  UnOnUS   S:X  a  US   S   S:X  d   e[        X5      nOKUS   S;   a  UnO?US   S;   a6  US   S   nUS   S:X  a#  [        X5      nUc  S nOUS   U4US   SS  -   4nOUnWc@  [        R                  " SU R                  < S	S
R	                  S U 5       5      < 35        M  UR                  U5        M     [        U5      $ )Nr   )r   r   r   quotezleader()r   r   r   )z	counter()z
counters()z	content()z	element()zstring())ztarget-counter()ztarget-counters()ztarget-text()zUnable to compute z value for content: z, c              3   8   #    U  H  n[        U5      v   M     g 7fr   r   )r   items     r   r    _content_list.<locals>.<genexpr>  s     (EutTus   )r   r   warningr   joinr"  r   )r   r   r$  r   computed_valueanchor_tokenattrs          r   _content_listr>    s   O8HH"N1X!8A;(***)%7N1X   #N1X J J 8A;LA(*#E8<%)N&+Ah$58AB<1G%IN!&!NNtyy(Eu(EEG H "">29 < !!r   zbookmark-labelc                     [        X5      $ )z(Compute the ``bookmark-label`` property.r>  r   s      r   bookmark_labelrA    s     ''r   z
string-setc                 .   ^  [        U 4S jU 5       5      $ )z$Compute the ``string-set`` property.c              3   L   >#    U  H  nUS    [        TUS   5      4v   M     g7f)r   r   Nr@  )r   
string_setr   s     r   r   string_set.<locals>.<genexpr>  s,      " J 
AeZ];< s   !$r   r   s   `  r   rD  rD    s      " " " "r   r   c                     [        U5      S:X  a&  Uu  nUS:X  a  U R                  (       a  S$ S$ US:X  a  g[        X5      $ )z!Compute the ``content`` property.r   r  inhibitcontentsr  )r#  pseudo_typer>  )r   r   r   r   s       r   r   r     sG     6{aH % 1 19AzAf_''r   displayc                     U R                   S   nU R                   S   nUS;   d  US:w  d  U R                  (       aA  US:X  a  g[        U5      S:X  a  US   R                  S	5      (       a  g
US   S:X  a  SU;   a  gg
U$ )z!Compute the ``display`` property.r   positionabsolutefixedr  )zinline-table)blocktabler   r   ztable-)rP  flowinline	list-item)rP  rR  rT  )	specifiedis_root_elementr#  r   )r   r   r   float_rL  s        r   rJ  rJ    s     __W%Fz*H((Ff,<!!%%%Z1_q!4!4X!>!>$1X!e#5(Lr   r   c                 D    U R                   S   nUS;   d	  US   S:X  a  gU$ )zCompute the ``float`` property.rL  rM  r   z	running()r  )rU  )r   r   r   rL  s       r   compute_floatrY    s.     z*H((HQK;,Fr   z	font-sizec                    U[         ;   a	  [         U   $ [        [         R                  5       5      nU R                  c
  [        S   nOU R                  S   nUS:X  a$  [        U5       H  u  pVXd:  d  M  X5   s  $    US-  $ US:X  a.  [        USSS2   5       H  u  pVXd:  d  M  X5* S-
     s  $    US-  $ UR                  S	:X  a  UR                  U-  S
-  $ [        XUSUS9$ )z#Compute the ``font-size`` property.Nr   largerr   smallerr   g?r   r#   T)r   r   )	FONT_SIZE_KEYWORDSlistr   parent_styler   	enumerater   r   r   )r   r   r   keyword_valuesparent_font_sizeikeyword_values          r   r   r   '  s    ""!%((,3356N!)+6 --k: ). 9A/%(( !: $c))	)	 ).2*> ?A/%b1f-- !@ $c))	s	{{--33D&( 	(r   zfont-weightc                     US:X  a  gUS:X  a  gUS;   a2  U R                   c
  [        S   nOU R                   S   n[        U   U   $ U$ )z%Compute the ``font-weight`` property.r  r    boldr!   r&   r   )r`  r   FONT_WEIGHT_RELATIVE)r   r   r   parent_values       r   r   r   G  s]     	&	'	'%)-8L --m<L#E*<88r   c                 z    US;   a  U$ [        U[        5      (       a  UR                  S:X  a  U$ [        XU5      $ g)zCompute track breadth.)r   zmin-contentzmax-contentfrN)r  r   r   r   r   s      r   _compute_track_breadthrl  X  s@    66	E9	%	%::L%u--	 
&r   c                    / n[        U5       H  u  pEUS-  S:X  a  UR                  U5        M!  [        XU5      nU(       a  UR                  U5        MG  US   S:X  a0  UR                  S[        XUS   5      [        XUS   5      45        M  US   S:X  a"  UR                  S[        XUS   5      45        M  US   S:X  d  M  UR                  SUS   [	        XUS   5      45        M     [        U5      $ )zCompute track size.r   r   minmax()r   fit-content()zrepeat())ra  r"  rl  r   _track_sizer   )r   r   r   return_valuesrd  r   track_breadths          r   rp  rp  c  s   Mf%q5A:  ' 35FM$$]3qZ'$$*5aA*5aA&C D q_,$$#VEq%B&D EqZ'$$a+e58*L&N O% &( r   zgrid-template-columnszgrid-template-rowsc                 <    US:X  d	  US   S:X  a  U$ [        XU5      $ )z+Compute the ``grid-template-*`` properties.r  r   subgrid)rp  r   s      r   grid_templateru  }  s)     6!9	15//r   zgrid-auto-columnszgrid-auto-rowsc                 Z   / nU H  n[        XU5      nU(       a  UR                  U5        M)  US   S:X  a8  UR                  S[        XUS   /5      S   [        XUS   /5      S   45        Mj  US   S:X  d  Mu  UR                  S[        XUS   /5      S   45        M     [        U5      $ )z'Compute the ``grid-auto-*`` properties.r   rn  r   r   ro  )rl  r"  	grid_autor   )r   r   r   rq  r   rr  s         r   rw  rw    s     M.uEB  /1X#  IeE!H:>qA%az215"7 8 1X(  5q
!CA!F"H I  r   zline-heightc                     US:X  a  U$ UR                   (       d  SUR                  4$ UR                   S:X  a  UR                  S-  nU S   nX4-  nSU4$ [        XUSS9nSU4$ )	z%Compute the ``line-height`` property.r  NUMBERr   r#   r   Tr   PIXELS)r   r   r   )r   r   r   factorfont_size_valuepixelss         r   r   r     s{     ZZ%++&&	s	s",) f U=fr   anchorc                 d    US:w  a*  Uu  p4U R                   R                  U5      =(       d    SnU$ g)z Compute the ``anchor`` property.r  Nr   r   )r   r   r   r   r   anchor_names         r   r~  r~    s7     mm'',4 r   linkc                 h    US:X  a  gUu  p4US:X  a   [        U R                  X@R                  5      $ U$ )zCompute the ``link`` property.r  Nr   )r   r   r   r   s        r   r  r    s8     H%emmUNNKKMr   r   c                 ~    US:X  a  gUu  pUS:X  a$  U R                   R                  U5      =(       d    S$ US:X  a  U$ g)zCompute the ``lang`` property.r  Nr   r   r  )r   r   r   r   s       r   r   r     sJ     	8==$$S)1T1XJ r   ztab-sizec                 H    [        U[        5      (       a  U$ [        XU5      $ )z"Compute the ``tab-size`` property.)r  r   r   r   s      r   tab_sizer    s"     uc**5JuE0JJr   	transformc                 z    / nU H)  u  pEUS:X  a  [        XU5      nUR                  XE45        M+     [        U5      $ )z#Compute the ``transform`` property.	translate)r   r"  r   )r   r   r   r  r   argss         r   r  r    sD     F{"-e4@Dx&'   =r   zvertical-alignc                     US;   a  U$ US:X  a  U S   S-  $ US:X  a  U S   S-  $ UR                   S:X  a  [        U 5      u  p4X2R                  -  S-  $ [        XUS	S
9$ )z(Compute the ``vertical-align`` property.)baselinemiddleztext-topztext-bottomr   r   superr         ?subg      r   r#   Tr   )r   strut_layoutr   r   )r   r   r   r   r   s        r   vertical_alignr    s    
  N N	'	[!C''	%[!D((	s	 '	#c))e5d;;r   zword-spacingc                 &    US:X  a  g[        XUSS9$ )z&Compute the ``word-spacing`` property.r  r   Tr   r   r   s      r   word_spacingr    s     e5d;;r   c           	         U S   S:X  a  gU(       a(  [        U SS9nX!R                  ;   a  UR                  U   $ [        X5      nUR                  S5        UR	                  5       u  pE[        USUSS	U S
9u        pVnU S   S:X  a  Xg4nU(       a  XR                  W'   U$ U S   u  pU	S:X  a  XS   -  n
XX-
  S-  -   4nU(       a  XR                  W'   U$ )zReturn a tuple of the used value of ``line-height`` and the baseline.

The baseline is given from the top edge of line height.

r   r   )r   r   T)r     NF)	resume_atspace_collapser   r   r  ry  r   )r   strut_layoutsr   set_textget_first_liner   )r   contextr   layoutliner   text_heightr  r  r   r   s              r   r  r    s    [Q#E='''((--G#F
OOC##%GD(:b&De)M%Aq!QX]x'&)/!!#&}-E[))k&?1%DDDF%+c"Mr   c                    US;   d   eU R                   SUS:X  a  SOS 3   n[        U 5      nX2;   a  X#   $ U R                  5       n SU S'   SU S	'   S
U S'   [        SU S9nUR	                  U5        UR                  5       u  pV[        R                  " S5      n[        R                  " S5      n[        R                  " XWU5        US:X  a  UR                  * [        -  n	OUR                  [        -  n	[        R                  " U5        [        R                  " U5        [        XS   -  S5      =(       d    Sn
XU'   U
$ )z3Return the ratio of 1ex/font_size or 1ch/font_size.)r   r   ratio_r   r   r   r  letter_spacingr   r  rS   r   N)r  r   zPangoRectangle *r   r  )cacher   copyr   r  r  r	   newr
   pango_layout_line_get_extentsyr   r   releaser  )r   	characterr  	cache_keyr  r  r   ink_extentslogical_extentsmeasurer  s              r   r  r    s4    
"""KK&c)9t DEFE%e,I JJLE&E
E.E+D.F
OOI##%GD'',-Kgg01O	''?KC==.:-!''*4KKKK  '+..29cE)Lr   )F)NFr   )O__doc__mathr   urllib.parser   tinycss2.color4r   loggerr   text.ffir   r	   r
   text.line_breakr   r   urlsr   
propertiesr   r   r   utilsr   r   r   r   r^  r  rh  
PAGE_SIZESallr   INITIAL_PAGE_SIZEr   r   r   r   r   r   r   r   r   r   r   r	  r  r  r  r  r%  r'  r)  r+  r-  r1  r3  r>  rA  rD  r   rJ  rY  r   r   rl  rp  ru  rw  r   r~  r  r   r  r  r  r  r  r  )r   r{  	page_sizer   r   r   s   000000r   <module>r     s   =    '  - - 8 % > > R R 	.
%
.. "  
 ()-B8-LL LL
 
 
 80+30+&	& 	%&	&(?@@0+3
j 
O:;L;L;N
OOO OOt$  M:KM Mv 
  , &F %& '  ()$%8 & *8 %&A 'A
 #$66J   %J =!>"2 # "2
 5768< >"?#=!87;< ;< =!?##$>"=!)*< *+./> 0 , ! + " # % $ " !   !     " $ # !    .>D < =!;>"* #   " !* #$< %< $% & &'2 (2 %&'(&'()&'?#8 $ ( * ( ) '8" '(&'$ ( )$, '(&'" ( )"$ ()'(" ) *" ()'(8 ) *8
 >"#$8 % #8
 +,,-.//0A 1 0 . -A
 < 9&  !& "F #$( %(
 < " !" 9( ( 9 & 7  ;(  (> =! " . 4 *+'(0 ) ,0 &'#$  % ( " =! " 8  6	 	 6	 	 :K K
 ;   #$< %<$ >"< #<B$Sd3s   S4S:
