+
    ih                    \   R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIHtHtHtHtHt ^ R	I H!t! ^ R
I"H#t#H$t$H%t%H&t&H't' ^ RI(H)t) ^ RI*H+t+ ^ RI,H-t-H.t/ ^ RI0H1t1 ^ RI2H3t3H4t4H5t5H6t6H7t7 ^ RI8H9t9H:t: ^ RI;H<t< ^ RI=H>t> ^ RIH?t? ^RI@HAtA ]P                  ! ]C4      tDR>R ltER tFR tGR?R ltHR?R ltIR?R ltJ]KP                  RRRRRR R!R"R#R$/4      tMR% tNR& tO ! R' R(4      tP] ! R) R*4      4       tQ ! R+ R,4      tR ! R- R.]4      tS ! R/ R04      tTR1 tU ! R2 R34      tV ! R4 R5]AP                  4      tX ! R6 R7]&4      tY ! R8 R94      tZ ! R: R;]$4      t[]%t\]#P                   ! R< R=]#4      4       t^R# )@uO   
A PDF Matplotlib backend.

Author: Jouni K Seppänen <jks@iki.fi> and others.
N)timezone)datetime)Enum)total_ordering)BytesIO)Image)_api_text_helpers
_type1fontcbookdviread)Gcf)_BackendFigureCanvasBaseFigureManagerBaseGraphicsContextBaseRendererBase)MixedModeRenderer)Figure)get_fontfontManager)AFM)FT2Font	FaceFlagsKerning	LoadFlags
StyleFlags)Affine2DBboxBase)Path)UTC)_path)_backend_pdf_psc                :   ^ p^ p. p\        V 4       FT  w  rV\        V4      pW',           V8  d   W'^,           ,          pK.  VP                  RP                  WV 4      4       TpTpKV  	  VP                  RP                  WR 4      4       RP                  V4      # )z
Make one string from sequence of strings, with whitespace in between.

The whitespace is chosen to form lines of at most *linelen* characters,
if possible.
    N   
)	enumeratelenappendjoin)stringslinelencurrposlastiresultislengths   &&      /Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/matplotlib/backends/backend_pdf.py_fillr3   _   s     GEF'"Qg%z!GMM$))G!$456EG # MM$))GFO,-::f    c                h   \         P                  ! R4      pV'       dF   \        P                  ! \	        V4      \
        P                  4      pVP                  \        R7      pM\        P                  ! 4       pRR\        P                   R2RRV  R\        P                   2R	V/VCpVP                  4        UUu/ uF  w  rVVf   K  WVbK  	  pppR
 pRVn        R pRVn        R p	RV	n        RVRVRVRVRVRVR	VRVRV	/	p
V F  pWZ9  d+   \        P                  ! RV: R\!        V
4      : R24       K3  W,          ! WE,          4      '       d   KO  \        P                  ! RV RWE,          : RW,          P                   R24       K  	  RV9   d   \#        VR,          4      VR&   V# u uppi )a  
Create a PDF infoDict based on user-supplied metadata.

A default ``Creator``, ``Producer``, and ``CreationDate`` are added, though
the user metadata may override it. The date may be the current time, or a
time set by the ``SOURCE_DATE_EPOCH`` environment variable.

Metadata is verified to have the correct keys and their expected types. Any
unknown keys/types will raise a warning.

Parameters
----------
backend : str
    The name of the backend to use in the Producer value.

metadata : dict[str, Union[str, datetime, Name]]
    A dictionary of metadata supplied by the user with information
    following the PDF specification, also defined in
    `~.backend_pdf.PdfPages` below.

    If any value is *None*, then the key will be removed. This can be used
    to remove any pre-defined values.

Returns
-------
dict[str, Union[str, datetime, Name]]
    A validated dictionary of metadata.
SOURCE_DATE_EPOCH)tzinfoCreatorzMatplotlib vz, https://matplotlib.orgProducerzMatplotlib z
 backend vCreationDatec                 "    \        V \        4      # N)
isinstancestrxs   &r2   is_string_like-_create_pdf_info_dict.<locals>.is_string_like   s    !S!!r4   zan instance of strc                 "    \        V \        4      # r<   )r=   r   r?   s   &r2   is_date&_create_pdf_info_dict.<locals>.is_date   s    !X&&r4   z an instance of datetime.datetimec                 V    \        V \        4      '       d   V P                  R9   # V R9   # )   True)rG   s   Falses   Unknown)TrueFalseUnknownr=   Namenamer?   s   &r2   check_trapped,_create_pdf_info_dict.<locals>.check_trapped   s+    a66<<<444r4   z#one of {"True", "False", "Unknown"}TitleAuthorSubjectKeywordsModDateTrappedzUnknown infodict keyword: z. Must be one of .zBad value for infodict keyword z. Got z which is not )osgetenvr   fromtimestampintr   utcreplacer    todaympl__version__itemstext_for_warningr   warn_externalsetrL   )backendmetadatasource_date_epochsource_dateinfokvrA   rD   rN   keywordss   &&         r2   _create_pdf_info_dictrl   u   s   @ 		"56,,S1B-CX\\R!)))5nn& 	\#//!22JKk'*S__4EF 	D  $zz|=|VaqDAD|D="&:N#'AG5
 &KM" 	.>N>N7=
H !;A5 A114X0A D ETW%%!@ D&&*g["*+">">!?q B C  DtI/YKO >s   <F.	F.c                   V P                  R4      pV P                  4       pVe   VP                  pM7\        P                  '       d   \        P
                  pM\        P                  pV^ 8X  d   VR,          pV# V^ 8  d%   VRV) R,          V) R,          3,          ,          pV# VRVR,          VR,          3,          ,          pV# )zL
Convert a datetime to a PDF string representing it.

Used for PDF and PGF.
zD:%Y%m%d%H%M%SZz+%02d'%02d'i  z-%02d'%02d')strftime	utcoffsetsecondstimedaylightaltzoner   )drzs   &  r2   _datetime_to_pdfrx      s     	


#$A	A}II===AAAv	S
 H	 
Q	]rdlaR4K888 H 	
]a4iT222Hr4   c                   \         P                  ! V) 4      p\         P                  ! V4      p\         P                  ! V4      pWV,          ,           pWV,          ,           pWV,          ,           W5,          ,           p	WV,          ,
          W6,          ,           p
WV,          ,           pWV,          ,
          pW3W3W3Wx33# )zJ
Calculate the coordinates of rectangle when rotated by angle around x, y
)mathradianssincos)r@   ywidthheightangle	sin_angle	cos_angleabcru   efs   &&&&&        r2   !_calculate_quad_point_coordinatesr      s    
 LL% EII	YA	YA	I 22A	I 22A	IA	IAFQFQFQF++r4   c                b   \        WVW44      pV^Z,          '       d   RM^ p\        R V 4       4      V,
          p\        R V 4       4      V,
          p\        R V 4       4      V,           p	\        R V 4       4      V,           p
\        \        P
                  P                  V4      4      WxW33# )z[
Get the coordinates of rotated rectangle and rectangle that covers the
rotated rectangle.
gh㈵>c              3   2   "   T F  q^ ,          x  K  	  R# 5i    N .0rj   s   & r2   	<genexpr>,_get_coordinates_of_block.<locals>.<genexpr>       'h!h   c              3   2   "   T F  q^,          x  K  	  R# 5i   Nr   r   s   & r2   r   r     r   r   c              3   2   "   T F  q^ ,          x  K  	  R# 5ir   r   r   s   & r2   r   r     r   r   c              3   2   "   T F  q^,          x  K  	  R# 5ir   r   r   s   & r2   r   r     r   r   )r   minmaxtuple	itertoolschainfrom_iterable)r@   r~   r   r   r   verticespadmin_xmin_ymax_xmax_ys   &&&&&      r2   _get_coordinates_of_blockr      s     1u17@H RZZ'QC'h''#-E'h''#-E'h''#-E'h''#-E)////9:5(* *r4   c                    \        WW4V4      w  rgR\        R4      R\        R4      RVR. RORR\        R	4      R	V P                  4       //pV^Z,          '       d   WhR
&   V# )z5
Create a link annotation object for embedding URLs.
TypeAnnotSubtypeLinkRectBorderASURI
QuadPointsr   r   r   )r   rL   get_url)	gcr@   r~   r   r   r   
quadpointsrectlink_annotations	   &&&&&&   r2   _get_link_annotationr     sm     1ueLJW4<)e2::<
	O rzz(2%r4   \z\\(z\()z\)
z\nz\rc                   \        V R4      '       d   V P                  4       # \        V \        \        P
                  34      '       dQ   \        P                  ! V 4      '       g   \        R4      hRV ,          pVP                  R4      P                  R4      # \        V \        4      '       d   RR.V ,          # \        V \        \        P                  34      '       d
   RV ,          # \        V \        4      '       d[   \        V P                  4       '       d   V P                  R	4      4      # \        P                   V P                  R
4      ,           4      # \        V \"        4      '       dB   RV P%                  R4      P'                  \(        4      P                  R4      ,           R,           # \        V \*        4      '       da   \-        R.V P/                  4        UUu. uF5  w  r#\1        V4      P                  4       R,           \        V4      ,           NK7  	  uppORN4      # \        V \2        \4        34      '       d*   \-        R.V  Uu. uF  p\        V4      NK  	  upORN4      # V f   R# \        V \6        4      '       d   \        \9        V 4      4      # \        V \:        4      '       d/   \-        V P<                   Uu. uF  p\        V4      NK  	  up4      # \?        R\A        V 4       R24      hu uppi u upi u upi )z!Map Python objects to PDF syntax.pdfReprz%Can only output finite numbers in PDFs   %.10f   0   .s   falses   trues   %dasciizUTF-16BE   (zlatin-1   )s   <<r$   s   >>   [   ]s   nullz$Don't know a PDF representation for z objects)!hasattrr   r=   floatnpfloatingisfinite
ValueErrorrstripboolrZ   integerr>   isasciiencodecodecsBOM_UTF16_BEbytesdecode	translate_str_escapesdictr3   r`   rL   listr   r   rx   r   bounds	TypeErrortype)objrv   ri   rj   vals   &    r2   r   r   +  s    sI{{}
 
C%-	.	.{{3DEEsNxx~$$T** 
C		'"3'' 
C#rzz*	+	+s{ 
C		ckkmmszz'* J 	J"//#**Z2HHJ 	J 
C		JJy!++L9@@KL	 
C		
@C		Ld1goo$&33L
 
  	 
C$	'	'dAc:csgclc:ADABB 
 
C	"	"',-- 
C	"	"cjj9jsgclj9:: >tCyk J" " # 	#+ M ; :s    ;K7K=
Lc                F    V ^8X  d   V^8*  # V ^*8X  d   VR8*  # \        4       h)z
Returns True if the font is able to provide codepoint *glyph* in a PDF.

For a Type 3 font, this method returns True only for single-byte
characters. For Type 42 fonts this method return True if the character is
from the Basic Multilingual Plane.
  )NotImplementedError)fonttypeglyphs   &&r2   _font_supports_glyphr   t  s/     1}|2~~

r4   c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )		Referencei  zJ
PDF reference object.

Use PdfFile.reserveObject() to create References.
c                    Wn         R # r<   idselfr   s   &&r2   __init__Reference.__init__  s    r4   c                (    R V P                   ,          # )z<Reference %d>r   r   s   &r2   __repr__Reference.__repr__  s    $''))r4   c                (    R V P                   ,          # )s   %d 0 Rr   r   s   &r2   r   Reference.pdfRepr  s    477""r4   c                    VP                   pV! R V P                  ,          4       V! \        V4      4       V! R4       R# )	   %d 0 obj
s   
endobj
N)writer   r   )r   contentsfiler   s   &&& r2   r   Reference.write  s1    

mdgg%&gh mr4   r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes____classdictcell____classdict__s   @r2   r   r     s#     *# r4   r   c                      a ] tR tRt oRtRt0 ]! R4      m0 ]! ]! R4      ]! R4      ^,           4      m,
           U u/ uF  p V RV ,          bK  	  up tR t	R t
R	 tR
 tR tR tR tRtVtR# u up i )rL   i  zPDF name object.   !~z#%02xc                   \        V\        4      '       d   VP                  V n        R# \        V\        4      '       d   VP	                  R 4      pVP                  V P                  4      P                  R 4      V n        R# )r   N)r=   rL   rM   r   r   r   _hexifyr   )r   rM   s   &&r2   r   Name.__init__  sT    dD!!		DI$&&{{7+t||4;;GDDIr4   c                (    R V P                   ,          # )z	<Name %s>rM   r   s   &r2   r   Name.__repr__  s    TYY&&r4   c                F    R V P                   P                  R4      ,           # )/r   )rM   r   r   s   &r2   __str__Name.__str__  s    TYY%%g...r4   c                d    \        V\        4      ;'       d    V P                  VP                  8H  # r<   rK   r   others   &&r2   __eq__Name.__eq__  s$    %&BB499

+BBr4   c                d    \        V\        4      ;'       d    V P                  VP                  8  # r<   rK   r  s   &&r2   __lt__Name.__lt__  s$    %&AA499uzz+AAr4   c                ,    \        V P                  4      # r<   )hashrM   r   s   &r2   __hash__Name.__hash__  s    DIIr4   c                (    R V P                   ,           # )   /r  r   s   &r2   r   Name.pdfRepr  s    diir4   r  N)r   r   r   r   r   	__slots__rangeordr  r   r   r  r  r  r  r   r   r   )r   r  s   0@r2   rL   rL     s     I%%*(H%C#c(Q,*G(HHJH1 'A+~HJGE'/CB   5Js   A.rL   c                   0   a  ] tR tRt o RtR tR tRtV tR# )Verbatimi  zEStore verbatim PDF command content for later inclusion in the stream.c                    Wn         R # r<   _x)r   r@   s   &&r2   r   Verbatim.__init__  s    r4   c                    V P                   # r<   r&  r   s   &r2   r   Verbatim.pdfRepr  s    wwr4   r&  N)	r   r   r   r   r   r   r   r   r   r  s   @r2   r$  r$    s     O r4   r$  c                      a  ] tR tRt o RtRtRtRtRtRt	Rt
R	tR
tRtRtRtRtRtRtRtRtRtRtRtRtRtRtRtRtRtRtRtRt Rt!R t"R!t#R"t$R#t%R$t&R%t'R&t(R't)R( t*]+R) 4       t,R*t-V t.R+# ),Opi  z'PDF operators (not an exhaustive list).   b   B   f   h   s   S   ns   BTs   ET   cs   re   l   ms   cms   Do   G   gs   RGs   rgs   CSs   css   SCNs   scn   d   j   Js   gs   q   Qs   Tds   Tfs   Tms   Tjs   TJ   w   Ws   shc                    V P                   # r<   )valuer   s   &r2   r   
Op.pdfRepr  s    zzr4   c                    V'       d!   V'       d   V P                   # V P                  # V'       d   V P                  # V P                  # )z
Return the PDF operator to paint a path.

Parameters
----------
fill : bool
    Fill the path with the fill color.
stroke : bool
    Stroke the outline of the path with the line color.
)fill_strokestrokefillendpath)clsrF  rE  s   &&&r2   
paint_pathOp.paint_path  s4     &zz!xx{{"r4   r   N)/r   r   r   r   r   close_fill_strokerD  rF  	closepathclose_strokerE  rG  
begin_textend_textcurveto	rectanglelinetomovetoconcat_matrixuse_xobjectsetgray_strokesetgray_nonstrokesetrgb_strokesetrgb_nonstrokesetcolorspace_strokesetcolorspace_nonstrokesetcolor_strokesetcolor_nonstrokesetdashsetlinejoin
setlinecap	setgstategsavegrestoretextpos
selectfont
textmatrixshowshowkernsetlinewidthclipshadingr   classmethodrI  r   r   r  s   @r2   r,  r,    s     1KDILFGJHGIFFMKNM #OGKJIEHGJJDHLDG # #r4   r,  c                   J   a  ] tR tRt o RtR
tRR ltR tR tR t	R t
R	tV tR# )Streami	  z
PDF stream object.

This has no pdfRepr method. Instead, call begin(), then output the
contents of the stream by calling write(), and finally call end().
Nc                   Wn         W n        W0n        VP                  V n        RV n        Vf   \        4       V n        MVP                  4       V n        Ve)   V P                  P                  R\        R4      RV/4       V P                  P                  V P                   4       \        P                  R,          '       d9   V'       g1   \        P
                  ! \        P                  R,          4      V n        V P                  f   \        4       V n        R# V P!                  4        V P                  P#                  4       V n        R# )a  
Parameters
----------
id : int
    Object id of the stream.
len : Reference or None
    An unused Reference object for the length of the stream;
    None means to use a memory buffer so the length can be inlined.
file : PdfFile
    The underlying object to write the stream to.
extra : dict from Name to anything, or None
    Extra key-value pairs to include in the stream header.
png : dict or None
    If the data is already png encoded, the decode parameters.
NFilterFlateDecodeDecodeParmspdf.compression)r   r'   pdfFilefhr   compressobjr   extracopyupdaterL   
recordXrefr^   rcParamszlibr   _writeHeadertellpos)r   r   r'   r   rw  pngs   &&&&&&r2   r   Stream.__init__  s      GG	=DJDJ?JJxd=.A,c3 4 	(<<)**3#//./ 1D88	DIyy~~'DHr4   c                "   V P                   P                  pV! R V P                  ,          4       V P                  pV P                  VR&   \
        P                  R,          '       d   \        R4      VR&   V! \        V4      4       V! R4       R# )r   Lengthrs  rq  rp  s   
stream
N)	r   r   r   rw  r'   r^   r{  rL   r   )r   r   r   s   &  r2   r}  Stream._writeHeader9  sh    		mdgg%&zzX<<)**!-0DNgdmmr4   c                4   V P                  4        V P                  f   V P                  P                  4       p\        V4      V n        V P                  P
                  V n        V P                  4        V P                  P                  V4       V P                  P                  R4       R# V P                  P                  4       V P                  ,
          pV P                  P                  R4       V P                  P                  V P                  V4       R# )zFinalize stream.Ns   
endstream
endobj
)_flushr'   r   getvaluert  ru  r}  r   r~  r  writeObject)r   r   r1   s   &  r2   end
Stream.endD  s     	88yy))+H8}DHDIIIOOH%IIOO45YY^^%0FIIOO45LL$$TXXv6r4   c                    V P                   f   V P                  P                  V4       R# V P                   P                  V4      pV P                  P                  V4       R# )zWrite some data on the stream.N)rv  r   r   compress)r   data
compresseds   && r2   r   Stream.writeT  sF     #IIOOD!))2248JIIOOJ'r4   c                    V P                   e?   V P                   P                  4       pV P                  P                  V4       RV n         R# R# )zFlush the compression object.N)rv  flushr   r   )r   r  s   & r2   r  Stream._flush]  sA     '))//1JIIOOJ'#D (r4   )rv  rw  r   r   r'   rt  r  )r   r'   rt  r   rv  rw  r  NN)r   r   r   r   r   r   r   r}  r  r   r  r   r   r  s   @r2   rn  rn  	  s1      PI%(N	7 ($ $r4   rn  c                 .   \        V ^R7      pRVP                  ,          p/ pV EFk  pVP                  V\        P                  4      p\
        P                  ! VP                  ^ .VP                  O4      V,          R,           P                  \        4      pVP                  4       w  rV^@,          P                  \        4      p\
        P                  ! V	^8H  4      w  p
V
R,          p\
        P                  ! \        0 Vm0 V
^,
          m,          0 V
^,           m,          4      \        4      pVW,          W^,
          ,          W^,           ,          ,           ^,          P                  \        4      8H  P                  ^R7      ,          pVP                  V3R9   d   VR;;,          ^,          uu&   W,          R,           P                  \        4      pW^,
          ,          W^,           ,          ,           ^,          P                  \        4      W&   RP!                  \#        \$        V4      4      P'                  R4      R,           \(        P*                  ! \-        W4      R	R	R
R	R. ROR4      ,           R,           WBP/                  V4      &   EKn  	  V# )r   )hinting_factor  g      ?:r   N   axis r   s    d1
NFTr/  ))DejaVuSerif-ItalicM   )r     )NNNr   )r6  r5  r4   r4  r0  )r   units_per_EM
load_glyphr   NO_SCALEr   arrayhoriAdvancebboxastyperZ   get_pathnonzerosortedallpostscript_namer)   mapr>   r   r!   convert_to_stringr   get_glyph_name)	font_path	glyph_idsfontconvprocsglyph_idgd1rj   r   quadsquads_onquads_mid_onimplicits   &&            r2   _get_pdf_charprocsr  f  s   Ia0D$###DEOOHi&8&89 hhq216623d:R?GGL}}VOOC  AF#;xx;X;EAI/.UQY.@A3H_1$%*:(;;q@HHMNSaS[   (+ 0
 
 dGqLGX]""3'!|_qA.!3VVC[ 	
 HHSb\"))'2X=%%Q
D$tR-t55
  	!!(+,A N Lr4   c                     a a ] tR tRt oRtR6V 3R lltR t. R7O3R ltR tR t	R	 t
R
 tR tR8R ltR tRR/R ltR tR tR tR tR tR tR tR tRtR tR tR tR tR tR t]P@                  ! R4      ! ]!! R  4      4      t"R! t#R" t$R# t%R$ t&R% t'R& t(R6R' lt)R( t*R) t+R* t,R+ t-R, t.]/R9R- l4       t0R:R. lt1R;R/ lt2R0 t3R1 t4R2 t5R3 t6R4 t7R5t8Vt9V ;t:# )<PdfFilei  zPDF file object.Nc                *  < \         S	V `  4        \        P                  ! ^4      V n        . R O.V n        RV n        RV n        ^ V n        \        P                  ! VRRR7      w  r4V'       g     VP                  4       V n        TpRV n        W0n        RV n        VP!                  R4       VP!                  R4       V P#                  R4      V n        V P#                  R	4      V n        . V n        V P#                  R
4      V n        V P#                  R4      V n        V P#                  R4      V n        V P#                  R4      V n        V P#                  R4      V n        V P#                  R4      V n        R\7        R4      RV P&                  /pV P9                  V P$                  V4       \;        RT;'       g    / 4      V n        / V n        R \        P                  ! ^4       4       V n         / V n!        / V n"        \F        PH                  ! 4       V n%        / V n&        R \        P                  ! ^4       4       V n'        / V n(        R \        P                  ! ^4       4       V n)        . V n*        / V n+        R \        P                  ! ^4       4       V n,        . V n-        / V n.        R \        P                  ! ^4       4       V n/        / V n0        / V n1        . V n2        . V n3        . V n4        RPk                  4        Uu. uF  p\7        V4      NK  	  ppRV P*                  RV P2                  RV P,                  RV P.                  RV P0                  RV/pV P9                  V P4                  V4       R#   \         d    \        4       pYn         EL i ; iu upi )!a{  
Parameters
----------
filename : str or path-like or file-like
    Output target; if a string, a file will be opened for writing.

metadata : dict from strings to strings and dates
    Information dictionary object (see PDF reference section 10.2.1
    'Document Information Dictionary'), e.g.:
    ``{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}``.

    The standard keys are 'Title', 'Author', 'Subject', 'Keywords',
    'Creator', 'Producer', 'CreationDate', 'ModDate', and
    'Trapped'. Values have been predefined for 'Creator', 'Producer'
    and 'CreationDate'. They can be removed by setting them to `None`.
FNwbT)return_openeds	   %PDF-1.4
s   % 
rootpagesfontszextended graphics statesztiling patternszGouraud triangleszexternal objects	resourcesr   CatalogPagespdfc              3   >   "   T F  p\        R V 24      x  K  	  R# 5i)FNrL   r   r/   s   & r2   r   #PdfFile.__init__.<locals>.<genexpr>       "M:LQ4!A3==:L   c              3   >   "   T F  p\        R V 24      x  K  	  R# 5i)r   Nr  r  s   & r2   r   r    s      K8J1!g8Jr  c              3   >   "   T F  p\        R V 24      x  K  	  R# 5i)SMNr  r  s   & r2   r   r    s     J7I!tbH~~7Ir  c              3   >   "   T F  p\        R V 24      x  K  	  R# 5i)HNr  r  s   & r2   r   r    r  r  c              3   >   "   T F  p\        R V 24      x  K  	  R# 5i)INr  r  s   & r2   r   r    s     E2DQ4!A3==2Dr  PDF Text ImageB ImageC ImageIFontXObject	ExtGStatePatternShadingProcSet)r   r   the zero object)6superr   r   count_object_seq	xrefTablepassed_in_file_objectoriginal_file_like	tell_baser   to_filehandler~  OSErrorr   ru  currentstreamr   reserveObject
rootObjectpagesObjectpageList
fontObject_extGStateObjecthatchObjectgouraudObjectXObjectObjectresourceObjectrL   r  rl   infoDict	fontNames_internal_font_seqdviFontInfotype1Descriptorsr"   CharacterTracker_character_trackeralphaStates_alpha_state_seq_soft_mask_states_soft_mask_seq_soft_mask_groups_hatch_patterns_hatch_pattern_seqgouraudTriangles_images
_image_seqmarkersmulti_byte_charprocspaths_annotationspageAnnotationssplit)
r   filenamere   ru  openedr  r@   procsetsr  	__class__s
   &&&      r2   r   PdfFile.__init__  s   " 	$??1-78%*""&((4tL
2!)
 -1*!
 	(),,V4--g6,,W5 $ 2 23M N--.?@!//0CD!//0BC"00=Y))+$/-eX^^D"M)//!:L"M ""1"B"B"D K	8J K!#Jyq7IJ!#!"M)//!:L"M "E)//!2DE$&!

   " &E%J%J%LM%LDG%LM
 T__ 2 2 $"7"7 0 0 2 2*	 	,,i8W  3Y*2'3@ Ns   .M. :N.NNc                8   V P                  4        WuV n        V n        V P                  R 4      pV P                  R4      pR\	        R4      RV P
                  RV P                  R^ ^ ^HV,          ^HV,          .RVRV/pV P                  R	4      pV P                  We4       V P                  P                  V4       V P                  P                  W@P                  34       V P                  VP                  V P                  R
4      4       V P                  \	        R4      \        P                   4       V P                  \	        R4      \        P"                  4       V P                  \$        P&                  R,          \        P(                  4       . V n        R# )zpage contentsannotationsr   PageParent	ResourcesMediaBoxContentsAnnotspagezlength of content stream	DeviceRGBroundN)	endStreamr   r   r  rL   r  r  r  r  r(   r  r  beginStreamr   outputr,  rZ  r[  GraphicsContextPdf
joinstylesr_  )r   r   r   contentObjectannotsObjectthePage
pageObjects   &&&    r2   newPagePdfFile.newPage   sQ   "'
DK**?;))-84<T-- 3 31b5j"v+>}\ ''/
-Z(  ,0D0D!EF))++,FG	I 	D%r'>'>?D%r'A'AB&11':BNNK  "r4   c                t    R \        R4      R\        R4      RVRV/pV P                  P                  V4       R# )r   r   r   Textr  r   N)rL   r  r(   )r   textpositionRecttheNotes   &&& r2   newTextnotePdfFile.newTextnote  s;    4=d6lt<
 	##G,r4   c                   a V3R  lo\        \        VP                  4       4      4      \        P                  ^,           ^,          ,          pS! V^4      pVR,          R,           V,           # )c                    < W8  d   \         P                  V ,          # S! W,          V4      \         P                  W,          ,          ,           # r<   )stringascii_uppercase)nbasetoStrs   &&r2   r1  ,PdfFile._get_subsetted_psname.<locals>.toStr'  s>    x--a00 !)T*V-C-CAH-MMr4   :N   N+)r  	frozensetkeyssysmaxsize)r   ps_namecharmaphashedprefixr1  s   &&&  @r2   _get_subsetted_psnamePdfFile._get_subsetted_psname&  sS    	 i/0S[[1_4IJvr" bzC'))r4   c                   V P                  4        V P                  4        V P                  4        V P                  4        V P	                  4        V P                  4        V P                  4        V P                  P                  4        UUUu/ uF  w  rq2VbK
  	  ppppV P                  P                  4        F  pV^,          WE^ ,          &   K  	  V P                  P                  4        F	  w  r&WdV&   K  	  V P                   F  w	  r'rrrpW4V&   K  	  V P                  V P                  V4       V P                  4        V P!                  4        V P#                  4        V P                  V P$                  R\'        R4      RV P(                  R\+        V P(                  4      /4       V P-                  4        V P/                  4        V P1                  4        R# u upppi )z>Write out the various deferred objects and the pdf end matter.r   r  KidsCountN)r  _write_annotations
writeFontswriteExtGSTates_write_soft_mask_groupswriteHatcheswriteGouraudTrianglesr  valuesr  r  r`   r  r  r  writeImageswriteMarkerswritePathCollectionTemplatesr  rL   r  r'   writeInfoDict	writeXrefwriteTrailer)r   imagerM   obxobjectstuprA  pathtransr)   cappaddingfilledstrokeds   &             r2   finalizePdfFile.finalize6  s    	!$$&""$,0LL,?,?,AC,Ab"H,A 	 C<<&&(C"1vHV )44::<KD"TN = :: GD4gwTN ++X6))+)) $w- $--!3t}}#57	8 	 	+Cs   Gc                8   V P                  4        V P                  '       d   V P                  P                  4        R# V P                  e4   V P                  P                  V P                  P                  4       4       V P                  P                  4        R# )z)Flush all buffers and free all resources.N)r  r  ru  r  r  r   r  closer   s   &r2   r\  PdfFile.closeW  sa     	%%%GGMMO&&2''--dgg.>.>.@AGGMMOr4   c                    V P                   f   V P                  P                  V4       R # V P                   P                  V4       R # r<   )r  ru  r   )r   r  s   &&r2   r   PdfFile.writeb  s2    %GGMM$$$T*r4   c           
         T P                  \        V Uu. uF  p\        V4      NK  	  up4      4       V P                  R 4       R# u upi )r%   N)r   r3   r   )r   r  r@   s   &* r2   r  PdfFile.outputh  s7    

5d3d'!*d345

5 4s   Ac                J    V P                   e   Q h\        WWV4      V n         R # r<   )r  rn  )r   r   r'   rw  r  s   &&&&&r2   r  PdfFile.beginStreaml  s%    !!)))#BT#>r4   c                h    V P                   e$   V P                   P                  4        R V n         R # R # r<   )r  r  r   s   &r2   r  PdfFile.endStreamp  s-    )""$!%D *r4   rw  c                   V P                  VP                  R V4       V P                  P                  V4       V P	                  4        R # r<   )r  r   r  r   r  )r   refr  rw  s   &&&$r2   outputStreamPdfFile.outputStreamu  s6    u-  &r4   c                R    V P                    F  w  rV P                  W4       K  	  R # r<   )r  r  )r   r  r  s   &  r2   rB  PdfFile._write_annotationsz  s#    )-):):%L\7 *;r4   c                   \        V\        4      '       d   V.pM[\        P                  R,          '       d)   \        P
                  ! VR\        P                  R7      pM\        P
                  ! V4      pRpV Fs  pV P                  P                  V4      pV'       g   TpVe   K.  \        V P                  4      pWPP                  V&   \        P                  RWT4       V'       d   Kq  TpKu  	  V# )z
Select a font based on fontprop and return a name suitable for
Op.selectfont. If fontprop is a string, it will be interpreted
as the filename of the font.
pdf.use14corefontsafm)fontext	directoryNzAssigning font %s = %r)r=   r>   r^   r{  _fontManager_find_fonts_by_propsRendererPdf_afm_font_dirr  getnextr  _logdebug)r   fontprop	filenamesfirst_FxfnameFxs   &&    r2   fontNamePdfFile.fontName~  s     h$$!
I\\.//$99%;3L3LI %99(CIE##E*Bz$112(*u%

3R?x!H  r4   c           	        V P                   P                  VP                  4      pVe   VP                  # \        P
                  ! \        P                  ! R4      4      pW1P                  ,          pVP                  f0   \        RP                  VP                  VP                  4      4      h\        V P                  4      p\        P                  RWQP                  4       \        P                   ! VVVP                  VP                  VP"                  VP$                  R7      V P                   VP                  &   V# )z
Given a dvi font object, return a name suitable for Op.selectfont.
This registers the font information in ``self.dviFontInfo`` if not yet
registered.
z
pdftex.mapzNNo usable font file found for {} (TeX: {}); the font may lack a Type-1 versionzAssigning font %s = %s (dvi))dvifontpdfnamefontfilebasefontencodingfileeffects)r  ru  texnamer  r   
PsfontsMapfind_tex_filer	  r   formatpsnamerv  r  rw  rx  typesSimpleNamespaceencodingr  )r   r  dvi_infotex_font_mappsfontr  s   &&    r2   dviFontNamePdfFile.dviFontName  s     ##''8###))'*?*?*MNoo.??"5w79 9
 t../

17OOL,1,A,A__]]NN-$) r4   c                   / p\        V P                  P                  4       4       F:  w  r#VP                  p\        P                  R V4       V P                  V4      W&   K<  	  \        V P                  4       F  pV P                  V,          p\        P                  RV4       VP                  R4      '       d+   \        P                  R4       V P                  V4      W&   Km  \        P                  R4       V P                  P                  P                  V4      pV'       g   K  V P                  WV4      W&   K  	  V P                  V P                  V4       R# )z"Embedding Type-1 font %s from dvi.zEmbedding font %s.z.afmzWriting AFM font.zWriting TrueType font.N)r  r  r`   r  rw  rx  _embedTeXFontr  endswith_write_afm_fontr  usedru  embedTTFr  r  )r   r  dvinamerh   r}  r	  charss   &      r2   rC  PdfFile.writeFonts  s	   #D$4$4$:$:$<=MGBJJ;WE**40EI > t~~.H)BJJ+X6  ((

./ 00:	 

34//4488B5 $h >EI / 	%0r4   c           
     <   \        VR 4      ;_uu_ 4       p\        V4      pRRR4       XP                  4       pR\        R4      R\        R4      R\        V4      R\        R4      /pV P	                  R	4      pV P                  We4       V#   + '       g   i     Lr; i)
rbNr   r  r   Type1BaseFontEncodingWinAnsiEncodingfont dictionary)openr   get_fontnamerL   r  r  )r   r	  ru  r  fontnamefontdictfontdictObjects   &&     r2   r  PdfFile._write_afm_font  s    (D!!Rr7D "$$&DLtG}X%6 79 ++,=>2 "!s   BB	c           
        \         P                  R VP                  P                  VP                  4       V P                  R4      pV P                  W!P                  P                  4       V P                  R4      pR\        R4      R\        R4      R^ R\        VP                  P                  4      ^,
          R	V/pVP                  eB   R\        R
4      R^ .\        \        \        P                  ! VP                  4      4      O/VR
&   VP                  fL   \         P                  RVP                   4       \        VP                   4      VR&   V P                  W44       V# \"        P$                  ! VP                  4      pVP&                  '       d   VP)                  VP&                  4      p\        VP*                  R,          4      VR&   VP&                  P-                  RR4      VP&                  P-                  RR4      3pV P.                  P-                  VP                  V34      pVf6   V P1                  WQP                  4      pWpP.                  VP                  V3&   WtR&   V P                  W44       V# )z#Embedding TeX font %s - fontinfo=%sfont widthsr  r   r  r   r  	FirstCharLastCharWidthsr  DifferenceszBecause of TeX configuration (pdftex.map, see updmap option pdftexDownloadBase14) the font %s is not embedded. This is deprecated as of PDF 1.5 and it may cause the consumer application to show something that was not intended.r  FontNameslant        extend      ?FontDescriptor)rw  rx  r  r  __dict__r  r  widthsrL   r'   r  r  r   
_parse_encr  warningr  r
   	Type1Fontr  	transformpropru  r  createType1Descriptor)r   fontinfowidthsObjectr  r  t1fontr  fontdescs   &&      r2   r  PdfFile._embedTeXFont  sG   

8##++X->->	@ ))-8'7'7'>'>? ++,=>fgX--4459   ,Z( ND'"4"4X5J5J"KL N$HZ  $LLG !!# $((9(9#:HZ ^6!! %%h&7&78%%h&6&67F#FKK
$;<
 ##''5##''#68((,,h.?.?-IJ11&:K:KLHBJ!!8#4#4g">?%-!"2r4   c                   V P                  R 4      pV P                  R4      pVP                  R,          pVP                  R,          p^ pV'       d
   V^,          p  T^,          pT'       d
   T^@,          p   \        T4      pR\        R4      R\        TP                  R,          4      RTRTP                  RTR	TP
                  R
TP                  RRRRRTRTP                  R,          R^2/p	T P                  Y94       T P                  TRP                  TP                  R,          4      R\        TP                  ^ ,          4      R\        TP                  ^,          4      R^ /R7       T# )font descriptorz	font fileItalicAngleisFixedPitchr   r  r  FlagsFontBBoxAscentDescent	CapHeightr  XHeighti  FontFile
FontFamily
FamilyNameStemVr4   Nr  NLength1Length2Length3rw  )r  r  r   rL   r  ascender	descenderr  rh  r)   partsr'   )
r   r  r  fontdescObjectfontfileObjectitalic_anglefixed_pitchflagsft2font
descriptors
   &&&       r2   r  PdfFile.createType1Descriptor  sk    ++,=>++K8{{=1kk.1VOE VOE
 VOE   8$ 4 014J 7857<<<7++7,,43>6;;|42
" 	4.#((6<<3C*D!*CQ,@!*CQ,@!*A!/ 	 	0
 r4   c                    V P                  V4      pR P                  VP                  P                  4       \        P
                  P                  \        P
                  P                  V4      4      ^ ,          V.4      # )-)r~  r)   rM   r   rW   rS  splitextbasename)r   r	  
glyph_namer}  s   &&& r2   _get_xobject_glyph_namePdfFile._get_xobject_glyph_nameU  s]    ]]8$xxGGNNGGRWW--h78;  	r4   sO  /CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<< /Registry (Adobe)
   /Ordering (UCS)
   /Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000> <ffff>
endcodespacerange
%d beginbfrange
%s
endbfrange
endcmap
CMapName currentdict /CMap defineresource pop
end
endc                  a aaaa \        S4      p\        P                  R,          oVP                  R3R loVVVV 3R lpVVVVV 3R lpS P	                  VP
                  VP                  4       4      oSP                  RR4      o\        S4      oVP                  R4      ;'       g    R	^ R
^ /pVP                  R4      ;'       g    RR/pVP                  pVP                  p	^ p
Rp\        P                  V9   d
   V
^,          p
 T'       d   T
^,          p
M	T
^ ,          p
\        P                  T	9   d
   T
^@,          p
   R\        R4      RSRT
RTP                    Uu. uF  pS! TRR7      NK  	  upRS! TP"                  RR7      RS! TP$                  RR7      RS! TR	,          RR7      RS! TR
,          4      RTR,          ^,          R^ /
pS^8X  d
   T! Y2T4      # S^*8X  d
   T! Y2T4      # R# u upi )z9Embed the TTF font from the named file into the document.pdf.fonttypeTc                    W,          R,          pV'       d   \        V4      # V^ 8  d   \        P                  ! V4      # \        P                  ! V4      # )z2Convert font coordinates to PDF glyph coordinates.r  )r  rz   floorceil)r1   upenearestrA  s   &&& r2   cvtPdfFile.embedTTF.<locals>.cvtw  s@    L4'EU|#qyzz%((yy''r4   c                F  <a a S#P                  R4      pS#P                  R4      pS#P                  R4      pS#P                  R4      p. p^ ^rS P                   U
u. uF  p
S ! V
RR7      NK  	  pp
R\        R4      R	S"R
VRV	RVR\        R4      RVR,          RVR. R"ORVRR\        R4      RV/RV/p^ RIHo VV V 3R lp\
        P                  ! 4       ;_uu_ 4        \
        P                  ! R4       \        W^,           4       Uu. uF  pV! V4      NK  	  ppRRR4       \        X4      VR&   . p. p\        4       pV Fe  pTpS P                  V4      pVP                  V4       S P                  V4      pV^8:  d   VP                  VV34       KT  VP                  V4       Kg  	  VP                  4        R#pV FA  w  ppVV^,           8w  d   VP                  V4       VP                  \        V4      4       TpKC  	  \!        S!V4      p/ p\#        V4       F  pVV,          p/ pVV9   d6   R\        R4      R\        R4      RV/pVVP%                  R4      ^,           R pS#P                  R 4      pS#P'                  VVVR!7       VV9   d$   S#P)                  S!V4      pVS#P*                  V&   K  VVV&   K  	  S#P-                  W\4       S#P-                  WB4       S#P-                  W?4       S#P-                  VV4       V# u up
i u upi   + '       g   i     EL; i)$z5The Type 3-specific part of embedding a Truetype fontr  r  r  zcharacter procsFr  r   r  r  r  r  r  r   Type3rL   r  r  
FontMatrix	CharProcsr  r  r  )cp1252c                    < \        SP                  V ,          4      pSP                  V\        P                  \        P
                  ,          R 7      P                  pS! V4      # )r  )r"  decoding_table	load_charr   r  
NO_HINTINGr  )charcoder0   r   r  r  r  s   &  r2   get_char_width?PdfFile.embedTTF.<locals>.embedTTFType3.<locals>.get_char_width  sT    --h78Y//)2F2FF ' HHS 5z!r4   ignoreNMaxWidthr  FormBBox   d1charProcr  )MbP?r   r   r  r   r   )r  r  rL   	encodingsr  warningscatch_warningsfilterwarningsr!  r   rc   get_char_indexr(   r  addsortr  r  findrh  r  r  r  )$r  
charactersr  r  r  r  charprocsObjectdifferencesArray	firstcharlastcharr@   r  r  r  r  r  r  differencesmulti_byte_charsr   ccodegindr  last_crM   rawcharprocs	charprocscharnamestreamcharprocDictcharprocObjectr  r  r	  r9  r   s$   f&&                            @r2   embedTTFType3'PdfFile.embedTTF.<locals>.embedTTFType3  sB   --m<L!//0ABN!//0ABN"001BCO!"#Sx3799=9aC5)9D= VGYH .4=
:.D6_D,!#35 ,H" )"
 ((** ''1*/	A:*FH*Fh )2*F  H + &)[Jz"
 IK"u**51  &!006
C<&&z':;$((4   F&4
?$++A. ''T
3	 ' .h	BLI"<0%h/! //$*DO$-tF|$*D$2L $FKK$6$:$;<F!%!3!3J!?!!.&!M //77(KD6DD--d3*8Ih'3 18 ^6^8\2_i8!!A >@H +**s$   L+LL
L
LL 	c                
  < S-P                  R4      pS-P                  R4      pS-P                  R4      pS-P                  R4      pS-P                  R4      pS-P                  R4      pS-P                  R4      p	RP                  R	 V 4       4      p
\        P                  R
S*V
4       \        P
                  ! S*V
4      ;_uu_ 4       p\        P                  ! V4      pRRR4       \        P                  RS*\        P                  ! S*4      P                  XP                  4       P                  4       T p\        V4      p R\        R4      R\        R4      RS,RRRRRR^ /RVRVRV/pR\        R4      R\        R4      RS,R\        R4      RV.RV	/pWrR &   S-P                  W|P                  4       R!VP                  4       P                  /R"7       R#.R$,          p. p^ pV F  pTpV P!                  V4      pV P#                  V\$        P&                  \$        P(                  ,          R%7      pVP+                  VS)! VP,                  4      34       VR$8  d   \/        V4      VV&   \1        VV4      pK  	  VP3                  4        VRV^,            pR4p. p^ p. pV F}  w  ppVV^,           8w  d8   VP+                  V4       VP+                  V.4       VP+                  VV.4       M$VR5,          P+                  V4       VVR5,          ^&   \1        VV4      pTpK  	  . pV F]  w  ppVR&8  d   K  \5        R&V4      pVP+                  R'VVR(P                  R) \7        VV^,           4       4       4      3,          4       K_  	  S-P8                  \;        V4      R*P                  V4      3,          p. p V F9  p\=        S+V4      '       d   K  VP!                  V4      pV P+                  V4       K;  	  VP>                   U!u. uF  p!S)! V!R+R,7      NK  	  p"p!\A        S*V 4      p#\C        V#4       F  p$V#V$,          p%R\        R-4      R\        R.4      R/V"/p&V%V%PE                  R04      ^,           R p%S-P                  R14      p'S-P                  V'V%V&R"7       S-PG                  S*V$4      p(V'S-PH                  V(&   K  	  RP                  V4      PK                  R24      pS-P                  VV4       S-P                  V	V4       VVR3&   S-PM                  WN4       S-PM                  W_4       S-PM                  W24       S-PM                  VV4       V#   + '       g   i     ELp; iu up!i )6z6The Type 42-specific part of embedding a Truetype fontr  zCID font dictionaryzType 0 font dictionaryzCIDToGIDMap streamzfont file streamzType 0 widthszToUnicode map c              3   8   "   T F  p\        V4      x  K  	  R # 5ir<   )chr)r   r   s   & r2   r   ;PdfFile.embedTTF.<locals>.embedTTFType42.<locals>.<genexpr>  s      <AQs   zSUBSET %s characters: %sNzSUBSET %s %d -> %dr   r  r   CIDFontType2r  CIDSystemInfoRegistryAdobeOrderingIdentity
Supplementr  WCIDToGIDMapType0r  z
Identity-HDescendantFonts	ToUnicode	FontFile2r  r   i   r  r   s   <%04x> <%04x> [%s]r$   c              3   4   "   T F  pR V,          x  K  	  R# 5i)s   <%04x>Nr   )r   r@   s   & r2   r   r%  M  s     J6Iy1}}6Is   r%   Fr  r  r  r  r  r  utf-16ber   r  r  )'r  r)   rw  rx  r"   get_glyphs_subsetfont_as_filerW   statst_size	getbuffernbytesr   rL   rh  r  r  r  r   r  r  r(   r  r$  r   r  r   r!  _identityToUnicodeCMapr'   r   r  r  r  r  r  r  r   r  ).r  r  r  r  cidFontDictObjecttype0FontDictObjectcidToGidMapObjectr  wObjecttoUnicodeMapObject
subset_strsubsetfontdata	full_fontcidFontDicttype0FontDictcid_to_gid_mapr  	max_ccoder   r  r  r   
last_ccodew	max_widthunicode_groupsr   unicode_bfrangestartr  unicode_cmapr  r@   r  r  r  r  r  r  rM   r  r	  r   r9  r   s.   &&&                                      r2   embedTTFType42(PdfFile.embedTTF.<locals>.embedTTFType42  sP   !//0ABN $ 2 23H I"&"4"45M"N $ 2 23G H!//0BCN((9G!%!3!3O!D < <<JJJ18ZH 228ZHHF*77? IJJ$h!))8+=+=+?+F+F I
 8$D V4/G
 !"% !.W0K V4=GD.!$5#6/M '5{# 1 1 3 ("4"4"6"="=>  @ #Ve^NFI**51u-6-?-?)BVBV-V ' Xuc%*;*;&<=>5=,/IN5)y1	   KKM+NY];NJAIN &uJN*HHUOHHeW%"))5%.9bELL',1N2&q)	51	"
 !' !O,
s5=%o&&)CYYJeE3q56IJJLLM - !77 0%**_2MNOL I#+He<<$33E:D$$T* $
 4=>>B>aC5)>DB-h	BL"<0%h/ &Y )4< & .  E 2Q 6 78!%!3!3J!?!!.&!M33HhG2@))$/! 1&  WW^4;;JGN/@ 0,?%.Jz" .<0@^8Wa(&&G IHH@ Cs   U>UU	r   r\   pclt	capHeightxHeightpostitalicAngleFr   r  r  r  r  r  r  r  r  r  r  r  N)r   r   )r   r^   r{  r  r=  r  get_charmapr   rL   get_sfnt_table
face_flagsstyle_flagsr   FIXED_WIDTHr   ITALICr  r  r  )r   r	  r  r  r  rQ  rS  rV  ffsfr  symbolicr@   r  r  r   r9  s   ff&           @@@r2   r  PdfFile.embedTTFq  s    !<</ --t 		(h	" h	"TO	' O	'f ,,  
 ..)4w-""6*LL{Ay!.L""6*EE}f.E__  B&VOEVOEVOE"VOE D)*U		B	1Q.	Bc$--7s4>>59T+.>s4	?+4.q1Q
 q= :>>^!$J??  Cs   $G7c                    V P                   P                  VR4      pVe
   V^ ,          # \        V P                  4      pVR\	        R4      RV^ ,          RV^,          /3V P                   V&   V# )z?Return name of an ExtGState that sets alpha to the given value.Nr   r  CAca)r  ru  rv  r  rL   )r   alphastaterM   s   &&  r2   
alphaStatePdfFile.alphaState  sy       $$UD18OD))*FD-%(D%(4 5 	 r4   c                   V P                   P                  VR4      pVe
   V^ ,          # \        V P                  4      pV P	                  R4      pVR\        R4      RRRR\        R4      R	\        R
4      R^.RV//3V P                   V&   V P                  P                  VR\        R4      R\        R4      R^RR	\        R4      R\        R4      /R. RORRR	V//R. RO/\        R	4      \        P                  .34       V# )z
Return an ExtGState that sets the soft mask to the given shading.

Parameters
----------
smask : Reference
    Reference to a shading in DeviceGray color space, whose luminosity
    is to be used as the alpha channel.

Returns
-------
Name
Nz transparency group for soft maskr   r  AISFSMaskMaskr   
LuminosityBCGr  r   r  FormTypeGroupTransparencyCS
DeviceGrayMatrixr  r  r  )r   r   r   r   r   r   )r   r   r   r   )
r  ru  rv  r  r  rL   r  r(   r,  rk  )r   smaskrf  rM   groupObs   &&   r2   _soft_mask_statePdfFile._soft_mask_state  s&    &&**5$78OD''($$%GH[)uDLl+1#		)
u% 	%%Y4<An-$|, ,i#u6 #Y

#'
 	  r4   c                    V P                  V P                  \        . V P                  P	                  4       OV P
                  P	                  4       O4      4       R # r<   )r  r  r   r  rH  r  r   s   &r2   rD  PdfFile.writeExtGSTates  sT    !! !!((*''..0 	
r4   c                    V P                    FC  w  rpV P                  VP                  R V4       V P                  ! V!   V P	                  4        KE  	  R # r<   )r  r  r   r  r  )r   rP  
attributescontents   &   r2   rE  PdfFile._write_soft_mask_groups  sC    '+'='=#BGRUUD*5KK!NN (>r4   c                    Vw  r#rEVe   \        V4      pVe   \        V4      pW#WE3pV P                  P                  VR 4      pVe   V# \        V P                  4      pWpP                  V&   V# r<   )r   r  ru  rv  r  )r   hatch_styleedgefacehatchlwpatternrM   s   &&      r2   hatchPatternPdfFile.hatchPattern  sz     +E;D;D5-&&**;=ND++,,0[)r4   3.10c                    V P                   P                  4        UUUUUu/ uF  w  pw  r#rEWW43bK  	  uppppp# u upppppi r<   )r  r`   )r   ri   r   r   hls   &     r2   <lambda>PdfFile.<lambda>  s?    ,0,@,@,F,F,HC,HLQ1q9,HC Cs   ;c                6   \        4       pR pV P                  P                  4        EF  w  r4V P                  R4      pWQV&   RRP	                  4        Uu. uF  p\        V4      NK  	  up/pV P                  VP                  RR\        R4      R^R^R	^R
^ ^ W".RVRVRVR^^ ^ ^^ V P                  ^H,          ./	4       Vw  rrV P                  V^ ,          V^,          V^,          \        P                  4       V	eY   V P                  V	^ ,          V	^,          V	^,          \        P                  ^ ^ W"\        P                  \        P                  4
       V P                  V\        P                  4       V P                  ! V P!                  \"        P$                  ! V
4      \'        4       P)                  V4      RR7      !   V P                  \        P*                  4       V P-                  4        EK  	  V P/                  V P0                  V4       R# u upi )      R@zhatch patternProcsetsr  Nr   r  PatternType	PaintType
TilingTyper  XStepYStepr  ru  Fsimplify)r   r  r`   r  r  rL   r  r   r   r  r,  rX  rY  rQ  rF  ri  pathOperationsr   r  r   scalerD  r  r  r  )r   	hatchDictsidelenr  rM   rP  r@   res
stroke_rgbfill_rgbr  r  s   &           r2   rF  PdfFile.writeHatches  s   F	!%!5!5!;!;!=K##O4B dO%D%J%J%LM%LDG%LMOCti;<!Q1'7GcAq!Q4;;+;<>? /:+J%KK
1z!}jm((*#HQK!hqk//q'BLLGG%
 KKBOO,KK,,

5!
  ) -   ! KK'NNA ">B 	))95; Ns   Hc                    \        R\        V P                  4      ,          4      pV P                  RV 24      pV P                  P	                  W4W34       W43# )ae  
Add a Gouraud triangle shading.

Parameters
----------
points : np.ndarray
    Triangle vertices, shape (n, 3, 2)
    where n = number of triangles, 3 = vertices, 2 = x, y.
colors : np.ndarray
    Vertex colors, shape (n, 3, 1) or (n, 3, 4)
    as with points, but last dimension is either (gray,)
    or (r, g, b, alpha).

Returns
-------
Name, Reference
zGT%dzGouraud triangle )rL   r'   r   r  r(   )r   pointscolorsrM   rP  s   &&&  r2   addGouraudTrianglesPdfFile.addGouraudTriangles:  sV    $ FS!6!6778"3D6 :;$$d%?@xr4   c                $   \        4       pV P                   EF  w  r#rEW1V&   VP                  pVP                  V^ ,          V^,          ,          ^34      pVP                  ^,          pVR9   g   Q hVP                  V^ ,          V^,          ,          V34      p	V^8X  d   ^p\        P
                  ! V^ R7      R,
          p
\        P                  ! V^ R7      R,           pRW,
          ,          pT P                  VP                  RR^R^ R^R^R\        V^8X  d   R	MR
4      RRRV
^ ,          V^ ,          V
^,          V^,          .^ ^.V,          ,           /4       \        P                  ! V^ ,          V^,          ,          3RRRRV33.R7      p^ VR&   Wz,
          V,          VR&   V	RRV13,          R,          VR&   V P                  VP                  4       4       V P                  4        EK  	  V P                  V P                  V4       R# )r   r  l    NShadingTypeBitsPerCoordinateBitsPerComponentBitsPerFlag
ColorSpacer  rt  	AntiAliasFDecoder  u1r  r  dtyper  g     o@r      r  )r  r  )r  z>u4)r  )r   r   shapereshaper   r   r   r  r   rL   emptyr   tobytesr  r  r  )r   gouraudDictrM   rP  r  r  r  flat_pointscolordimflat_colors
points_min
points_maxfactor	streamarrs   &             r2   rG  PdfFile.writeGouraudTrianglesQ  s   f(,(=(=$Df "LLE ..%(U1X*=q)ABK||AHv%%% ..%(U1X*=x)HIK1}!4?J!4?J:#:;Ft$b#Qt$,M[|  eZ]JqM']JqM; !fx/0 qE!H$&&. $467I
 "#Ig#.#;v"EIh"-a(l";e"CIhJJy((*+NNO )>P 	++[9r4   c                    V P                   P                  \        V4      R4      pVe
   V^,          # \        V P                  4      pV P                  RV 24      pWV3V P                   \        V4      &   V# )z=Return name of an image XObject representing the given image.Nzimage )r  ru  r   rv  r  r  )r   rO  entryrM   rP  s   &&   r2   imageObjectPdfFile.imageObject}  sm       ED18ODOO$&0#("3RYr4   c                `   VRRR1,          pVP                   ^8X  d   VR3# VR,          p\        P                  ! VRR7      pVP                  ^,          ^8X  dQ   VR,          R,          p\        P                  ! V^8H  4      '       d   RpW#3# \        P                  ! VRR7      p W#3# RpW#3# )z
Unpack image array *im* into ``(data, alpha)``, which have shape
``(height, width, 3)`` (RGB) or ``(height, width, 1)`` (grayscale or
alpha), except that alpha is None if the image is fully opaque.
NC)orderr  )r  r  N   Nr  r  r  ).N)ndimr   r  r  r  )r   imrgbre  s   &&  r2   _unpackPdfFile._unpack  s     "X77a<t8OX,C((3c*Cxx{a7I.66%3,'' E
 : HHU#6E : :r4   c                   \        4       pVP                  VRR7       VP                  ^4       RpR;rE \        P                  ! RVP                  ^4      4      w  rgVR9   da   VP                  V4      p\        V4      V8w  d   \        R	4      hVR8X  d   \        V^,          4      pM4VR8X  d   TpM*VR8X  d	   W8,          pMVR
8X  d   M&VP                  V^4       VP                  ^^4       K  W4V3# )zV
Write the image *img* into the pdf file using png
predictors with Flate compression.
r  )r  r4   Ns   !L4s   IHDR   PLTE   IDATztruncated datas   IEND)r  r  r  )	r   saveseekstructunpackreadr'   RuntimeErrorrZ   )	r   imgbufferpng_data	bit_depthpaletter1   r   r  s	   &&       r2   	_writePngPdfFile._writePng  s    
 &A""	!==&++a.ALF22{{6*t9&&'7887? #DGIW_"GW_$HFA&KK1G++r4   c                   VP                   w  rEpR\        R4      R\        R4      RVRVR\        ^R^R	/V,          4      R
^/pV'       d   W7R&   \        P                  R,          '       Ed   VP                   R,          ^8X  d   VP	                  RR7      pR^
RVRV/p\
        P                  ! V4      p	V	P                  RR7      p
V^8X  Ed   V
Ee   \        V
4      p\        P                  ! V
 UUUu. uF  w  rV F  qNK  	  K  	  uppp\        P                  R7      pVR,          P                  \        P                  4      ^,          VR,          P                  \        P                  4      ^,          ,          VR,          ,          pVR,          P                  \        P                  4      ^,          VR ,          P                  \        P                  4      ^,          ,          VR!,          ,          p\        P                  ! V4      P                  \        P                  4      pV\        P                  ! VVVR7      ,          p\
        P                  ! V4      P!                  R4      p	V	P#                  V4       V P%                  V	4      w  pppVe   Vf   \'        R4      hVRV^,           p\        R4      \        R	4      V^,
          V.VR&   VVR
&   ^VR&   VVR
&   MV P%                  V	4      w  p pMRpV P)                  VV P+                  R4      VVR7       V'       d   V P,                  P/                  X4       M)V P,                  P/                  VP1                  4       4       V P3                  4        R# u upppi )"z
Write the image *data*, of shape ``(height, width, 1)`` (grayscale) or
``(height, width, 3)`` (RGB), as pdf object *id* and with the soft mask
(alpha channel) *smask*, which should be either None or a ``(height,
width, 1)`` array.
r   r  r   r   WidthHeightr  rt  r  r  rk  rs  r  	PredictorColorsColumnsr  )	maxcolorsNr  :r   Nr  :r   Nr  :r  Nr  )sorterPzinvalid PNG headerIndexedzlength of image stream)r  r  )r  r  r   )r  r  r   )r  r  r  )r  rL   r^   r{  squeezer   	fromarray	getcolorsr'   r   r  uint8r  uint32argsortsearchsortedconvert
putpaletter  r  r  r  r  r   r  r  )r   r  r   rv  r   r   color_channelsr   r  r  
img_colors
num_colors_colorcompr  	palette24rgb24indicesrgb8r  r  s   &&&&                  r2   	_writeImgPdfFile._writeImg  s    )-

%~tI$w-T1lA{"CN"ST!1&  L<<)**zz"~"|||,HniOC//$'C5J"z'= !_
((#VXQPUDPUD#V)+3%dm22299=C%dm22299=BD$T]+	 w-..ryy9R?w-..ryy9Q>@g' **Y/66rxx@ry%PQood+33C8w'/3~~c/B,)W$&';<<!/:>2%))_d;6G%/!^W%>L!*3&' !H*3&'!%!4!QC78	 	 	 $$X.$$T\\^4G $Ws   6Nc                   V P                   P                  4        Fh  w  rpV P                  V4      w  rEVe.   V P                  R4      pV P	                  WVP
                  4       MR pV P	                  WCP
                  V4       Kj  	  R # )Nrv  )r  rH  r  r  r  r   )r   r  rM   rP  r  adatasmaskObjects   &      r2   rI  PdfFile.writeImages  sj    !\\002MCr,,s+KD "009unn5"NN44 3r4   c                   V P                  WRR7      p\        V4      \        V4      \        V4      Wg3p	V P                  P	                  V	4      p
V
fu   \        R\        V P                  4      ,          4      pV P                  R\        V P                  4      ,          4      pVP                  V4      pWW.V P                  V	&   V# V
R,          V8  d   WZR&   V
^ ,          pV# )z<Return name of a marker XObject representing the given path.Fr  zM%dz	marker %dr  )	r  r   r   r  ru  rL   r'   r  get_extents)r   rS  rT  rF  rE  r  	joinstylecapstylepathopskeyr.   rM   rP  r  s   &&&&&&&&      r2   markerObjectPdfFile.markerObject  s     %%dE%BW~tDz4<M!!#&>DLL 112D##K#dll2C$CDB##E*D!%4 4DLL
  bzBr
!9Dr4   c                |   V P                   P                  4        EF  w  w  rr4pw  rgrVP                  V	^,          4      pV P                  VP                  RR\        R4      R\        R4      R\        VP                  4      /4       V P                  \        P                  V,          \        P                  4       V P                  \        P                  V,          \        P                  4       V P                  ! V!   V P                  \        P                  W#4      4       V P!                  4        EK  	  R# )   Nr   r  r   r  r  )r  r`   paddedr  r   rL   r   extentsr  r  r  r,  r_  	capstylesr`  rI  r  )
r   r  rF  rE  r  r  rM   rP  r  r  s
   &         r2   rJ  PdfFile.writeMarkers#  s    &*ll&8&8&:#9gV!d ;;rAv&Dti)T&\dll+-. KK*55i@(KK*44X>NKK!KKd34NN% ';r4   c                    \        R \        V P                  4      ,          4      pV P                  R\        V P                  4      ,          4      pV P                  P	                  WrW8VP                  4       VP                  4       WEV3	4       V# )zP%dzpath %d)rL   r'   r  r  r(   get_joinstyleget_capstyle)	r   r   rS  rT  rV  rW  rX  rM   rP  s	   &&&&&&&  r2   pathCollectionObjectPdfFile.pathCollectionObject9  sr    EC

O+,	C

O ;<

B$4$4$68Ig'	( r4   c                   V P                    EFv  w	  rr4rVrxp	V P                  W#R R7      p
VP                  V4      p\        P                  ! \        P
                  ! VP                  4      4      '       g   . ROpM&VP                  V4      p\        VP                  4      pV P                  VP                  RR\        R4      R\        R4      RV/4       V P                  \        P                  V,          \        P                   4       V P                  \        P"                  V,          \        P$                  4       V P                  ! V
!   V P                  \        P'                  W4      4       V P)                  4        EKy  	  R# )	Fr  Nr   r  r   r  r  r   r   r   r   )r  r  r  r   r  r   r  r  r   r  r   rL   r  r  r  r,  r_  r  r`  rI  r  )r   rM   rS  rT  rP  r  r  rV  rW  rX  r  r  r  s   &            r2   rK  $PdfFile.writePathCollectionTemplatesA  s   TI))$)FG##E*D66"++dll344&{{7+t||,ti)T&\"# KK*55i@(KK*44X>NKK!KKf67NN# $r4   c                   \        \        P                  ! WW#V^\        P                  P
                  \        P                  P
                  R\        P                  P
                  \        P                  P
                  .R4      4      .# )r3  r4   T)	r$  r!   r  r,  rS  rA  rR  rP  rL  )rS  r  rj  r  sketchs   &&&&&r2   r  PdfFile.pathOperationsV  sc    00TVYY__biioosBJJ4D4D\\!   	r4   c                    V'       d6   R R V P                   ^H,          V P                  ^H,          3pVP                  pMRpRpV P                  WW5VR7      pV P                  ! V!   R# )r  NF)r  r  )r   r   should_simplifyr  r  )r   rS  r  rj  r  r  cmdss   &&&&&  r2   	writePathPdfFile.writePath_  sa    djj2ot{{R/?@D++HDH""4D*0 # 2Tr4   c                ~    \        V P                  4      pV P                  P                  R^ V.4       \	        V4      # )z
Reserve an ID for an indirect object.

The name is used for debugging in case we forget to print out
the object with writeObject.
N)rv  r  r  r(   r   )r   rM   r   s   && r2   r  PdfFile.reserveObjectj  s6     $""#tQo.}r4   c                    V P                   P                  4       V P                  ,
          V P                  V,          ^ &   R# r   )ru  r~  r  r  r   s   &&r2   rz  PdfFile.recordXrefu  s(     $ ?r1r4   c                ^    V P                  VP                  4       VP                  W 4       R # r<   )rz  r   r   )r   objectr   s   &&&r2   r  PdfFile.writeObjectx  s    		"X$r4   c                |   V P                   P                  4       V P                  ,
          V n        V P	                  R\        V P                  4      ,          4       \        V P                  4       FG  w  pw  r#pVf   \        RW3,          4      hVR8X  d   RMRpRW#V3,          pV P	                  V4       KI  	  R# )zWrite out the xref table.s
   xref
0 %d
NzNo offset for object %d (%s)r  r/  r3  s   %010d %05d %b 
)	ru  r~  r  	startxrefr   r'   r  r&   AssertionError)r   r/   offset
generationrM   r  r&  s   &      r2   rM  PdfFile.writeXref|  s    $..8

?S%889-6t~~-F)A)D~$2aY>@ @ #&77dT*f#-FF

4  .Gr4   c                ~    V P                  R4      V n        V P                  V P                  V P                  4       R# )z8Write out the info dictionary, checking it for good formrh   N)r  
infoObjectr  r  r   s   &r2   rL  PdfFile.writeInfoDict  s.     ,,V4$--8r4   c           
         V P                  R4       V P                  \        R\        V P                  4      RV P                  RV P
                  /4      4       V P                  RV P                  ,          4       R# )zWrite out the PDF trailer.s   trailer
SizeRootInfos   
startxref
%d
%%%%EOF
N)r   r   r'   r  r  r/  r)  r   s   &r2   rN  PdfFile.writeTrailer  s`     	

< 

7S(T__T__&' 	(
 	

04>>ABr4   ))r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  ru  r  r  r  r   r  r   r  r/  r  r  r  r  r  r  r  r  r  r  r)  r  r  r   r  r<   r7  r   r   r  )NNNFN)r"  );r   r   r   r   r   r   r"  r)  r=  rY  r\  r   r  r  r  rh  rB  r~  r  rC  r  r  r  r  r<  r  rg  rx  rD  rE  r  r   
deprecatedpropertyhatchPatternsrF  r  rG  r  r  r  r  rI  r	  rJ  r  rK  staticmethodr  r  r  rz  r  rM  rL  rN  r   r   __classcell__r  r  s   @@r2   r  r    sB    g9R": .@ -* B	+?&
t 
8><1*
8t=~*|@|	2h
" OOF+H 6 - M$6L.*:X
.,:=~5:,*  		@%!9	C 	Cr4   r  c                      a a ] tR tRt o]P
                  ! R4      tRtV 3R ltR t	RR lt
R tRR	 ltRR
 ltR tRR ltR tRR ltR tRR/R ltR tRR ltR tR tRtVtV ;t# )rs  i  zfonts/pdfcorefontsrm  c                h   < \         SV `  WC4       Wn        V P                  4       V n        W n        R # r<   )r  r   r   new_gcr   	image_dpi)r   r   rB  r   r   r  s   &&&&&r2   r   RendererPdf.__init__  s'    '	++-"r4   c                j    V P                   P                  ! V P                  P                  4       !   R # r<   )r   r  r   rY  r   s   &r2   rY  RendererPdf.finalize  s!    		$''**,-r4   Nc                "   \        VR R4      pW!n        \        VRR4      pVP                  4       f   VP                  RRR7       VP                  '       d   VP
                  VP
                  3Vn        MPVe   \        V4      ^8  d   VP                  ^,          R3Vn        M!VP                  ^,          V^,          3Vn        V P                  P                  V4      pV'       d   V P                  P                  ! V!   W1n        WAn        R# )	
_fillcolor_effective_alphasr  NT)isRGBAr  r  r  r  r  r  )getattrrG  get_rgbset_foreground_forced_alpha_alpharH  r'   _rgbr   deltar   r  )r   r   	fillcolor	orig_fillorig_alphasrR  s   &&&   r2   check_gcRendererPdf.check_gc  s    Bl;	!b"5zB::< l48$&IIryy#9B #i.1"4$&GGAJ#4B $&GGAJ	!#=B b!IIe$ "*r4   c                (    V P                   R ,          # )r  )rB  r   s   &r2   get_image_magnification#RendererPdf.get_image_magnification  s    ~~d""r4   c                   VP                   R ,          w  rgV^ 8X  g   V^ 8X  d   R# Vf   VP                  R4       V P                  V4       RV,          V P                  ,          pRV,          V P                  ,          pV P                  P                  V4      pVf_   V P                  P                  \        P                  V^ ^ WbV\        P                  V\        P                  \        P                  4       R# VP                  4       P                  4       w  rrrV P                  P                  \        P                  ^^ ^ ^W#\        P                  WWW\        P                  V\        P                  \        P                  4       R# )r  Nr  r  )r  	set_alpharV  rB  r   r  r  r,  rb  rT  rU  rc  frozen	to_values)r   r   r@   r~   r  r  r  rK  imobtr1tr2tr3tr4tr5tr6s   &&&&&&         r2   
draw_imageRendererPdf.draw_image  s$    xx|6Q!VLLb1Ht~~%1Ht~~%yy$$R(IIRXX1aAr/?/?!2>>2;;@ ,5+;+;+=+G+G+I(CcIIRXX1ar/?/? s2;K;K!2>>2;;@r4   c                   V P                  W4       V P                  P                  Y#VR J ;'       d    VP                  4       R J VP	                  4       4       V P                  P                  V P                  P                  4       4       R # r<   )rV  r   r  get_hatch_pathget_sketch_paramsr  r   paint)r   r   rS  r  rgbFaces   &&&&&r2   	draw_pathRendererPdf.draw_path  sj    b"		tO;; 1 1 3t ;  "	$ 			)r4   c                   R p\         P                  ! V4      p\         P                  ! V4      p\        V4      '       g   RpVP                  4       '       * pM<\         P                  ! VR,          VR,          8H  4      '       d   VR,          R8g  pMRp\        V4      '       g   RpMr\         P                  ! \         P                  ! V	4      R8H  4      '       d   RpM<\         P                  ! VR,          VR,          8H  4      '       d   VR,          R8g  pMRp\        V4      ^ 8  d   \        V^ ,          P
                  4      M^ pV P                  W4WWV4      pVV,           ^,           VV,          8  pV'       d	   V'       g   \        P                  ! WW#VWVWxWWV4      # \         P                  ! V	4      p. p\        V P                  W#V4      4       F:  w  pw  ppV P                  P                  VVVVXX4      pVP                  V4       K<  	  V P                  P                  pV! V P                   P#                  4       !   ^ ^ ppV P%                  VVWVWxWWV4       F]  w  pppp p!V P'                  V V!4       VV,
          VV,
          p#p"V! ^^ ^ ^V"V#\(        P*                  V\(        P,                  4	       TTppK_  	  V! V P                   P/                  4       !   R# )TFr  N)r  r  )r   r  )r   asarrayr'   	get_hatchr  r   _iter_collection_uses_per_pathr   draw_path_collectionr   r&   _iter_collection_raw_pathsr   r  r(   r  r   push_iter_collectionrV  r,  rT  rU  pop)$r   r   master_transformr  all_transformsoffsetsoffset_trans
facecolors
edgecolors
linewidths
linestylesantialiasedsurlsoffset_positioncan_do_optimizationrW  rX  len_pathuses_per_pathshould_do_optimizationrV  
path_codesr/   rS  r  rM   r  lastxlastyxoyopath_idgc0rl  dxdys$   &&&&&&&&&&&&&&                      r2   rs   RendererPdf.draw_path_collection  s    #ZZ
+
ZZ
+
:F&(lln"4vvj&*T*::;;#D)S0&+#:Gvvbjj,344
4(Jt,<<==$T*c1&+# .1Z!^3uQx(();;7
D }$q(8m+CC 	 $-C44*>z	! ! &&$
$-d.M.M /9 %: A i9911D)Wfg?Dd#	%: !!!u-1-B-BJ
O.5)BGS'
 MM#w'%ZeB1aAr2r'7'7>>#r5E5.5 	r4   c                F   \        V4      p\        V4      pWx,          Wx,           ^,           8  d   \        P                  ! WW#WEV4       R# V P                  W4       VP	                  V4      p	VP                  4       p
V P                  P                  pV P                  P                  W#WV P                  P                  VP                  4       VP                  4       4      pV! \        P                  4       ^ ^ rVP                  V^ ^ V P                  P                   ^H,          V P                  P"                  ^H,          3RR7       F  w  pp\        V4      '       g   K  VRR w  pp^ Tu;8:  d#   V P                  P                   ^H,          8:  d0   M M,^ Tu;8:  d#   V P                  P"                  ^H,          8:  g   M K|  VV,
          VV,
          ppV! ^^ ^ ^VV\        P$                  V\        P&                  4	       TTrK  	  V! \        P(                  4       R# )r  NF)rj  r  r  )r'   r   draw_markersrV  rF  rE  r   r  r	  r   
_linewidthr  r  r,  rb  iter_segmentsr   r   rT  rU  rc  )r   r   marker_pathmarker_transrS  rT  rl  len_marker_pathusesrF  rE  r  markerr  r  r   coder@   r~   r  r  s   &&&&&&&              r2   r  RendererPdf.draw_markers4  s   
 k*4y!O$:Q$>>%%d&*7<b"www!!''tTWW5G5G 13 	rxx!u"00DIIOOB.		0@0@0CD 1  NHd 8}}}1Q6$))//B"66;dii&6&6&;;UAIBq!Q2r2+;+;r~~/ !u  	r{{r4   c                   \        V4      \        V4      8X  g   Q h\        V4      ^ 8X  d   R# VP                  ^8X  g   Q hVP                  ^,          ^8X  g   Q hVP                  ^,          ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^,          ^8X  g   Q hVP                  ^,          R9   g   Q hVP                  pVP                  V^ ,          V^,          ,          ^34      pVP	                  V4      pVP                  V4      pV P
                  P                  Wc4      w  rxV P
                  P                  p	VP                  ^,          ^8X  d<   VP                  R4       V P                  V4       V	! V\        P                  4       R# VR,          p
\        P                  ! WR,          4      '       d<   VP                  V
4       V P                  V4       V	! V\        P                  4       R# VR,          R,          p
V P
                  P                  Wj4      w  rV P
                  P                  V4      pV	! \        P                  V\        P                   V\        P                  \        P"                  4       R# )r   Nr  r  )r   r   r  r  )r  r  N)r'   r  r  r  r  r   r  r  r\  rV  r,  rk  r   allcloserx  rb  ra  rc  )r   r   r  r  rT  r  tpointsrM   r  r  re  smask_obgstates   &&&&&        r2   draw_gouraud_triangles"RendererPdf.draw_gouraud_trianglesZ  s   6{c&k)))v;!{{a||A!###||A!###{{a||A!###||A&(((qE!H!4a 89//&)//%())//@!!<<?aLLMM"4$w;;uWo..LLMM"4$ 7OJ/E))77GKAYY//9F288VR\\;; r4   c           	        Y6u;8X  d   ^ 8X  d=   M M9V P                   P                  W,
          W%,
          \        P                  4       R# \        P
                  ! V4      pV P                   P                  \        P                  ! V4      \        P                  ! V4      \        P                  ! V4      ) \        P                  ! V4      W\        P                  4       V P                   P                  ^ ^ \        P                  4       R# r   )	r   r  r,  rd  rz   r{   r}   r|   rf  )r   r@   r~   r   oldxoldyoldangles   &&&&&&&r2   _setup_textposRendererPdf._setup_textpos  s    !!IIQXqx<LL'EIITXXe_dhhuo"hhuo-txx2==2 IIQ2::.r4   c                H   V P                   P                  P                  V^HV4      w  rxrpVP                  4       e?   V P                  P
                  R,          ^,          P                  \        WW7W4      4       \        P                  R,          p\        P                  ! V4      pV P                  P                  \        P                  4       V P                  P                  \        P                  ! V4      \        P                   ! V4      \        P                   ! V4      ) \        P                  ! V4      W#\        P"                  4       V P%                  WP&                  4       Rp^ ^ pp. pV P                  P                  \        P(                  4       V
 EF  w  pppppV P                  P*                  P-                  VV4       VP.                  p\1        VV4      '       g   VP                  VVVVV34       Kf  V P3                  VV^ VV4       TTppVV3V8w  dI   V P                  P                  V P                  P5                  V4      V\        P6                  4       VV3pV P                  P                  V P9                  \;        V4      V4      \        P<                  4       EK  	  V P                  P                  \        P>                  4       V F-  w  pppppV PA                  VVVPC                  V4      VV4       K/  	  V F`  w  pprxV P                  P                  \        P                  VVWx\        PD                  \        PF                  \        PH                  4       Kb  	  V P                  P                  \        PH                  4       R# )H   Nr  r  r  )%
_text2pathmathtext_parserparser   r   r  r(   r   r^   r{  rz   r{   r  r,  rb  r}   r|   rT  rV  rQ  rN  r  track_glyphr|  r   r  r~  re  encode_stringr$  rg  rO  _draw_xobject_glyphr  rQ  rF  rc  )r   r   r@   r~   r0   r  r   r   r   descentglyphsrectsr   r   	prev_fontr  r  unsupported_charsr  fontsizenumoxoyr  s   &&&&&&&                 r2   draw_mathtextRendererPdf.draw_mathtext  s    OO++11!R> 	.w ::<#II""2&q)001Eq20 1 <</ LL		"		!dhhqk((1+txx{r//	1 	b''"	d		'+1'D(CRII((44T3?zzH'#66 "(($"b#)FG##BAtT:dh'94II$$TYY%7%7%A8%']]4 (( 2I		  !3!3CHh!G!#* ,2  			%+<'D(BC$$h 3 3C 8"bB ,=
 &+!BEIIRXXr2u\\277BKKA &+
 			%r4   mtextc          
     
   V P                  4       pVP                  4       p	VP                  WI4      p
\        P                  ! V
^H4      ;_uu_ 4       pVw  pRRR4       VP                  4       eU   V P                  P                  R,          ^,          P                  \        WVXP                  VP                  V4      4       R. rXP                   Fe  w  pppppVV8w  d5   V P                  P                  V4      pVRVVP                  ..,          pTpVRVV\        V.4      .VV,           ..,          pKg  	  ^ ^ Rp	ppV\!        V4      ^,
          8  Ed1   VVV^,            w  ppV^ ,          R8X  d   V^,          p	MV^ ,          V^ ,          u;8X  d   R8X  d   M MV^,          V^,          8X  d   V^,          V^,          ,
          p\#        V4      R8  dV   V^,          R;;,          V^,          ^ ,          ,          uu&   V^;;,          V^,          V^,          ,
          ,          uu&   M?V^;;,          VR,          V	,          V^,          ^ ,          .,          uu&   V^,          V^&   VV^,            EK<  V^,          pEKH  \%        4       P'                  V4      P)                  W#4      pV P+                  WP,                  4       V P                  P/                  \0        P2                  4       Rw  ppppV EF  pV^ ,          R8X  d<   V P                  P/                  V^,          V^,          \0        P4                  4       KM  V^ ,          R8X  d   VP7                  V^,          V^,          34      w  ppV P9                  VVVVV4       TTpp\!        V^,          4      ^8X  d;   V P                  P/                  V^,          ^ ,          \0        P:                  4       K  V P                  P/                  V^,          \0        P<                  4       EK  Q h	  V P                  P/                  \0        P>                  4       V PA                  4       pVPC                  V4       VPE                  ^ 4       \F        PH                  \F        PJ                  \F        PJ                  \F        PJ                  \F        PL                  .pVPN                   F]  w  ppp p!\G        VV.VV!,           V.VV!,           VV ,           .VVV ,           .^ ^ ..V4      p"V PQ                  VV"VVP,                  4       K_  	  R#   + '       g   i     EL; i)r  Nr  r&  g?g     @@r  r  ))get_texmanagerget_size_in_pointsmake_dvir   Dvir   r   r  r(   r   r   r   r&  r  sizer   r'   absr   
rotate_degr   rV  rQ  r  r,  rN  re  r  r  rg  rh  rO  rA  copy_propertiesset_linewidthr   MOVETOLINETO	CLOSEPOLYboxesrm  )#r   r   r@   r~   r0   r  r   r  
texmanagerr  dvifiledvir  oldfontseqx1y1r  r   r   r  r/   curxeltnxtr+  mytranscuryr  r  boxgcr  r  rK  rS  s#   &&&&&&&$                           r2   draw_texRendererPdf.draw_tex  s'   ((*
**,%%a2[["%%ED & ::<#II""2&q)001Eq$**dkk52: ; R-1YY)BGUE'!))//8',,788!VReUGn%5r%x@AAC .7 q$4#c(1*n1QqSzHC1vq6Q3q6+V+A#a&0@Q#a&v;$F2J#a&)+JFc!fSVm+FFvf}X5s1vayAAF VCF!HFA *''.88> 	b''"		'!+dD$C1v		  QQ?Q6!$..AA/?@
d##D$tTB!4ds1v;!#II$$SVAY8II$$SVR[[9u  			% b!A;;T[[$++>># JJLBAq"bBqD":1bd|b"Q$ZQ!")+DNN5$9 'S &%%s   T77U	c                X    VR9   d   VP                  RR4      # VP                  RR4      # )r   r  r\   r5  )r   r  )r   )r   r0   r   s   &&&r2   r  RendererPdf.encode_string	  s,    v88Hi00xx
I..r4   c	                r   V P                  WP                  4       V'       d   V P                  WW4WV4      # VP                  4       p	\        P
                  R ,          '       d   V P                  V4      p
^pMMV P                  V4      p
V P                  P                  P                  W4       \        P
                  R,          pVP                  4       eq   V
P                  V4       V
P                  4       w  rV P                  P                  R,          ^,          P                  \!        WW<^@,          V^@,          V4      4       VR9  d   V P                  P#                  \$        P&                  V P                  P)                  V4      V	\$        P*                  4       V P-                  W#V4       V P                  P#                  V P/                  WK4      \$        P0                  \$        P2                  4       R# . p. pRpT
p\4        P6                  ! WJ\8        P:                  R7       EF  p\=        V\?        VP@                  4      4      '       d   V'       g   VPB                  V8w  d5   VP                  VPB                  VPD                  . 34       VPB                  pVPF                  '       d*   VR,          ^,          P                  VPF                  4       VR,          ^,          P                  VP@                  4       RpK  VP                  VPB                  VPD                  VPH                  34       RpEK  	  V P                  P#                  \$        PJ                  4       \L        PN                  ! V4      pV P                  P#                  \L        PP                  ! V4      \L        PR                  ! V4      \L        PR                  ! V4      ) \L        PP                  ! V4      W#\$        PT                  4       V P                  P#                  \$        P&                  4       ^ pV EF  w  pppV P                  P)                  VPV                  4      pV P                  P#                  VV	\$        P*                  4       V P-                  V^ ^ V^ ^ 4       V P                  P#                  \X        PZ                  ! V\\        4       UUu. uFK  w  ppV\^        8X  d   R	\a        V4      ,          V	,          M V P/                  RPc                  V4      V4      NKM  	  upp\$        Pd                  4       TpEK  	  V P                  P#                  \$        P2                  4       V F  w  pppV Pg                  VV	VV^ 4       K  	  V P                  P#                  \$        Ph                  4       R# u uppi )
rm  r  NT)	kern_modeFr"  r  )r  *   i)5rV  rQ  r  r  r^   r{  _get_font_afm_get_font_ttfr   r  trackr   set_textget_width_heightr  r(   r   r  r,  rN  r~  re  r  r  rg  rO  r	   layoutr   UNFITTEDr   r"  char	ft_objectr@   	prev_kern	glyph_idxrb  rz   r{   r}   r|   rT  r|  r   groupbyr   r   rv  r)   rh  r  rc  )r   r   r@   r~   r0   r  r   ismathr  r  r  r   r   r   singlebyte_chunksmultibyte_glyphsprev_was_multibyter  itemr   prev_start_xr  start_xkerns_or_charsft_nametpgroupr  s   &&&&&&&&&                   r2   	draw_textRendererPdf.draw_text	  s.   
 	b''"%%bQ4??**,<<,--%%d+DH%%d+DII((..t7||N3H::<#MM! 113MEII""2&q)001Eq"*frk52: ;
 7"IIR]]!YY//5xPe,IIT//<WWbkk3$ !#!!%I%,,Q@P@PQQ'#dii.AA)T^^y-H)00$..$&&"1MN$(NN	~~~)"-a077G%b)!,33DII>).&$++T^^TVVT^^,TU)-& R IIRXX&U#AIITXXa[$((1+"hhqk\488A;2#3#35
 IIR]]+L6G2	7N)),,Y__=		  (BMMB##GQ<AF		  
 '0&7&7&MO&MU 8:U{UT%[(83,,RWWU^XFG&MO KK!  ' 7H IIR[[)1A-	7I((xGQ 2B IIR[[)Os   AV3c                Z   VP                  V4      pV P                  P                  VP                  V4      pV P                  P	                  \
        P                  RV,          ^ ^ RV,          WE\
        P                  \        V4      \
        P                  \
        P                  4       R# )z<Draw a multibyte character from a Type 3 font as an XObject.r  N)r  r   r  r|  r  r,  rb  rT  rL   rU  rc  )r   r  r  r  r@   r~   r  rM   s   &&&&&&  r2   r  RendererPdf._draw_xobject_glyph{	  sv    ((3
yy00ZH		HHHaEH$4aB<L<LJKK		
r4   c                ,    \        V P                  4      # r<   )r  r   r   s   &r2   rA  RendererPdf.new_gc	  s    !$)),,r4   )r   r   rB  r<   r   r8  )r   r   r   r   r   _get_data_pathrt  _use_afm_rc_namer   rY  rV  rY  rf  rm  rs  r  r  r  r  r  r  r  r  rA  r   r   r=  r>  s   @@r2   rs  rs    s     (()=>M+#.+6#@<*DL$L& P/4&lQ:$ Q:f/
_*B	
- -r4   rs  c            
          a a ] tR tRt oV 3R ltR tR tR tR tR^ R^R	^/t	R
^ R^R^/t
R tR tR tR tR tR tR tR tR tR tR tR]3R]3R]3R]3R]3R ]3R!]3R"]3R#]33	tR tV 3R ltR tRtVtV ;t# )$r  i	  c                Z   < \         SV `  4        RV n        RV n        Wn        RV n        R# )r  NrJ  rK  )r  r   rG  rH  r   parent)r   r   r  s   &&r2   r   GraphicsContextPdf.__init__	  s)    )!+	r4   c                N    \        V P                  4      pVR  VR \        V4      # )r   r   )r   r  repr)r   ru   s   & r2   r   GraphicsContextPdf.__repr__	  s'    fIhKAwr4   c                    V P                   ^ 8  ;'       dN    V P                  ^ 8  ;'       d7    \        V P                  4      ^8*  ;'       g    V P                  ^,          R8g  # )z
Predicate: does the path need to be stroked (its outline drawn)?
This tests for the various conditions that disable stroking
the path, in which case it would presumably be filled.
r  )r  rP  r'   rQ  r   s   &r2   rE  GraphicsContextPdf.stroke	  sX     !# = =a = =TYY1$;;		!(;	>r4   c                    \        V4      '       d   V^ ,          pMV P                  pV P                  ;'       g/    VRJ;'       d#    \        V4      ^8*  ;'       g    V^,          R8g  # )z
Predicate: does the path need to be filled?

An optional argument can be used to specify an alternative
_fillcolor, as needed by RendererPdf.draw_markers.
Nr  )r'   rG  _hatch)r   argsrG  s   &* r2   rF  GraphicsContextPdf.fill	  si     t99aJJ A A4' @ @j/Q&>>*Q-3*>	Br4   c                f    \         P                  V P                  4       V P                  4       4      # )zW
Return the appropriate pdf operator to cause the path to be
stroked, filled, or both.
)r,  rI  rF  rE  r   s   &r2   rk  GraphicsContextPdf.paint	  s!    
 }}TYY[$++-88r4   buttr  
projectingmiterbevelc                H    V P                   V,          \        P                  .# r<   )r  r,  r`  r   styles   &&r2   capstyle_cmdGraphicsContextPdf.capstyle_cmd	  s    u%r}}55r4   c                H    V P                   V,          \        P                  .# r<   )r  r,  r_  r  s   &&r2   joinstyle_cmd GraphicsContextPdf.joinstyle_cmd	  s    &77r4   c                &    V\         P                  .# r<   )r,  ri  )r   r   s   &&r2   linewidth_cmd GraphicsContextPdf.linewidth_cmd	  s    r''r4   c                R    Vw  r#Vf   . p^ p\        V4      V\        P                  .# r<   )r   r,  r^  )r   dashesr+  dashs   &&  r2   dash_cmdGraphicsContextPdf.dash_cmd	  s-    <DFT
FBJJ//r4   c                \    V P                   P                  V4      pV\        P                  .# r<   )r   rg  r,  ra  )r   re  forcedeffective_alphasrM   s   &&&& r2   	alpha_cmdGraphicsContextPdf.alpha_cmd	  s&    yy##$45bll##r4   c                B   V'       gE   V P                   e   V P                  V P                   4      # \        R4      \        P                  .# W P                   W3pV P
                  P                  V4      p\        R4      \        P                  V\        P                  .# )Nr  r  )rG  fillcolor_cmdrL   r,  r[  r   r  r]  )r   r  hatch_colorhatch_linewidthr  rM   s   &&&&  r2   	hatch_cmdGraphicsContextPdf.hatch_cmd	  s    *))$//::[)2+E+EFF&PK99))+6DOR%?%?"//1 1r4   c                    \         P                  R ,          '       d   . # V^ ,          V^,          u;8X  d   V^,          8X  d   M MV^ ,          \        P                  .# . VR,          O\        P                  N# )pdf.inheritcolorr  )r^   r{  r,  rV  rX  r   r  s   &&r2   rgb_cmdGraphicsContextPdf.rgb_cmd	  s_    <<*++Iq6SV%s1v%FB--../SW/b..//r4   c                    Ve   \         P                  R,          '       d   . # V^ ,          V^,          u;8X  d   V^,          8X  d   M MV^ ,          \        P                  .# . VR,          O\        P                  N# )Nr-  r  )r^   r{  r,  rW  rY  r.  s   &&r2   r'   GraphicsContextPdf.fillcolor_cmd	  sc    ;#,,'9::IVs1v'Q'FB00112SW2b1122r4   c                    \        V P                  4      pVP                  V 4       V P                  Vn        Wn        \        P
                  .# r<   )r  r   r  r   r,  rb  )r   r   s   & r2   ru  GraphicsContextPdf.push	  s:    #DII.t$zr4   c                    V P                   f   Q hV P                  V P                   4       V P                   P                   V n         \        P                  .# r<   )r   r  r,  rc  r   s   &r2   rw  GraphicsContextPdf.pop	  sA    {{&&&T[[)kk((}r4   c                   . pV P                   V P                  3W38w  d0   V P                  e"   VP                  V P	                  4       4       KM  V P                   V P                  3W38w  g   V P                  f   VP                  V P                  4       4       V P                   V8w  d@   VP                  V\        P                  \        P                  \        P                  .4       V P                  V8w  d^   VP                  4       w  rEVP                  \        P                  WERR7      \        P                  \        P                  .,           4       V# )z1Set clip rectangle. Calls `.pop()` and `.push()`.Fr  )	_cliprect	_clippathr   r  rw  ru  r,  rQ  rj  rG  get_transformed_path_and_affiner  r  )r   cliprectclippathr  rS  affines   &&&   r2   clip_cmdGraphicsContextPdf.clip_cmd	  s    /H3GGKK+KK
#^^T^^,0DD#KK		$~~)Xr||RWWbjjIJ~~)'GGI**4%*HWWbjj)*+ r4   c           
        . pRpV P                    F  w  rERpV F>  p\        W4      p\        W4      p	 Ve   V	f   WJpM\        W8g  4      p V'       g   K>   M	  VP                  R8X  d   V'       d   RpV'       g   Kp  VP                  R8X  d   RpV Uu. uF  p\        W4      NK  	  p	pVP                  V! V .V	O5!  4       V F  p\        W\        W4      4       K  	  K  	  V#   \         dj    \        P
                  ! T4      p\        P
                  ! T	4      p	TP                  T	P                  8g  ;'       g    \        P                  ! Y8g  4      p ELi ; iu upi )ze
Copy properties of other into self and return PDF commands
needed to transform *self* into *other*.
Fr*  Tr'  )commandsrL  r   r   r   rp  r  anyr   r  setattr)
r   r  r  fill_performedparamscmd	differentpourstheirss
   &&        r2   rR  GraphicsContextPdf.delta
  sE   
 ==KFIt' *	9|v~$($6	$($8	 9 " ||{*~ 	y<<?2%)N5;<V'%+V<C.v./ADWU%67  7 ): ' " 9::d+DZZ/F!%v||!; "8 "8!#!7 9 =s$   C+ C+E"+AEEEc                   < \         SV `  V4       \        VRV P                  4      p\        VRV P                  4      pW n        W0n        R# )z%
Copy properties of other into self.
rG  rH  N)r  r  rL  rG  rH  )r   r  rS  r#  r  s   &&  r2   r  "GraphicsContextPdf.copy_propertiesC
  sH     	&E<A	"5*=#'#9#9;#!1r4   c                h    . pV P                   e"   VP                  V P                  4       4       K/  V# )z2
Make sure every pushed graphics state is popped.
)r   r  rw  )r   r  s   & r2   rY  GraphicsContextPdf.finalizeN
  s*     kk%KK
#r4   )rH  rG  r   r   )r8  r9  )rP  rO  rH  )	_capstyle)rG  )
_joinstyle)r  )_dashes)rQ  )r  _hatch_color_hatch_linewidth)r   r   r   r   r   r   rE  rF  rk  r  r  r  r  r  r  r$  r*  r/  r'  ru  rw  r>  rA  rR  r  rY  r   r   r=  r>  s   @@r2   r  r  	  s     	>B9 GQa8I1gq'15J68(0$
103, 
$X.	99E	&	-(	-(	-(	x 	G	7CH$L	2 r4   r  c                      a  ] tR tRt o Rt]P                  ! RRRR7      RR l4       tR	 tR
 t	R t
R tR tRR ltR t. RO3R ltRtV tR# )PdfPagesiX
  a  
A multi-page PDF file.

Examples
--------
>>> import matplotlib.pyplot as plt
>>> # Initialize:
>>> with PdfPages('foo.pdf') as pdf:
...     # As many times as you like, create a figure fig and save it:
...     fig = plt.figure()
...     pdf.savefig(fig)
...     # When no figure is specified the current figure is saved
...     pdf.savefig()

Notes
-----
In reality `PdfPages` is a thin wrapper around `PdfFile`, in order to avoid
confusion when using `~.pyplot.savefig` and forgetting the format argument.
r  
keep_emptyzThis parameter does nothing.)addendumNc                ,    Wn         W0n        RV n        R# )a  
Create a new PdfPages object.

Parameters
----------
filename : str or path-like or file-like
    Plots using `PdfPages.savefig` will be written to a file at this location.
    The file is opened when a figure is saved for the first time (overwriting
    any older file with the same name).

metadata : dict, optional
    Information dictionary object (see PDF reference section 10.2.1
    'Document Information Dictionary'), e.g.:
    ``{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}``.

    The standard keys are 'Title', 'Author', 'Subject', 'Keywords',
    'Creator', 'Producer', 'CreationDate', 'ModDate', and
    'Trapped'. Values have been predefined for 'Creator', 'Producer'
    and 'CreationDate'. They can be removed by setting them to `None`.
N)	_filename	_metadata_file)r   r	  rW  re   s   &&&&r2   r   PdfPages.__init__m
  s    . "!
r4   c                    V # r<   r   r   s   &r2   	__enter__PdfPages.__enter__
  s    r4   c                &    V P                  4        R # r<   )r\  )r   exc_typeexc_valexc_tbs   &&&&r2   __exit__PdfPages.__exit__
  s    

r4   c                    V P                   f'   \        V P                  V P                  R7      V n         V P                   # )Nre   )r\  r  rZ  r[  r   s   &r2   _ensure_filePdfPages._ensure_file
  s,    :: $..IDJzzr4   c                    V P                   e>   V P                   P                  4        V P                   P                  4        RV n         R# R# )zG
Finalize this object, making the underlying file a complete
PDF file.
N)r\  rY  r\  r   s   &r2   r\  PdfPages.close
  s:    
 ::!JJ!JJDJ "r4   c                6    V P                  4       P                  # )zy
Return a modifiable information dictionary object
(see PDF reference section 10.2.1 'Document Information
Dictionary').
)ri  r  r   s   &r2   infodictPdfPages.infodict
  s       "+++r4   c                   \        V\        4      '       gY   Vf   \        P                  ! 4       pM\        P                  ! V4      pVf   \        RV 24      hVP                  P                  pVP                  ! V 3RRRR/VB  R# )z
Save a `.Figure` to this file as a new page.

Any other keyword arguments are passed to `~.Figure.savefig`.

Parameters
----------
figure : `.Figure` or int, default: the active figure
    The figure, or index of the figure, that is saved to the file.
Nz
No figure r  r  rd   )	r=   r   r   
get_activeget_fig_managerr   canvasfiguresavefig)r   rt  kwargsmanagers   &&, r2   ru  PdfPages.savefig
  ss     &&))~..*--f5 :fX!677^^**FtCEC5CFCr4   c                H    \        V P                  4       P                  4      # )z=Return the current number of pages in the multipage pdf file.)r'   ri  r  r   s   &r2   get_pagecountPdfPages.get_pagecount
  s    4$$&//00r4   c                D    V P                  4       P                  W4       R# )z
Add a new text note to the page to be saved next. The optional
positionRect specifies the position of the new note on the
page. It is outside the page per default to make sure it is
invisible on printouts.
N)ri  r)  )r   r&  r'  s   &&&r2   attach_notePdfPages.attach_note
  s     	'';r4   )r\  rZ  r[  r  r<   r6  )r   r   r   r   r   r   delete_parameterr   r_  re  ri  r\  rn  ru  rz  r}  r   r   r  s   @r2   rV  rV  X
  sf     ( 
6<$BDD2
,D,1 .@ < <r4   rV  c                   V   a a ] tR tRt o^HtRR/tR tRRRR/R ltV 3R	 ltR
t	Vt
V ;t# )FigureCanvasPdfi
  r  zPortable Document Formatc                    R # )r  r   r   s   &r2   get_default_filetype$FigureCanvasPdf.get_default_filetype
  s    r4   bbox_inches_restoreNre   c                  V P                   P                  p^HV P                   n        V P                   P                  4       w  rV\        V\        4      '       d   VP                  4       pM\        WR7      p VP                  WV4       \        V P                   WVV\        WtWe4      VR7      pV P                   P                  V4       VP                  4        \        V\        4      '       g   VP                  4        \        V\        4      '       d   VP                  4        R# VP                  4        R#   \        T\        4      '       d   TP                  4        i TP                  4        i ; i)r  rh  )r  N)rt  dpiget_size_inchesr=   rV  ri  r  r"  r   rs  drawrY  r  r\  )	r   r	  r  re   r  r   r   r   renderers	   &&$$     r2   	print_pdfFigureCanvasPdf.print_pdf
  s    kkoo335h))((*D87D	LL'(UCDv5$79H KKX&h11(H-- 

 (H-- 

s   8BD8 89E1c                T   < V P                   P                  4        \        SV `  4       # r<   )rt  draw_without_renderingr  r  )r   r  s   &r2   r  FigureCanvasPdf.draw
  s    **,w|~r4   r   )r   r   r   r   	fixed_dpi	filetypesr  r  r  r   r   r=  r>  s   @@r2   r  r  
  s;      I23I&*594 r4   r  c                       ] tR tRt]tRtR# )_BackendPdfi
  r   N)r   r   r   r   r  FigureCanvasr   r   r4   r2   r  r  
  s    "Lr4   r  )K   )r   )_r   r   r   r   enumr   	functoolsr   ior   r   loggingrz   rW   r-  r  r7  rr   r  r  r|  numpyr   PILr   
matplotlibr^   r   r	   r
   r   r   matplotlib._pylab_helpersr   matplotlib.backend_basesr   r   r   r   r   !matplotlib.backends.backend_mixedr   matplotlib.figurer   matplotlib.font_managerr   r   rq  matplotlib._afmr   matplotlib.ft2fontr   r   r   r   r   matplotlib.transformsr   r   matplotlib.pathr   matplotlib.datesr    r!   r"  r"   	getLoggerr   rw  r3   rl   rx   r   r   r   r>   	maketransr   r   r   r   rL   r$  r,  rn  r  r  RendererPDFPSBasers  r  rV  r  FigureManagerPdfexportr  r   r4   r2   <module>r     s       $     	   
        F F )  @ $ I  Q Q 4      "d,Tn0,"*04 }}&#uc5$tUD EF#R  .      B A# A#HZ$ Z$z+\DC DCN(m-/33 m-`J, JZn< n<b%& %P %  
#( # #r4   