
    he                    R   S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSKrSS	KJrJrJrJrJr  SS
K J!r!  SSK"J#r#J$r$J%r%J&r&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-J.r/  SSK0J1r1  SSK2J3r3J4r4J5r5J6r6J7r7  SSK8J9r9J:r:  SSK;J<r<  SSK=J>r>  SSKJ?r?  SSK@JArA  \R                  " \C5      rDS<S jrES rFS rGS=S jrHS=S jrIS=S jrJ\KR                  SSSS S!S".5      rMS# rNS$ rO " S% S&5      rP\ " S' S(5      5       rQ " S) S*5      rR " S+ S,\5      rS " S- S.5      rTS/ rU " S0 S15      rV " S2 S3\AR                  5      rX " S4 S5\&5      rY " S6 S75      rZ " S8 S9\$5      r[\%r\\#R                   " S: S;\#5      5       r^g)>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                     SnSn/ n[        U 5       HG  u  pV[        U5      nX'-   U:  a	  X'S-   -  nM!  UR                  SR                  XU 5      5        UnUnMI     UR                  SR                  XS 5      5        SR                  U5      $ )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.
r   r#       N   
)	enumeratelenappendjoin)stringslinelencurrposlastiresultislengths           Q/var/www/html/env/lib/python3.13/site-packages/matplotlib/backends/backend_pdf.py_fillr5   _   s     GEF'"Qg%z!GMM$))G!$456EG # MM$))GFO,-::f    c           
         [         R                  " S5      nU(       aB  [        R                  " [	        U5      [
        R                  5      nUR                  [        S9nO[        R                  " 5       nS[        R                   S3SU  S[        R                   3US.UEnUR                  5        VVs0 s H  u  pVUc  M
  XV_M     nnnS nS	Ul        S
 nSUl        S n	SU	l        UUUUUUUUU	S.	n
U Ht  nXZ;  a*  [        R                  " SU< S[!        U
5      < S35        M2  X   " XE   5      (       a  ME  [        R                  " SU SXE   < SX   R                   S35        Mv     SU;   a  [#        US   5      US'   U$ s  snnf )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)tzinfozMatplotlib vz, https://matplotlib.orgzMatplotlib z
 backend v)CreatorProducerCreationDatec                 "    [        U [        5      $ N)
isinstancestrxs    r4   is_string_like-_create_pdf_info_dict.<locals>.is_string_like   s    !S!!r6   zan instance of strc                 "    [        U [        5      $ r>   )r?   r   rA   s    r4   is_date&_create_pdf_info_dict.<locals>.is_date   s    !X&&r6   z an instance of datetime.datetimec                 T    [        U [        5      (       a  U R                  S;   $ U S;   $ )N)s   Trues   Falses   Unknown)TrueFalseUnknownr?   NamenamerA   s    r4   check_trapped,_create_pdf_info_dict.<locals>.check_trapped   s+    a66<<<444r6   z#one of {"True", "False", "Unknown"})	TitleAuthorSubjectKeywordsr:   r;   r<   ModDateTrappedzUnknown infodict keyword: z. Must be one of .zBad value for infodict keyword z. Got z which is not rV   )osgetenvr   fromtimestampintr   utcreplacer!   todaympl__version__itemstext_for_warningr	   warn_externalsetrM   )backendmetadatasource_date_epochsource_dateinfokvrC   rF   rO   keywordss              r4   _create_pdf_info_dictrm   u   s   @ 		"56,,S1B-CX\\R!)))5nn& "#//!22JK!'*S__4EF# 	D  $zz|=|VaqDAD|D="&:N#'AG5
 &KM"   !"!" 
H !;A5 A114X0A D ETW%%!@ D&&*g["*+">">!?q B C  DtI/YKO >s   6	F	F	c                 B   U R                  S5      nU R                  5       nUb  UR                  nO6[        R                  (       a  [        R
                  nO[        R                  nUS:X  a  US-  nU$ US:  a  USU* S-  U* S-  4-  -  nU$ USUS-  US-  4-  -  nU$ )zL
Convert a datetime to a PDF string representing it.

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


#$A	A}II==AAAv	S
 H	 
Q	]rdlaR4K888 H 	
]a4iT222Hr6   c                    [         R                  " U* 5      n[         R                  " U5      n[         R                  " U5      nXU-  -   nXU-  -   nXU-  -   X5-  -   n	XU-  -
  X6-  -   n
XU-  -   nXU-  -
  nX4X4X4Xx44$ )zJ
Calculate the coordinates of rectangle when rotated by angle around x, y
)mathradianssincos)rB   ywidthheightangle	sin_angle	cos_angleabcrv   efs                r4   !_calculate_quad_point_coordinatesr      s    
 LL% EII	YA	YA	I 22A	I 22A	IA	IAFQFQFQF++r6   c                 8   [        XUX45      nUS-  (       a  SOSn[        S U 5       5      U-
  n[        S U 5       5      U-
  n[        S U 5       5      U-   n	[        S U 5       5      U-   n
[        [        R
                  R                  U5      5      XxX44$ )z[
Get the coordinates of rotated rectangle and rectangle that covers the
rotated rectangle.
Z   gh㈵>r   c              3   *   #    U  H	  oS    v   M     g7fr   N .0rk   s     r4   	<genexpr>,_get_coordinates_of_block.<locals>.<genexpr>       'h!h   c              3   *   #    U  H	  oS    v   M     g7fr#   Nr   r   s     r4   r   r     r   r   c              3   *   #    U  H	  oS    v   M     g7fr   r   r   s     r4   r   r     r   r   c              3   *   #    U  H	  oS    v   M     g7fr   r   r   s     r4   r   r     r   r   )r   minmaxtuple	itertoolschainfrom_iterable)rB   r   r   r   r   verticespadmin_xmin_ymax_xmax_ys              r4   _get_coordinates_of_blockr      s     1u17@H RZ'QC'h''#-E'h''#-E'h''#-E'h''#-E)////9:5(* *r6   c                     [        XX4U5      u  pg[        S5      [        S5      U/ SQ[        S5      U R                  5       S.S.nUS-  (       a  XhS'   U$ )	z5
Create a link annotation object for embedding URLs.
AnnotLinkr   r   r   URI)Sr   )TypeSubtypeRectBorderAr   
QuadPoints)r   rM   get_url)	gcrB   r   r   r   r   
quadpointsrectlink_annotations	            r4   _get_link_annotationr     s\     1ueLJW<e::<
	O rz(2%r6   z\\z\(z\)z\nz\r)\()
c                    [        U S5      (       a  U R                  5       $ [        U [        [        R
                  45      (       aK  [        R                  " U 5      (       d  [        S5      eSU -  nUR                  S5      R                  S5      $ [        U [        5      (       a  SS/U    $ [        U [        [        R                  45      (       a  SU -  $ [        U [        5      (       aU  [        U R                  5       (       a  U R                  S	5      5      $ [        R                   U R                  S
5      -   5      $ [        U ["        5      (       a9  SU R%                  S5      R'                  [(        5      R                  S5      -   S-   $ [        U [*        5      (       aY  [-        S/U R/                  5        VVs/ s H-  u  p#[1        U5      R                  5       S-   [        U5      -   PM/     snnQSP5      $ [        U [2        [4        45      (       a*  [-        S/U  Vs/ s H  n[        U5      PM     snQSP5      $ U c  g[        U [6        5      (       a  [        [9        U 5      5      $ [        U [:        5      (       a/  [-        U R<                   Vs/ s H  n[        U5      PM     sn5      $ [?        S[A        U 5       S35      es  snnf s  snf s  snf )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boolr[   integerr@   isasciiencodecodecsBOM_UTF16_BEbytesdecode	translate_str_escapesdictr5   ra   rM   listr   r   ry   r   bounds	TypeErrortype)objrw   rj   rk   vals        r4   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L
 
  	 
C$	'	'dAc:csgclc:ADABB 
 
C	"	"',-- 
C	"	"cjj9jsgclj9:: >tCyk J" " # 	#+ M ; :s   ?4K$K
Kc                 B    U S:X  a  US:*  $ U S:X  a  US:*  $ [        5       e)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     r4   _font_supports_glyphr   t  s/     1}|2~~

r6   c                   0    \ rS rSrSrS rS rS rS rSr	g)		Referencei  zJ
PDF reference object.

Use PdfFile.reserveObject() to create References.
c                     Xl         g r>   idselfr   s     r4   __init__Reference.__init__  s    r6   c                      SU R                   -  $ )Nz<Reference %d>r   r   s    r4   __repr__Reference.__repr__  s    $''))r6   c                      SU R                   -  $ )Ns   %d 0 Rr   r   s    r4   r   Reference.pdfRepr  s    477""r6   c                 x    UR                   nU" SU R                  -  5        U" [        U5      5        U" S5        g )N	   %d 0 obj
s   
endobj
)writer   r   )r   contentsfiler   s       r4   r   Reference.write  s1    

mdgg%&gh mr6   r   N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes__r   r6   r4   r   r     s    *#r6   r   c                       \ rS rSrSrSr1 \" S5      k1 \" \" S5      \" S5      S-   5      k-
   V Vs0 s H	  nUSU-  _M     snn rS	 r	S
 r
S rS rS rS rS rSrgs  snn f )rM   i  zPDF name object.rN      !~r#   z#%02xc                     [        U[        5      (       a  UR                  U l        g [        U[        5      (       a  UR	                  S5      nUR                  U R                  5      R                  S5      U l        g )Nr   )r?   rM   rN   r   r   r   _hexifyr   )r   rN   s     r4   r   Name.__init__  sT    dD!!		DI$&&{{7+t||4;;GDDIr6   c                      SU R                   -  $ )Nz	<Name %s>r  r   s    r4   r   Name.__repr__  s    TYY&&r6   c                 >    SU R                   R                  S5      -   $ )N/r   )rN   r   r   s    r4   __str__Name.__str__  s    TYY%%g...r6   c                 b    [        U[        5      =(       a    U R                  UR                  :H  $ r>   rL   r   others     r4   __eq__Name.__eq__  s!    %&B499

+BBr6   c                 b    [        U[        5      =(       a    U R                  UR                  :  $ r>   rL   r  s     r4   __lt__Name.__lt__  s!    %&A499uzz+AAr6   c                 ,    [        U R                  5      $ r>   )hashrN   r   s    r4   __hash__Name.__hash__  s    DIIr6   c                      SU R                   -   $ )N   /r  r   s    r4   r   Name.pdfRepr  s    diir6   N)r   r   r   r   r  	__slots__rangeordr	  r   r   r  r  r  r  r   r  r   r   s   00r4   rM   rM     s    I%%*(H%C#c(Q,*G(HHJH1 'A+~HJGE'/CB 5Js   ArM   c                   $    \ rS rSrSrS rS rSrg)Verbatimi  zEStore verbatim PDF command content for later inclusion in the stream.c                     Xl         g r>   _x)r   rB   s     r4   r   Verbatim.__init__  s    r6   c                     U R                   $ r>   r'  r   s    r4   r   Verbatim.pdfRepr  s    wwr6   r'  N)r   r   r   r   r  r   r   r  r   r6   r4   r%  r%    s    Or6   r%  c                       \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!S r"S!r#S"r$S#r%S$r&S%r'S&r(S'r)S( r*\+S) 5       r,S*r-g+),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                     U R                   $ r>   )valuer   s    r4   r   
Op.pdfRepr  s    zzr6   c                     U(       a  U(       a  U R                   $ U R                  $ U(       a  U R                  $ U R                  $ )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)clsrG  rF  s      r4   
paint_pathOp.paint_path  s4     &zz!xx{{"r6   r   N).r   r   r   r   r  close_fill_strokerE  rG  	closepathclose_strokerF  rH  
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   classmethodrJ  r  r   r6   r4   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 # #r6   r-  c                   >    \ rS rSrSrSrSS jrS rS rS r	S	 r
S
rg)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().
)r   r)   pdfFiler   compressobjextraposNc                 t   Xl         X l        X0l        UR                  U l        SU l        Uc  [        5       U l        OUR                  5       U l        Ub'  U R                  R                  [        S5      US.5        U R                  R                  U R                   5        [        R                  S   (       a3  U(       d,  [        R
                  " [        R                  S   5      U l        U R                  c  [        5       U l        gU R!                  5         U R                  R#                  5       U l        g)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FlateDecode)FilterDecodeParmspdf.compression)r   r)   rp  fhr   rq  r   rr  copyupdaterM   
recordXrefr_   rcParamszlibr   _writeHeadertellrs  )r   r   r)   r   rr  pngs         r4   r   Stream.__init__  s      GG	=DJDJ?JJd=.A.13 4 	(<<)*3#//./ 1D88	DIyy~~'DHr6   c                    U R                   R                  nU" SU R                  -  5        U R                  nU R                  US'   [
        R                  S   (       a  [        S5      US'   U" [        U5      5        U" S5        g )Nr   Lengthrx  ru  rv  s   
stream
)	r   r   r   rr  r)   r_   r}  rM   r   )r   r   r   s      r4   r  Stream._writeHeader9  se    		mdgg%&zzX<<)*!-0DNgdmmr6   c                 &   U R                  5         U R                  c  U R                  R                  5       n[        U5      U l        U R                  R
                  U l        U R                  5         U R                  R                  U5        U R                  R                  S5        gU R                  R                  5       U R                  -
  nU R                  R                  S5        U R                  R                  U R                  U5        g)zFinalize stream.Ns   
endstream
endobj
)_flushr)   r   getvaluerp  ry  r  r   r  rs  writeObject)r   r   r3   s      r4   end
Stream.endD  s     	88yy))+H8}DHDIIIOOH%IIOO45YY^^%0FIIOO45LL$$TXXv6r6   c                     U R                   c  U R                  R                  U5        gU R                   R                  U5      nU R                  R                  U5        g)zWrite some data on the stream.N)rq  r   r   compress)r   data
compresseds      r4   r   Stream.writeT  sF     #IIOOD!))2248JIIOOJ'r6   c                     U R                   b=  U R                   R                  5       nU R                  R                  U5        SU l         gg)zFlush the compression object.N)rq  flushr   r   )r   r  s     r4   r  Stream._flush]  sA     '))//1JIIOOJ'#D (r6   )rq  rr  r   r   r)   rp  rs  NN)r   r   r   r   r  r   r   r  r  r   r  r  r   r6   r4   ro  ro  	  s)     PI%(N	7 ($r6   ro  c                 >   [        U SS9nSUR                  -  n0 nU GH  nUR                  U[        R                  5      n[
        R                  " UR                  S/UR                  Q5      U-  S-   R                  [        5      nUR                  5       u  pUS-  R                  [        5      n[
        R                  " U	S:H  5      u  n
U
SS S2   n[
        R                  " [        1 Uk1 U
S-
  k-  1 U
S-   k-  5      [        5      nUX   XS-
     XS-      -   S-  R                  [        5      :H  R                  SS	9   nUR                  U4S
;   a  US S 2S4==   S-  ss'   X-  S-   R                  [        5      nXS-
     XS-      -   S-  R                  [        5      X'   SR!                  [#        [$        U5      5      R'                  S5      S-   [(        R*                  " [-        X5      S S SS S/ SQS5      -   S-   XBR/                  U5      '   GM     U$ )Nr#   )hinting_factor  r   g      ?@   r      axis))DejaVuSerif-ItalicM   )r      r   s    d1
F)r7  r6  r6   r5  r1  Tr0  )r   units_per_EM
load_glyphr   NO_SCALEr   arrayhoriAdvancebboxastyper[   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d1rk   r   quadsquads_onquads_mid_onimplicits                 r4   _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#A;xx;X;EAI/.UQY.@A3H_1$%*:(;;q@HHMNSaS[   (+ 0
 
 adGqLGX]""3'!|_qA.!3VVC[ 	
 HHSb\"))'2X=%%Q
D$tR-t55
  	!!(+,A N Lr6   c                     ^  \ rS rSrSrS7U 4S jjrS r/ SQ4S jrS rS	 r	S
 r
S rS rS8S jrS rSS.S jrS rS rS rS rS rS rS rS rSrS rS rS rS rS rS r\R@                  " S 5      " \!" S! 5      5      r"S" r#S# r$S$ r%S% r&S& r'S' r(S7S( jr)S) r*S* r+S+ r,S, r-S- r.\/S9S. j5       r0S:S/ jr1S;S0 jr2S1 r3S2 r4S3 r5S4 r6S5 r7S6r8U =r9$ )<PdfFilei  zPDF file object.Nc                   > [         T	U ]  5         [        R                  " S5      U l        / SQ/U l        SU l        SU l        SU l        [        R                  " USSS9u  p4U(       d   UR                  5       U l        UnSU l        X0l        SU l        UR!                  S	5        UR!                  S
5        U R#                  S5      U l        U R#                  S5      U l        / U l        U R#                  S5      U l        U R#                  S5      U l        U R#                  S5      U l        U R#                  S5      U l        U R#                  S5      U l        U R#                  S5      U l        [7        S5      U R&                  S.nU R9                  U R$                  U5        [;        SU=(       d    0 5      U l        0 U l        S [        R                  " S5       5       U l         0 U l!        0 U l"        [F        RH                  " 5       U l%        0 U l&        S [        R                  " S5       5       U l'        0 U l(        S [        R                  " S5       5       U l)        / U l*        0 U l+        S [        R                  " S5       5       U l,        / U l-        0 U l.        S [        R                  " S5       5       U l/        0 U l0        0 U l1        / U l2        / U l3        / U l4        SRk                  5        Vs/ s H  n[7        U5      PM     nnU R*                  U R2                  U R,                  U R.                  U R0                  US.nU R9                  U R4                  U5        g! [         a    [        5       nXl         GNf = fs  snf )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`.
r#   )r   r   the zero objectFNr   wbT)return_openeds	   %PDF-1.4
s   % 
rootpagesfontszextended graphics statesztiling patternszGouraud triangleszexternal objects	resourcesCatalog)r   Pagespdfc              3   >   #    U  H  n[        S U 35      v   M     g7f)FNrM   r   r1   s     r4   r   #PdfFile.__init__.<locals>.<genexpr>       "M:LQ4!A3==:L   c              3   >   #    U  H  n[        S U 35      v   M     g7f)r   Nr  r  s     r4   r   r    s      K8J1!g8Jr  c              3   >   #    U  H  n[        S U 35      v   M     g7f)SMNr  r  s     r4   r   r    s     J7I!tbH~~7Ir  c              3   >   #    U  H  n[        S U 35      v   M     g7f)HNr  r  s     r4   r   r    r  r  c              3   >   #    U  H  n[        S U 35      v   M     g7f)INr  r  s     r4   r   r    s     E2DQ4!A3==2Dr  PDF Text ImageB ImageC ImageI)FontXObject	ExtGStatePatternShadingProcSet)6superr   r   count_object_seq	xrefTablepassed_in_file_objectoriginal_file_like	tell_baser   to_filehandler  OSErrorr   ry  currentstreamr   reserveObject
rootObjectpagesObjectpageList
fontObject_extGStateObjecthatchObjectgouraudObjectXObjectObjectresourceObjectrM   r  rm   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   filenamerf   ry  openedr  rB   procsetsr  	__class__s
            r4   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
 "__ $ 2 2"&"7"7 $ 0 0 $ 2 2 (*	 	,,i8W  3Y*2'3@ Ns   *M# 4N#N Nc                    U R                  5         XsU l        U l        U R                  S5      nU R                  S5      n[	        S5      U R
                  U R                  SSSU-  SU-  /UUS.nU R                  S5      nU R                  Xe5        U R                  R                  U5        U R                  R                  X@R                  45        U R                  UR                  U R                  S5      5        U R                  [	        S	5      [        R                   5        U R                  [	        S	5      [        R"                  5        U R                  [$        R&                  S
   [        R(                  5        / U l        g )Nzpage contentsannotationsPager   H   )r   Parent	ResourcesMediaBoxContentsAnnotspagezlength of content stream	DeviceRGBround)	endStreamr   r   r  rM   r  r  r  r  r*   r  r  beginStreamr   outputr-  r[  r\  GraphicsContextPdf
joinstylesr`  )r   r   r   contentObjectannotsObjectthePage
pageObjects          r4   newPagePdfFile.newPage   sE   "'
DK**?;))-8<!-- $ 3 3 !1b5j"v+>,) ''/
-Z(  ,0D0D!EF))++,FG	I 	D%r'>'>?D%r'A'AB&11':BNNK  "r6   r'  r   r   c                 l    [        S5      [        S5      UUS.nU R                  R                  U5        g )Nr   Text)r   r   r  r   )rM   r  r*   )r   textpositionRecttheNotes       r4   newTextnotePdfFile.newTextnote  s3    ="6l#'
 	##G,r6   c                    ^ U4S jm[        [        UR                  5       5      5      [        R                  S-   S-  -  nT" US5      nUS S S-   U-   $ )Nc                 v   > X:  a  [         R                  U    $ T" X-  U5      [         R                  X-     -   $ r>   )stringascii_uppercase)nbasetoStrs     r4   r5  ,PdfFile._get_subsetted_psname.<locals>.toStr'  s>    x--a00 !)T*V-C-CAH-MMr6   r#   r        +)r  	frozensetkeyssysmaxsize)r   ps_namecharmaphashedprefixr5  s        @r4   _get_subsetted_psnamePdfFile._get_subsetted_psname&  sU    	 i/0S[[1_4IJvr" bqzC'))r6   c           
         U R                  5         U R                  5         U R                  5         U R                  5         U R	                  5         U R                  5         U R                  5         U R                  R                  5        VVVs0 s H  u  po2U_M
     nnnnU R                  R                  5        H  nUS   XES   '   M     U R                  R                  5        H	  u  p&XdU'   M     U R                   H  u	  p'pppnX4U'   M     U R                  U R                  U5        U R                  5         U R!                  5         U R#                  5         U R                  U R$                  ['        S5      U R(                  [+        U R(                  5      S.5        U R-                  5         U R/                  5         U R1                  5         gs  snnnf )z>Write out the various deferred objects and the pdf end matter.r#   r   r  )r   KidsCountN)r  _write_annotations
writeFontswriteExtGSTates_write_soft_mask_groupswriteHatcheswriteGouraudTrianglesr  valuesr  r  ra   r  r  r  writeImageswriteMarkerswritePathCollectionTemplatesr  rM   r  r)   writeInfoDict	writeXrefwriteTrailer)r   imagerN   obxobjectstuprB  pathtransr+   cappaddingfilledstrokeds                 r4   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-"&--#&t}}#57	8 	 	+Cs   Gc                 0   U R                  5         U R                  (       a  U R                  R                  5         gU R                  b3  U R                  R                  U R                  R                  5       5        U R                  R                  5         g)z)Flush all buffers and free all resources.N)r  r  ry  r  r  r   r  closer   s    r4   ra  PdfFile.closeW  s^     	%%GGMMO&&2''--dgg.>.>.@AGGMMOr6   c                     U R                   c  U R                  R                  U5        g U R                   R                  U5        g r>   )r  ry  r   )r   r  s     r4   r   PdfFile.writeb  s2    %GGMM$$$T*r6   c           
          U R                  [        U Vs/ s H  n[        U5      PM     sn5      5        U R                  S5        g s  snf )Nr'   )r   r5   r   )r   r  rB   s      r4   r  PdfFile.outputh  s7    

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

5 4s   Ac                 F    U R                   b   e[        XXU5      U l         g r>   )r  ro  )r   r   r)   rr  r  s        r4   r  PdfFile.beginStreaml  s%    !!)))#BT#>r6   c                 b    U R                   b"  U R                   R                  5         S U l         g g r>   )r  r  r   s    r4   r  PdfFile.endStreamp  s-    )""$!%D *r6   rr  c                    U R                  UR                  S U5        U R                  R                  U5        U R	                  5         g r>   )r  r   r  r   r  )r   refr  rr  s       r4   outputStreamPdfFile.outputStreamu  s6    u-  &r6   c                 P    U R                    H  u  pU R                  X5        M     g r>   )r  r  )r   r!  r  s      r4   rG  PdfFile._write_annotationsz  s#    )-):):%L\7 *;r6   c                    [        U[        5      (       a  U/nOS[        R                  S   (       a%  [        R
                  " US[        R                  S9nO[        R
                  " U5      nSnU Hp  nU R                  R                  U5      nU(       d  UnUb  M,  [        U R                  5      nXPR                  U'   [        R                  SXT5        U(       a  Mn  UnMr     U$ )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         r4   fontNamePdfFile.fontName~  s     h$$!
I\\./$99%;3L3LI %99(CIE##E*Bz$112(*u%

3R?x!H  r6   c           	      p   U R                   R                  UR                  5      nUb  UR                  $ [        R
                  " [        R                  " S5      5      nX1R                     nUR                  c/  [        SR                  UR                  UR                  5      5      e[        U R                  5      n[        R                  SXQR                  5        [        R                   " UUUR                  UR                  UR"                  UR$                  S9U R                   UR                  '   U$ )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  r{  texnamer  r   
PsfontsMapfind_tex_filer
  r   formatpsnamer|  r  r}  r~  typesSimpleNamespaceencodingr  )r   r  dvi_infotex_font_mappsfontr  s         r4   dviFontNamePdfFile.dviFontName  s     ##''8###))'*?*?*MNoo.??"5w79 9
 t../

17OOL,1,A,A__]]NN-$) r6   c                    0 n[        U R                  R                  5       5       H:  u  p#UR                  n[        R                  SU5        U R                  U5      X'   M<     [        U R                  5       H  nU R                  U   n[        R                  SU5        UR                  S5      (       a*  [        R                  S5        U R                  U5      X'   Mh  [        R                  S5        U R                  R                  R                  U5      nU(       d  M  U R                  XV5      X'   M     U R                  U R                  U5        g )Nz"Embedding Type-1 font %s from dvi.zEmbedding font %s.z.afmzWriting AFM font.zWriting TrueType font.)r  r  ra   r  r}  r~  _embedTeXFontr  endswith_write_afm_fontr  usedr{  embedTTFr  r  )r   r  dvinameri   r  r
  charss          r4   rH  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 / 	%0r6   c                 "   [        US5       n[        U5      nS S S 5        WR                  5       n[        S5      [        S5      [        U5      [        S5      S.nU R	                  S5      nU R                  Xe5        U$ ! , (       d  f       Nm= f)Nrbr  Type1WinAnsiEncoding)r   r   BaseFontEncodingfont dictionary)openr   get_fontnamerM   r  r  )r   r
  ry  r  fontnamefontdictfontdictObjects          r4   r  PdfFile._write_afm_font  s    (D!Rr7D "$$& L#G} $X $%6 79 ++,=>2 "!s   B  
Bc                    [         R                  SUR                  R                  UR                  5        U R                  S5      nU R                  X!R                  R                  5        U R                  S5      n[        S5      [        S5      S[        UR                  R                  5      S-
  US.nUR                  b@  [        S	5      S/[        [        [        R                  " UR                  5      5      QS
.US	'   UR                  cK  [         R                  SUR                   5        [        UR                   5      US'   U R                  X45        U$ ["        R$                  " UR                  5      nUR&                  (       a  UR)                  UR&                  5      n[        UR*                  S   5      US'   UR&                  R-                  SS5      UR&                  R-                  SS5      4nU R.                  R-                  UR                  U45      nUc5  U R1                  XQR                  5      nXpR.                  UR                  U4'   XtS'   U R                  X45        U$ )Nz#Embedding TeX font %s - fontinfo=%sfont widthsr  r  r  r   r#   )r   r   	FirstCharLastCharWidthsr  r   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)r}  r~  r  r  __dict__r  r  widthsrM   r)   r  r  r   
_parse_encr  warningr  r   	Type1Fontr  	transformpropr{  r  createType1Descriptor)r   fontinfowidthsObjectr  r  t1fontr  fontdescs           r4   r  PdfFile._embedTeXFont  s5   

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r6   c                 r   U R                  S5      nU R                  S5      nUR                  S   nUR                  S   nSnU(       a  US-  n  US-  nU(       a  US	-  n   [        U5      n[        S
5      [        UR                  S   5      UUR                  UUR
                  UR                  SSUUR                  S   SS.n	U R                  X95        U R                  USR                  UR                  S S 5      [        UR                  S   5      [        UR                  S   5      SS.S9  U$ )Nfont descriptorz	font fileItalicAngleisFixedPitchr   r#   r     r  r  r  r  i  
FamilyName2   )r   r  FlagsFontBBoxr  AscentDescent	CapHeightXHeightFontFile
FontFamilyStemVr6   )Length1Length2Length3rk  )r  r  r   rM   r  ascender	descenderr  rn  r+   partsr)   )
r   r  r  fontdescObjectfontfileObjectitalic_anglefixed_pitchflagsft2font
descriptors
             r4   r  PdfFile.createType1Descriptor  sO    ++,=>++K8{{=1kk.1VOE VOE
 VOE   8$   01J 78 "<<'"++",,)!;;|4
" 	4.#((6<<3C*D,/Q,@,/Q,@,-!/ 	 	0
 r6   c                     U R                  U5      nSR                  UR                  R                  5       [        R
                  R                  [        R
                  R                  U5      5      S   U/5      $ )N-r   )r  r+   rN   r   rX   rX  splitextbasename)r   r
  
glyph_namer  s       r4   _get_xobject_glyph_namePdfFile._get_xobject_glyph_nameU  s]    ]]8$xxGGNNGGRWW--h78;  	r6   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                 v  ^ ^^^^ [        T5      n[        R                  S   mUR                  S4S jmUUUU 4S jnUUUUU 4S jnT R	                  UR
                  UR                  5       5      mTR                  SS5      m[        T5      mUR                  S5      =(       d    S	S	S
.nUR                  S5      =(       d    SS0nUR                  nUR                  n	S	n
Sn[        R                  U;   a  U
S-  n
 U(       a  U
S-  n
OU
S-  n
[        R                  U	;   a  U
S-  n
   [        S5      TU
UR                    Vs/ s H
  nT" USS9PM     snT" UR"                  SS9T" UR$                  SS9T" US   SS9T" US   5      US   S   S	S.
nTS:X  a	  U" X2U5      $ TS:X  a	  U" X2U5      $ gs  snf )z9Embed the TTF font from the named file into the document.pdf.fonttypeTc                     X-  S-  nU(       a  [        U5      $ US:  a  [        R                  " U5      $ [        R                  " U5      $ )z2Convert font coordinates to PDF glyph coordinates.r  r   )r  r{   floorceil)r3   upenearestrB  s       r4   cvtPdfFile.embedTTF.<locals>.cvtw  s@    L4'EU|#qyzz%((yy''r6   c                   >^ ^ T#R                  S5      nT#R                  S5      nT#R                  S5      nT#R                  S5      n/ nSu  pT R                   V
s/ s H
  n
T " U
SS9PM     nn
[        S5      T"UU	U[        S	5      US
   U/ SQU[        S5      US.US.nSSKJm  UU U 4S jn[
        R                  " 5          [
        R                  " S5        [        XS-   5       Vs/ s H  nU" U5      PM     nnSSS5        [        W5      US'   / n/ n[        5       nU Hd  nUnT R                  U5      nUR                  U5        T R                  U5      nUS::  a  UR                  UU45        MS  UR                  U5        Mf     UR                  5         SnU H<  u  nnUUS-   :w  a  UR                  U5        UR                  [        U5      5        UnM>     [!        T!U5      n0 n[#        U5       H  nUU   n0 nUU;   a/  [        S5      [        S5      US.nUUR%                  S5      S-   S nT#R                  S5      nT#R'                  UUUS9  UU;   a#  T#R)                  T!U5      nUT#R*                  U'   M  UUU'   M     T#R-                  X\5        T#R-                  XB5        T#R-                  X?5        T#R-                  UU5        U$ s  sn
f s  snf ! , (       d  f       GN= f)z5The Type 3-specific part of embedding a Truetype fontr  r  r  zcharacter procs)r   r   Fr  r  Type3r  )MbP?r   r   r  r   r   r  r  )r   r  r  r  r  r   rM   r  
FontMatrix	CharProcsr  r  r   )cp1252c                    > [        TR                  U    5      nTR                  U[        R                  [        R
                  -  S9R                  nT" U5      $ )Nr  )r"  decoding_table	load_charr   r  
NO_HINTINGr  )charcoder2   r   r  r  r  s      r4   get_char_width?PdfFile.embedTTF.<locals>.embedTTFType3.<locals>.get_char_width  sT    --h78Y//)2F2FF ' HHS 5z!r6   ignorer#   NMaxWidthr   r  Formr   r   BBox   d1r  charProcrk  )r  r  rM   	encodingsr  warningscatch_warningsfilterwarningsr!  r   rd   get_char_indexr*   r  addsortr  r  findrn  r  r  r  )$r  
charactersr  r  r  r  charprocsObjectdifferencesArray	firstcharlastcharrB   r  r  r  r  r  r  differencesmulti_byte_charsr   ccodegindr  last_crN   rawcharprocs	charprocscharnamestreamcharprocDictcharprocObjectr  r  r
  r>  r   s$   `                              @r4   embedTTFType3'PdfFile.embedTTF.<locals>.embedTTFType3  s   --m<L!//0ABN!//0ABN"001BCO!"(I3799=9aC5)9D= V#&$"0=":. 6, ,#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/! //,0O/3F|,0$2L $FKK$6$:$;<F!%!3!3J!?!!.&!M //77(KD6DD--d3*8Ih'3 18 ^6^8\2_i8!!A >@H +*s$   K'K+K=KK
K-c                 
  > T-R                  S5      nT-R                  S5      nT-R                  S5      nT-R                  S5      nT-R                  S5      nT-R                  S5      nT-R                  S5      n	SR                  S	 U 5       5      n
[        R                  S
T*U
5        [        R
                  " T*U
5       n[        R                  " U5      nSSS5        [        R                  ST*[        R                  " T*5      R                  WR                  5       R                  5        U n[        U5      n [        S5      [        S5      T,SSSS.UUUS.n[        S5      [        S5      T,[        S5      U/U	S.nXrS'   T-R                  X|R                  5       SUR                  5       R                  0S9  S/S-  n/ nSnU H  nUnU R!                  U5      nU R#                  U[$        R&                  [$        R(                  -  S9nUR+                  UT)" UR,                  5      45        US:  a  [/        U5      UU'   [1        UU5      nM     UR3                  5         USUS-    nSn/ nSn/ nU Hp  u  nnUUS-   :w  a7  UR+                  U5        UR+                  U/5        UR+                  UU/5        OUS   R+                  U5        UUS   S'   [1        UU5      nUnMr     / nU HT  u  nnUS :  a  M  [5        S U5      nUR+                  S!UUS"R                  S# [7        UUS-   5       5       5      4-  5        MV     T-R8                  [;        U5      S$R                  U5      4-  n/ n U H8  n[=        T+U5      (       a  M  UR!                  U5      nU R+                  U5        M:     UR>                   V!s/ s H
  n!T)" U!S%S&9PM     n"n![A        T*U 5      n#[C        U#5       Hz  n$U#U$   n%[        S'5      [        S(5      U"S).n&U%U%RE                  S*5      S+-   S n%T-R                  S,5      n'T-R                  U'U%U&S9  T-RG                  T*U$5      n(U'T-RH                  U('   M|     SR                  U5      RK                  S-5      nT-R                  UU5        T-R                  U	U5        UUS.'   T-RM                  XN5        T-RM                  X_5        T-RM                  X25        T-RM                  UU5        U$ ! , (       d  f       GN$= fs  sn!f )/z6The 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   #    U  H  n[        U5      v   M     g 7fr>   )chrr#  s     r4   r   ;PdfFile.embedTTF.<locals>.embedTTFType42.<locals>.<genexpr>  s      <AQs   zSUBSET %s characters: %sNzSUBSET %s %d -> %dr  CIDFontType2AdobeIdentityr   )RegistryOrdering
Supplement)r   r   r  CIDSystemInfor  WCIDToGIDMapType0z
Identity-H)r   r   r  r  DescendantFonts	ToUnicode	FontFile2r  rk   i   r   r#   r	  r  r   s   <%04x> <%04x> [%s]r&   c              3   ,   #    U  H
  nS U-  v   M     g7f)s   <%04x>Nr   )r   rB   s     r4   r   r-  M  s     J6Iy1}6Is   r'   Fr  r  r
  r  r  r  r  utf-16ber  )'r  r+   r}  r~  r$   get_glyphs_subsetfont_as_filerX   statst_size	getbuffernbytesr   rM   rn  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  rB   r  r!  r#  r$  r%  r&  rN   r  r
  r   r>  r   s.                                            r4   embedTTFType42(PdfFile.embedTTF.<locals>.embedTTFType42  s    !//0ABN $ 2 23H I"&"4"45M"N $ 2 23G H!//0BCN((9G!%!3!3O!D < <<JJJ18ZH 228ZHF*77? IJJ$h!))8+=+=+?+F+F I
 8$D V/# ' *"#"% #10K V=# .$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+/<(, .  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@ Cs   ?S3;T3
Tr   r]   pcltr   )	capHeightxHeightpostitalicAngler   r   Fr#   r      r  r  r  r\  r]  )
r   r  r  r  r  r  r  r  r  r  r   r   N)r   r_   r}  r  rB  r  get_charmapr   rM   get_sfnt_table
face_flagsstyle_flagsr   FIXED_WIDTHr   ITALICr  r  r  )r   r
  r  r  r'  rY  r[  r^  ffsfr  symbolicrB   r  r  r   r>  s   ``            @@@r4   r  PdfFile.embedTTFq  s    !<</ --t 		(h	" h	"TO	' O	'f ,,  
 ..)4w-""6*LA!.L""6*E}f.E__  B&VOEVOEVOE"VOE )*8<		B	1Q.	B$--74>>59T+.>4	?+.q1
 q= :>>^!$J??  Cs   F6
c                     U R                   R                  US5      nUb  US   $ [        U R                  5      nU[	        S5      US   US   S.4U R                   U'   U$ )z?Return name of an ExtGState that sets alpha to the given value.Nr   r  r#   )r   CAca)r  r{  r|  r  rM   )r   alphastaterN   s       r4   
alphaStatePdfFile.alphaState  ss       $$UD18OD))*D-(%(4 5 	 r6   c                    U R                   R                  US5      nUb  US   $ [        U R                  5      nU R	                  S5      nU[        S5      S[        S5      [        S5      S/US	.S
.4U R                   U'   U R                  R                  U[        S5      [        S5      S[        S5      [        S5      S./ SQSSU00/ SQS.[        S5      [        R                  /45        U$ )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
Nr   z transparency group for soft maskr  FMask
Luminosityr#   )r   r   BCG)r   AISSMaskr  r
  Transparency
DeviceGray)r   CS)r#   r   r   r#   r   r   r  r   )r   r   r#   r#   )r   r   FormTypeGroupMatrixr  r  )
r  r{  r|  r  r  rM   r  r*   r-  rl  )r   smaskrp  rN   groupObs        r4   _soft_mask_statePdfFile._soft_mask_state  s    &&**5$78OD''($$%GH[) Ll+# 		)
u% 	%%Y<n-|, -'#u6$ #Y

#'
 	  r6   c                     U R                  U R                  [        / U R                  R	                  5       QU R
                  R	                  5       Q5      5        g r>   )r  r  r   r  rM  r  r   s    r4   rI  PdfFile.writeExtGSTates  sT    !! !!((*''..0 	
r6   c                     U R                    HB  u  pnU R                  UR                  S U5        U R                  " U6   U R	                  5         MD     g r>   )r  r  r   r  r  )r   rU  
attributescontents       r4   rJ  PdfFile._write_soft_mask_groups  sC    '+'='=#BGRUUD*5KK!NN (>r6   c                     Uu  p#pEUb  [        U5      nUb  [        U5      nX#XE4nU R                  R                  US 5      nUb  U$ [        U R                  5      nXpR                  U'   U$ r>   )r   r  r{  r|  r   )r   hatch_styleedgefacehatchlwpatternrN   s           r4   hatchPatternPdfFile.hatchPattern  sz     +E;D;D5-&&**;=ND++,,0[)r6   3.10c                     U R                   R                  5        VVVVVs0 s H  u  nu  p#pEXX44_M     snnnnn$ s  snnnnnf r>   )r  ra   )r   rj   r   r   hls         r4   <lambda>PdfFile.<lambda>  s?    ,0,@,@,F,F,HC,HLQ1q9,HC Cs   <c                    [        5       nSnU R                  R                  5        GH  u  p4U R                  S5      nXQU'   SSR	                  5        Vs/ s H  n[        U5      PM     sn0nU R                  UR                  S [        S5      SSSSSX"/X"USSSSSU R                  S-  /S	.	5        Uu  ppU R                  US   US   US
   [        R                  5        U	bL  U R                  U	S   U	S   U	S
   [        R                  SSX"[        R                  [        R                  5
        U R                  U[        R                  5        U R                  " U R!                  ["        R$                  " U
5      ['        5       R)                  U5      SS96   U R                  [        R*                  5        U R-                  5         GM     U R/                  U R0                  U5        g s  snf )N      R@zhatch patternProcsetsr  r  r#   r   r  )	r   PatternType	PaintType
TilingTyper  XStepYStepr  r  r  Fsimplify)r   r  ra   r  r	  rM   r  r   r   r  r-  rY  rZ  rR  rG  rj  pathOperationsr    r  r   scalerE  r  r  r  )r   	hatchDictsidelenr  rN   rU  rB   res
stroke_rgbfill_rgbr  r  s               r4   rK  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!!q!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   G,c                     [        S[        U R                  5      -  5      nU R                  SU 35      nU R                  R	                  X4X45        X44$ )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 )rM   r)   r  r  r*   )r   pointscolorsrN   rU  s        r4   addGouraudTrianglesPdfFile.addGouraudTriangles:  sV    $ FS!6!6778"3D6 :;$$d%?@xr6   c                 B   [        5       nU R                   GHh  u  p#pEX1U'   UR                  nUR                  US   US   -  S45      nUR                  S   nUS;   d   eUR                  US   US   -  U45      n	US:X  a  Sn[        R
                  " USS9S-
  n
[        R                  " USS9S-   nS	X-
  -  nU R                  UR                  S SS
SS[        US:X  a  SOS5      SU
S   US   U
S   US   /SS/U-  -   S.5        [        R                  " US   US   -  4SSSSU44/S9nSUS'   Xz-
  U-  US'   U	S S 2S U24   S-  US'   U R                  UR                  5       5        U R                  5         GMk     U R                  U R                  U5        g )Nr   r#   r  r#   r  r  r   r  r  l    ra     r  r{  F)ShadingTypeBitsPerCoordinateBitsPerComponentBitsPerFlag
ColorSpace	AntiAliasDecode)r  u1)r  z>u4)r  r  r  dtyper  r  g     o@)r   r  shapereshaper   r   r   r  r   rM   emptyr   tobytesr  r  r  )r   gouraudDictrN   rU  r  r  r  flat_pointscolordimflat_colors
points_min
points_maxfactor	streamarrs                 r4   rL  PdfFile.writeGouraudTrianglesQ  s   f(,(=(=$Df "LLE ..%(U1X*=q)ABK||AHv%%% ..%(U1X*=x)HIK1}!4?J!4?J:#:;Ft !&(%& !#$,M[|  $']JqM']JqM; !fx/0 qE!H$&&. $467I
 "#Ig#.#;v"EIh"-a(l";e"CIhJJy((*+NNO )>P 	++[9r6   c                     U R                   R                  [        U5      S5      nUb  US   $ [        U R                  5      nU R                  SU 35      nXU4U R                   [        U5      '   U$ )z=Return name of an image XObject representing the given image.Nr#   zimage )r  r{  r   r|  r  r  )r   rT  entryrN   rU  s        r4   imageObjectPdfFile.imageObject}  sm       ED18ODOO$&0#("3RYr6   c                 F   USSS2   nUR                   S:X  a  US4$ USS2SS2SS24   n[        R                  " USS9nUR                  S   S:X  aK  USS2SS2S4   S   n[        R                  " US	:H  5      (       a  SnX#4$ [        R                  " USS9n X#4$ SnX#4$ )
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.
Nr  r  r   C)orderr  ).Nr   )ndimr   r  r  r  )r   imrgbro  s       r4   _unpackPdfFile._unpack  s     "X77a<t8OQ2A2X,C((3c*Cxx{a1a7I.66%3,'' E
 : HHU#6E : :r6   c                    [        5       nUR                  USS9  UR                  S5        SnS=pE [        R                  " SUR                  S5      5      u  pgUS;   aT  UR                  U5      n[        U5      U:w  a  [        S5      eUS	:X  a  [        US   5      nO-US
:X  a  UnO$US:X  a  X8-  nOUS:X  a  O&UR                  US5        UR                  SS5        M  X4U4$ )zV
Write the image *img* into the pdf file using png
predictors with Flate compression.
r  )r  r  r6   Ns   !L4s)   IHDR   PLTE   IDATztruncated datar  r  r  s   IENDr#   r  )	r   saveseekstructunpackreadr)   RuntimeErrorr[   )	r   imgbufferpng_data	bit_depthpaletter3   r   r  s	            r4   	_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++r6   c           	      \   UR                   u  pEn[        S5      [        S5      UU[        SSS.U   5      SS.nU(       a  X7S'   [        R                  S	   (       GaI  UR                   S
   S:X  a  UR	                  S
S9nSXeS.n[
        R                  " U5      n	U	R                  SS9n
US:X  Ga  U
Gb  [        U
5      n[        R                  " U
 VVVs/ s H  u  pU  H  oPM     M     snnn[        R                  S9nUSSS2   R                  [        R                  5      S-  USSS2   R                  [        R                  5      S-  -  USSS2   -  nUSS2SS2S4   R                  [        R                  5      S-  USS2SS2S4   R                  [        R                  5      S-  -  USS2SS2S4   -  n[        R                  " U5      R                  [        R                  5      nU[        R                  " UUUS9   n[
        R                  " USS9n	U	R!                  U5        U R#                  U	5      u  nnnUb  Uc  [%        S5      eUSUS-   n[        S5      [        S5      US-
  U/US'   UUS'   SUS'   UUS'   OU R#                  U	5      u  n  nOSnU R'                  UU R)                  S5      UUS 9  U(       a  U R*                  R-                  W5        O)U R*                  R-                  UR/                  5       5        U R1                  5         gs  snnnf )!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  r#   r   r  )r   r   WidthHeightr  r  ry  rx  r  r#   r  
   )	PredictorColorsColumnsr  )	maxcolorsr   Nr  r      r  )sorterP)modezinvalid PNG headerIndexedr  r  r  zlength of image stream)r  )r  rM   r_   r}  squeezer   	fromarray	getcolorsr)   r   r  uint8r  uint32argsortsearchsorted
putpaletter  r  r  r  r  r   r  r  )r   r  r   r  r   r   color_channelsr   r  r  
img_colors
num_colors_colorcompr  	palette24rgb24indicesrgb8r  r  s                         r4   	_writeImgPdfFile._writeImg  s    )-

%~Iw-!l{"CN"ST#$&  L<<)**zz"~"|||, "nOC//$'C5J"z'= !_
((#VXQPUDPUD#V)+3%addm22299=C%addm22299=BD$QTT]+	 q!Qw-..ryy9R?q!Qw-..ryy9Q>@aAg' **Y/66rxx@ry%PQood5w'/3~~c/B,)W$&';<<!/:>2%))_d;6G%/!^W%>L!*3&' !H*3&'!%!4!QC78	 	 	 $$X.$$T\\^4G $Ws   L'c                    U R                   R                  5        Hg  u  pnU R                  U5      u  pEUb-  U R                  S5      nU R	                  XVR
                  5        OS nU R	                  XCR
                  U5        Mi     g )Nr  )r  rM  r  r  r  r   )r   r  rN   rU  r  adatasmaskObjects          r4   rN  PdfFile.writeImages  sj    !\\002MCr,,s+KD "009unn5"NN44 3r6   c                    U R                  XSS9n[        U5      [        U5      [        U5      Xg4n	U R                  R	                  U	5      n
U
cl  [        S[        U R                  5      -  5      nU R                  S[        U R                  5      -  5      nUR                  U5      nXX/U R                  U	'   U$ U
S   U:  a  XZS'   U
S   nU$ )z<Return name of a marker XObject representing the given path.Fr  zM%dz	marker %dr  r   )	r  r   r   r  r{  rM   r)   r  get_extents)r   rX  rY  rG  rF  r  	joinstylecapstylepathopskeyr0   rN   rU  r  s                 r4   markerObjectPdfFile.markerObject  s     %%dE%BW~tDz4<M!!#&>DLL 112D##K#dll2C$CDB##E*D!%4 4DLL
  bzBr
!9Dr6   c           
      \   U R                   R                  5        GH  u  u  pp4nu  pgpUR                  U	S-  5      nU R                  UR                  S [        S5      [        S5      [        UR                  5      S.5        U R                  [        R                  U   [        R                  5        U R                  [        R                  U   [        R                  5        U R                  " U6   U R                  [        R                  X#5      5        U R!                  5         GM     g )N   r  r
  r  )r  ra   paddedr  r   rM   r   extentsr  r  r  r-  r`  	capstylesra  rJ  r  )
r   r  rG  rF  r  r  rN   rU  r  r  s
             r4   rO  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% ';r6   c                    [        S[        U R                  5      -  5      nU R                  S[        U R                  5      -  5      nU R                  R	                  XrX8UR                  5       UR                  5       XEU4	5        U$ )NzP%dzpath %d)rM   r)   r  r  r*   get_joinstyleget_capstyle)	r   r   rX  rY  r[  r\  r]  rN   rU  s	            r4   pathCollectionObjectPdfFile.pathCollectionObject9  sr    EC

O+,	C

O ;<

B$4$4$68Ig'	( r6   c           
         U R                    GHg  u	  pp4pVpxn	U R                  X#SS9n
UR                  U5      n[        R                  " [        R
                  " UR                  5      5      (       d  / SQnO&UR                  U5      n[        UR                  5      nU R                  UR                  S [        S5      [        S5      US.5        U R                  [        R                  U   [        R                   5        U R                  [        R"                  U   [        R$                  5        U R                  " U
6   U R                  [        R'                  X5      5        U R)                  5         GMj     g )NFr  r   r   r   r   r  r
  r  )r  r  r  r   r  r   r  r  r   r  r   rM   r  r  r  r-  r`  r  ra  rJ  r  )r   rN   rX  rY  rU  r  r  r[  r\  r]  r  r  r  s                r4   rP  $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# $r6   c                    [        [        R                  " XX#US[        R                  R
                  [        R                  R
                  S[        R                  R
                  [        R                  R
                  /S5      5      /$ )Nr8  r6   T)	r%  r"   r  r-  rT  rB  rS  rQ  rM  )rX  r  rk  r  sketchs        r4   r  PdfFile.pathOperationsV  sc    00TVYY__biioosBJJ4D4D\\!   	r6   c                     U(       a-  SSU R                   S-  U R                  S-  4nUR                  nOS nSnU R                  XX5US9nU R                  " U6   g )Nr  r  F)r  r$  )r   r   should_simplifyr  r  )r   rX  r  rk  r$  r  cmdss          r4   	writePathPdfFile.writePath_  sa    djj2ot{{R/?@D++HDH""4D*0 # 2Tr6   c                 ~    [        U R                  5      nU R                  R                  SSU/5        [	        U5      $ )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.
Nr   )r|  r  r  r*   r   )r   rN   r   s      r4   r  PdfFile.reserveObjectj  s6     $""#tQo.}r6   c                 r    U R                   R                  5       U R                  -
  U R                  U   S'   g Nr   )ry  r  r  r  r   s     r4   r|  PdfFile.recordXrefu  s(     $ ?r1r6   c                 \    U R                  UR                  5        UR                  X 5        g r>   )r|  r   r   )r   objectr   s      r4   r  PdfFile.writeObjectx  s    		"X$r6   c                 V   U R                   R                  5       U R                  -
  U l        U R	                  S[        U R                  5      -  5        [        U R                  5       H=  u  nu  p#nUc  [        SX4-  5      eUS:X  a  SOSnSX#U4-  nU R	                  U5        M?     g)zWrite out the xref table.s
   xref
0 %d
NzNo offset for object %d (%s)r  r0  r4  s   %010d %05d %b 
)	ry  r  r  	startxrefr   r)   r  r(   AssertionError)r   r1   offset
generationrN   r  r*  s          r4   rR  PdfFile.writeXref|  s    $..8

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

4  .Gr6   c                 |    U R                  S5      U l        U R                  U R                  U R                  5        g)z8Write out the info dictionary, checking it for good formri   N)r  
infoObjectr  r  r   s    r4   rQ  PdfFile.writeInfoDict  s.     ,,V4$--8r6   c                     U R                  S5        U R                  [        [        U R                  5      U R                  U R
                  S.5      5        U R                  SU R                  -  5        g)zWrite out the PDF trailer.s   trailer
)SizeRootInfos   
startxref
%d
%%%%EOF
N)r   r   r)   r  r  r:  r4  r   s    r4   rS  PdfFile.writeTrailer  sZ     	

< 

7(____&' 	(
 	

04>>ABr6   ))r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  ry  r  r  r  r  r  r   r  r:  r  r  r  r  r  r  r  r  r  r  r4  r  r  r   r  r>   r  )NNNFN)r*  ):r   r   r   r   r  r   r$  r-  rB  r^  ra  r   r  r  r  rn  rG  r  r  rH  r  r  r  r  rD  r  rq  r  rI  rJ  r  r	   
deprecatedpropertyhatchPatternsrK  r  rL  r  r  r  r  rN  r  rO  r  rP  staticmethodr  r)  r  r|  r  rR  rQ  rS  r  __classcell__r  s   @r4   r  r    s>   g9R": .@ -* B	+?&
 04 
8><1*
8t=~*|@|	2h
" OOF+H 6 - M$6L.*:X
.,:=~5:,*  		@%!9	C 	Cr6   r  c                      ^  \ rS rSr\R
                  " S5      rSrU 4S jrS r	SS jr
S rSS	 jrSS
 jrS r SS jrS rSS jrS rSS.S jrS rSS jrS rS rSrU =r$ )ry  i  zfonts/pdfcorefontsrs  c                 f   > [         TU ]  XC5        Xl        U R                  5       U l        X l        g r>   )r  r   r   new_gcr   	image_dpi)r   r   rK  r   r   r  s        r4   r   RendererPdf.__init__  s'    '	++-"r6   c                 f    U R                   R                  " U R                  R                  5       6   g r>   )r   r  r   r^  r   s    r4   r^  RendererPdf.finalize  s!    		$''**,-r6   Nc                    [        USS5      nX!l        [        USS5      nUR                  5       c  UR                  SSS9  UR                  (       a  UR
                  UR
                  4Ul        OBUb  [        U5      S:  a  UR                  S	   S
4Ul        OUR                  S	   US	   4Ul        U R                  R                  U5      nU(       a  U R                  R                  " U6   X1l        XAl        g )N
_fillcolorr  r  r  _effective_alphasr  r  r!  T)isRGBAr  r   r  )getattrrP  get_rgbset_foreground_forced_alpha_alpharR  r)   _rgbr   deltar   r  )r   r   	fillcolor	orig_fillorig_alphasr[  s         r4   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$ "*r6   c                      U R                   S-  $ )Nr  )rK  r   s    r4   get_image_magnification#RendererPdf.get_image_magnification  s    ~~d""r6   c                    UR                   S S u  pgUS:X  d  US:X  a  g Uc  UR                  S5        U R                  U5        SU-  U R                  -  nSU-  U R                  -  nU R                  R                  U5      nUc]  U R                  R                  [        R                  USSXbU[        R                  U[        R                  [        R                  5        g UR                  5       R                  5       u  pppU R                  R                  [        R                  SSSSX#[        R                  XXX[        R                  U[        R                  [        R                  5        g )Nr  r   r  r  r#   )r  	set_alphar_  rK  r   r  r  r-  rc  rU  rV  rd  frozen	to_values)r   r   rB   r   r  r  r  rS  imobtr1tr2tr3tr4tr5tr6s                  r4   
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;;@r6   c                    U R                  X5        U R                  R                  X#US L =(       a    UR                  5       S L UR	                  5       5        U R                  R                  U R                  R                  5       5        g r>   )r_  r   r)  get_hatch_pathget_sketch_paramsr  r   paint)r   r   rX  r  rgbFaces        r4   	draw_pathRendererPdf.draw_path  sg    b"		tO; 1 1 3t ;  "	$ 			)r6   c                 b   Sn[         R                  " U5      n[         R                  " U5      n[        U5      (       d  SnUR                  5       (       + nO3[         R                  " US S 2S4   US   :H  5      (       a	  US   S:g  nOSn[        U5      (       d  SnOh[         R                  " [         R                  " U	5      S:H  5      (       a  SnO3[         R                  " US S 2S4   US   :H  5      (       a	  US   S:g  nOSn[        U5      S:  a  [        US   R
                  5      OSnU R                  X4XWU5      nUU-   S-   UU-  :  nU(       a  U(       d  [        R                  " XX#UXVXxXXU5      $ [         R                  " U	5      n/ n[        U R                  X#U5      5       H:  u  nu  nnU R                  R                  UUUUWW5      nUR                  U5        M<     U R                  R                  nU" U R                   R#                  5       6   Su  nnU R%                  UUXVXxXXU5       HU  u  nnnn n!U R'                  U U!5        UU-
  UU-
  n#n"U" S	SSS	U"U#[(        R*                  U[(        R,                  5	        UUnnMW     U" U R                   R/                  5       6   g )
NTFr   )r   r   r  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_collectionr_  r-  rU  rV  pop)$r   r   master_transformr  all_transformsoffsetsoffset_trans
facecolors
edgecolors
linewidths
linestylesantialiasedsurlsoffset_positioncan_do_optimizationr\  r]  len_pathuses_per_pathshould_do_optimizationr[  
path_codesr1   rX  r  rN   r  lastxlastyxoyopath_idgc0ru  dxdys$                                       r4   r|   RendererPdf.draw_path_collection  s    #ZZ
+
ZZ
+
:F&(lln"4vvjA&*T*::;;#D)S0&+#:Gvvbjj,344
1a4(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 	r6   c                    [        U5      n[        U5      nXx-  Xx-   S-   :  a  [        R                  " XX#XEU5        g U R                  X5        UR	                  U5      n	UR                  5       n
U R                  R                  nU R                  R                  X#XU R                  R                  UR                  5       UR                  5       5      nU" [        R                  5        Su  pUR                  USSU R                  R                   S-  U R                  R"                  S-  4SS9 H  u  nn[        U5      (       d  M  USS  u  nnSUs=::  a  U R                  R                   S-  ::  a)  O  O&SUs=::  a  U R                  R"                  S-  ::  d  O  Mo  UU-
  UU-
  nnU" SSSSUU[        R$                  U[        R&                  5	        UUpM     U" [        R(                  5        g )	Nr  r`  r   r  F)rk  r  r	  r#   )r)   r   draw_markersr_  rG  rF  r   r  r  r   
_linewidthr  r  r-  rc  iter_segmentsr   r   rU  rV  rd  )r   r   marker_pathmarker_transrX  rY  ru  len_marker_pathusesrG  rF  r  markerr  r  r   coderB   r   r  r  s                        r4   r  RendererPdf.draw_markers4  s   
 k*4y!O$:Q$>>%%d&*7<b"www!!''tTWW5G5G 13 	rxx"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{{r6   c                    [        U5      [        U5      :X  d   e[        U5      S:X  a  g UR                  S:X  d   eUR                  S   S:X  d   eUR                  S   S:X  d   eUR                  S:X  d   eUR                  S   S:X  d   eUR                  S   S;   d   eUR                  nUR                  US   US   -  S45      nUR	                  U5      nUR                  U5      nU R
                  R                  Xc5      u  pxU R
                  R                  n	UR                  S   S:X  a:  UR                  S5        U R                  U5        U	" U[        R                  5        g US   n
[        R                  " XS S 2S S 2S4   5      (       a:  UR                  U
5        U R                  U5        U	" U[        R                  5        g US S 2S S 2S4   S S 2S S 2S 4   n
U R
                  R                  Xj5      u  pU R
                  R                  U5      nU	" [        R                  U[        R                   U[        R                  [        R"                  5        g )Nr   r   r#   r  r  r  )r   r   r   )r)   r  r  r  r  r   r  r  re  r_  r-  rl  r   allcloser  rc  rb  rd  )r   r   r  r  rY  r  tpointsrN   r   r  ro  smask_obgstates                r4   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;;uQ1Wo..LLMM"4$ 1a7OAq$J/E))77GKAYY//9F288VR\\;; r6   c           	         X6s=:X  a  S:X  a3  O  O0U R                   R                  X-
  X%-
  [        R                  5        g [        R
                  " U5      nU R                   R                  [        R                  " U5      [        R                  " U5      [        R                  " U5      * [        R                  " U5      X[        R                  5        U R                   R                  SS[        R                  5        g r.  )	r   r  r-  re  r{   r|   r~   r}   rg  )r   rB   r   r   oldxoldyoldangles          r4   _setup_textposRendererPdf._setup_textpos  s    !!IIQXqx<LL'EIITXXe_dhhuo"hhuo-txx2==2 IIQ2::.r6   c                 *   U R                   R                  R                  USU5      u  pxpnUR                  5       b6  U R                  R
                  S   S   R                  [        XX7X5      5        [        R                  S   n[        R                  " U5      nU R                  R                  [        R                  5        U R                  R                  [        R                  " U5      [        R                   " U5      [        R                   " U5      * [        R                  " U5      X#[        R"                  5        U R%                  XR&                  5        SnSu  nn/ nU R                  R                  [        R(                  5        U
 GH  u  nnnnnU R                  R*                  R-                  UU5        UR.                  n[1        UU5      (       d  UR                  UUUUU45        Me  U R3                  UUSUU5        UUnnUU4U:w  aH  U R                  R                  U R                  R5                  U5      U[        R6                  5        UU4nU R                  R                  U R9                  [;        U5      U5      [        R<                  5        GM     U R                  R                  [        R>                  5        U H-  u  nnnnnU RA                  UUURC                  U5      UU5        M/     U H`  u  nnpxU R                  R                  [        R                  UUXx[        RD                  [        RF                  [        RH                  5        Mb     U R                  R                  [        RH                  5        g )Nr  r  r#   r  r  r`  r   )%
_text2pathmathtext_parserparser   r   r  r*   r   r_   r}  r{   r|   r  r-  rc  r~   r}   rU  r_  rZ  rO  r  track_glyphr  r   r  r  rf  encode_stringr,  rh  rP  _draw_xobject_glyphr  rR  rG  rd  )r   r   rB   r   r2   r  r   r   r   descentglyphsrectsr   r   	prev_fontr  r  unsupported_charsr  fontsizenumoxoyr  s                           r4   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 &+
 			%r6   )mtextc          
         U R                  5       nUR                  5       n	UR                  XI5      n
[        R                  " U
S5       nUu  nS S S 5        UR                  5       bL  U R                  R                  S   S   R                  [        XUWR                  UR                  U5      5        S / pWR                   HX  u  nnnnnUU:w  a0  U R                  R                  U5      nUSUUR                  //-  nUnUSUU[        U/5      /UU-   //-  nMZ     Su  nnn	U[!        U5      S-
  :  a  UUUS-    u  nnUS   S:X  a  US   n	OUS   US   s=:X  a  S:X  a  O  O~US   US   :X  ar  US	   US   -
  n[#        U5      S
:  a-  US   S==   US   S   -  ss'   US	==   US	   US   -
  -  ss'   O#US==   US-  U	-  US   S   /-  ss'   US	   US	'   UUS-   	 M  US-  nU[!        U5      S-
  :  a  M  [%        5       R'                  U5      R)                  X#5      nU R+                  XR,                  5        U R                  R/                  [0        R2                  5        Su  nnnnU H  nUS   S:X  a3  U R                  R/                  US   US   [0        R4                  5        M?  US   S:X  a  UR7                  US   US   45      u  nnU R9                  UUUUU5        UUnn[!        US   5      S:X  a2  U R                  R/                  US   S   [0        R:                  5        M  U R                  R/                  US   [0        R<                  5        M   e   U R                  R/                  [0        R>                  5        U RA                  5       nURC                  U5        URE                  S5        [F        RH                  [F        RJ                  [F        RJ                  [F        RJ                  [F        RL                  /nURN                   HM  u  nnn n![G        UU/UU!-   U/UU!-   UU -   /UUU -   /SS//U5      n"U RQ                  UU"UUR,                  5        MO     g ! , (       d  f       GN%= f)Nr  r  r#   r  r*  )r   r   Nr  r   r  g?r   g     @@r!  ))get_texmanagerget_size_in_pointsmake_dvir   Dvir   r   r  r*   r   r   r   r*  r  sizer   r)   absr   
rotate_degr   r_  rZ  r  r-  rO  rf  r  r  rh  ri  rP  rJ  copy_propertiesset_linewidthr    MOVETOLINETO	CLOSEPOLYboxesrv  )#r   r   rB   r   r2   r  r   r  
texmanagerr  dvifiledvir  oldfontseqx1y1r  r   r   r  r1   curxeltnxtr6  mytranscuryr  r  boxgcr  r  rS  rX  s#                                      r4   draw_texRendererPdf.draw_tex  s1   ((*
**,%%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 '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 #c(1*n" *''.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   	Q,,
Q;c                 V    US;   a  UR                  SS5      $ UR                  SS5      $ )Nr  r  r]   r=  )r   )r   r2   r   s      r4   r  RendererPdf.encode_string	  s,    v88Hi00xx
I..r6   c	                 
   U R                  XR                  5        U(       a  U R                  XX4XV5      $ UR                  5       n	[        R
                  S   (       a  U R                  U5      n
SnOIU R                  U5      n
U R                  R                  R                  X5        [        R
                  S   nUR                  5       b`  U
R                  U5        U
R                  5       u  pU R                  R                  S   S   R                  [!        XX<S-  US-  U5      5        US;  a  U R                  R#                  [$        R&                  U R                  R)                  U5      U	[$        R*                  5        U R-                  X#U5        U R                  R#                  U R/                  XK5      [$        R0                  [$        R2                  5        g / n/ nSnU
n[4        R6                  " XJ[8        R:                  S9 H  n[=        U[?        UR@                  5      5      (       a  U(       d  URB                  U:w  a4  UR                  URB                  URD                  / 45        URB                  nURF                  (       a!  US   S	   R                  URF                  5        US   S	   R                  UR@                  5        S
nM  UR                  URB                  URD                  URH                  45        SnM     U R                  R#                  [$        RJ                  5        [L        RN                  " U5      nU R                  R#                  [L        RP                  " U5      [L        RR                  " U5      [L        RR                  " U5      * [L        RP                  " U5      X#[$        RT                  5        U R                  R#                  [$        R&                  5        SnU GH  u  nnnU R                  R)                  URV                  5      nU R                  R#                  UU	[$        R*                  5        U R-                  USSUSS5        U R                  R#                  [X        RZ                  " U[\        5       VVs/ s HB  u  nnU[^        :X  a  S[a        U5      -  U	-  O U R/                  SRc                  U5      U5      PMD     snn[$        Rd                  5        UnGM     U R                  R#                  [$        R2                  5        U H  u  nnnU Rg                  UU	UUS5        M     U R                  R#                  [$        Rh                  5        g s  snnf )Nrs  r#   r  r  r  )r   r   T)	kern_moder  Fr   ir*  )5r_  rZ  r  r  r_   r}  _get_font_afm_get_font_ttfr   r  trackr   set_textget_width_heightr  r*   r   r  r-  rO  r  rf  r  r  rh  rP  r
   layoutr   UNFITTEDr   r"  char	ft_objectrB   	prev_kern	glyph_idxrc  r{   r|   r~   r}   rU  r  r   groupbyr   r   r|  r+   ri  r  rd  )r   r   rB   r   r2   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                               r4   	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'#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	U4c                 H   UR                  U5      nU R                  R                  UR                  U5      nU R                  R	                  [
        R                  SU-  SSSU-  XE[
        R                  [        U5      [
        R                  [
        R                  5        g)z<Draw a multibyte character from a Type 3 font as an XObject.r  r   N)r  r   r  r  r  r-  rc  rU  rM   rV  rd  )r   r  r  r  rB   r   r  rN   s           r4   r  RendererPdf._draw_xobject_glyph{	  sv    ((3
yy00ZH		HHHaEH$4aB<L<LJKK		
r6   c                 ,    [        U R                  5      $ r>   )r  r   r   s    r4   rJ  RendererPdf.new_gc	  s    !$)),,r6   )r   r   rK  r>   r   rA  )r   r   r   r   r   _get_data_pathrz  _use_afm_rc_namer   r^  r_  rb  ro  rv  r|  r  r  r  r  r  r  r  r  rJ  r  rF  rG  s   @r4   ry  ry    s    (()=>M+#.+6#@<*DN "$L& P/4&l ;? Q:f/
_*B	
- -r6   ry  c            
          ^  \ rS rSrU 4S jrS rS rS rS rSSS	S
.r	SSS	S.r
S rS rS rS rS rS rS rS rS rS rS rS\4S\4S\4S\4S\4S\4S\4S\4S\44	rS  rU 4S! jrS" rS#rU =r$ )$r  i	  c                 X   > [         TU ]  5         SU l        SU l        Xl        S U l        g )NrQ  rS  )r  r   rP  rR  r   parent)r   r   r  s     r4   r   GraphicsContextPdf.__init__	  s)    )!+	r6   c                 N    [        U R                  5      nUS	 US	 [        U5      $ )Nr   r  )r   r  repr)r   rv   s     r4   r   GraphicsContextPdf.__repr__	  s'    fIhKAwr6   c                     U R                   S:  =(       aG    U R                  S:  =(       a1    [        U R                  5      S:*  =(       d    U R                  S   S:g  $ )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   r  )r  rY  r)   rZ  r   s    r4   rF  GraphicsContextPdf.stroke	  sK     !# =a =TYY1$;		!(;	>r6   c                     [        U5      (       a  US   nOU R                  nU R                  =(       d(    USL=(       a    [        U5      S:*  =(       d    US   S:g  $ )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.
r   Nr   r  )r)   rP  _hatch)r   argsrP  s      r4   rG  GraphicsContextPdf.fill	  sZ     t99aJJ A4' @j/Q&>*Q-3*>	Br6   c                 f    [         R                  U R                  5       U R                  5       5      $ )zW
Return the appropriate pdf operator to cause the path to be
stroked, filled, or both.
)r-  rJ  rG  rF  r   s    r4   rt  GraphicsContextPdf.paint	  s!    
 }}TYY[$++-88r6   r   r#   r  )buttr  
projecting)miterr  bevelc                 @    U R                   U   [        R                  /$ r>   )r  r-  ra  r   styles     r4   capstyle_cmdGraphicsContextPdf.capstyle_cmd	  s    u%r}}55r6   c                 @    U R                   U   [        R                  /$ r>   )r  r-  r`  r  s     r4   joinstyle_cmd GraphicsContextPdf.joinstyle_cmd	  s    &77r6   c                 &    U[         R                  /$ r>   )r-  rj  )r   r   s     r4   linewidth_cmd GraphicsContextPdf.linewidth_cmd	  s    r''r6   c                 P    Uu  p#Uc  / nSn[        U5      U[        R                  /$ r.  )r   r-  r_  )r   dashesr6  dashs       r4   dash_cmdGraphicsContextPdf.dash_cmd	  s-    <DFT
FBJJ//r6   c                 \    U R                   R                  U5      nU[        R                  /$ r>   )r   rq  r-  rb  )r   ro  forcedeffective_alphasrN   s        r4   	alpha_cmdGraphicsContextPdf.alpha_cmd	  s&    yy##$45bll##r6   c                 >   U(       dC  U R                   b  U R                  U R                   5      $ [        S5      [        R                  /$ X R                   X4nU R
                  R                  U5      n[        S5      [        R                  U[        R                  /$ )Nr  r  )rP  fillcolor_cmdrM   r-  r\  r   r  r^  )r   r  hatch_colorhatch_linewidthr  rN   s         r4   	hatch_cmdGraphicsContextPdf.hatch_cmd	  s    *))$//::[)2+E+EFF&PK99))+6DOR%?%?"//1 1r6   c                     [         R                  S   (       a  / $ US   US   s=:X  a	  US   :X  a  O  OUS   [        R                  /$ / US S Q[        R                  P$ Nzpdf.inheritcolorr   r#   r  r   )r_   r}  r-  rW  rY  r   r  s     r4   rgb_cmdGraphicsContextPdf.rgb_cmd	  s^    <<*+Iq6SV%s1v%FB--../S!W/b..//r6   c                     Ub  [         R                  S   (       a  / $ US   US   s=:X  a	  US   :X  a  O  OUS   [        R                  /$ / US S Q[        R                  P$ r4  )r_   r}  r-  rX  rZ  r5  s     r4   r.   GraphicsContextPdf.fillcolor_cmd	  sb    ;#,,'9:IVs1v'Q'FB00112S!W2b1122r6   c                     [        U R                  5      nUR                  U 5        U R                  Ul        Xl        [        R
                  /$ r>   )r  r   r  r  r-  rc  )r   r  s     r4   r~  GraphicsContextPdf.push	  s:    #DII.t$zr6   c                     U R                   c   eU R                  U R                   5        U R                   R                   U l         [        R                  /$ r>   )r  r  r-  rd  r   s    r4   r  GraphicsContextPdf.pop	  sA    {{&&&T[[)kk((}r6   c                    / nU R                   U R                  4X4:w  aX  U R                  bK  UR                  U R	                  5       5        U R                   U R                  4X4:w  a  U R                  b  MK  U R                   U R                  4X4:w  d  U R                  c  UR                  U R                  5       5        U R                   U:w  a?  UR                  U[        R                  [        R                  [        R                  /5        U R                  U:w  aV  UR                  5       u  pEUR                  [        R                  XESS9[        R                  [        R                  /-   5        U$ )z1Set clip rectangle. Calls `.pop()` and `.push()`.Fr  )	_cliprect	_clippathr  r  r  r~  r-  rR  rk  rH  get_transformed_path_and_affiner  r  )r   cliprectclippathr(  rX  affines         r4   clip_cmdGraphicsContextPdf.clip_cmd	  s   /H3GGKK+KK
# /H3GGKK+ ^^T^^,0DD#KK		$~~)Xr||RWWbjjIJ~~)'GGI**4%*HWWbjj)*+ r6   )r?  r@  )rY  rX  rR  )	_capstyle)rP  )
_joinstyle)r  )_dashes)rZ  )r  _hatch_color_hatch_linewidthc           
         / nSnU R                    H  u  pESnU H;  n[        X5      n[        X5      n	 Ub  U	c  XLnO[        X:g  5      n U(       d  M;    O   UR                  S:X  a	  U(       a  SnU(       d  Mj  UR                  S:X  a  SnU Vs/ s H  n[        X5      PM     n	nUR                  U" U /U	Q76 5        U H  n[        X[        X5      5        M     M     U$ ! [         ah    [        R
                  " U5      n[        R
                  " U	5      n	UR                  U	R                  :g  =(       d    [        R                  " X:g  5      n GN	f = fs  snf )ze
Copy properties of other into self and return PDF commands
needed to transform *self* into *other*.
Fr1  Tr.  )commandsrU  r   r   r   ry  r  anyr   r  setattr)
r   r  r(  fill_performedparamscmd	differentpourstheirss
             r4   r[  GraphicsContextPdf.delta
  s@   
 ==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!#!7 9 =s   	C$C$E$A.EEc                    > [         TU ]  U5        [        USU R                  5      n[        USU R                  5      nX l        X0l        g)z%
Copy properties of other into self.
rP  rR  N)r  r  rU  rP  rR  )r   r  r\  r*  r  s       r4   r  "GraphicsContextPdf.copy_propertiesC
  sH     	&E<A	"5*=#'#9#9;#!1r6   c                     / nU R                   b.  UR                  U R                  5       5        U R                   b  M.  U$ )z2
Make sure every pushed graphics state is popped.
)r  r  r  )r   r(  s     r4   r^  GraphicsContextPdf.finalizeN
  s6     kk%KK
# kk%r6   )rR  rP  r   r  )r   r   r   r   r   r   rF  rG  rt  r  r  r  r  r!  r&  r+  r1  r6  r.  r~  r  rE  rM  r[  r  r^  r  rF  rG  s   @r4   r  r  	  s    	>B9 Qa8Iq15J68(0$
103, 
$X.	99E	&	-(	-(	-(	x 	G	7CH$L	2 r6   r  c                       \ rS rSrSr\R                  " SSSS9SS j5       rS	 rS
 r	S r
S rS rSS jrS r/ SQ4S jrSrg)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                 *    Xl         X0l        SU l        g)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
  r^  rf   s       r4   r   PdfPages.__init__m
  s    . "!
r6   c                     U $ r>   r   r   s    r4   	__enter__PdfPages.__enter__
  s    r6   c                 $    U R                  5         g r>   )ra  )r   exc_typeexc_valexc_tbs       r4   __exit__PdfPages.__exit__
  s    

r6   c                 z    U R                   c#  [        U R                  U R                  S9U l         U R                   $ )Nrf   )rc  r  ra  rb  r   s    r4   _ensure_filePdfPages._ensure_file
  s,    :: $..IDJzzr6   c                     U R                   b<  U R                   R                  5         U R                   R                  5         SU l         gg)zG
Finalize this object, making the underlying file a complete
PDF file.
N)rc  r^  ra  r   s    r4   ra  PdfPages.close
  s:    
 ::!JJ!JJDJ "r6   c                 6    U R                  5       R                  $ )zy
Return a modifiable information dictionary object
(see PDF reference section 10.2.1 'Document Information
Dictionary').
)rp  r  r   s    r4   infodictPdfPages.infodict
  s       "+++r6   c                    [        U[        5      (       dV  Uc  [        R                  " 5       nO[        R                  " U5      nUc  [        SU 35      eUR                  R                  nUR                  " U 4SSS.UD6  g)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  re   )	r?   r   r   
get_activeget_fig_managerr   canvasfiguresavefig)r   r{  kwargsmanagers       r4   r|  PdfPages.savefig
  sp     &&))~..*--f5 :fX!677^^**FtCE5CFCr6   c                 H    [        U R                  5       R                  5      $ )z=Return the current number of pages in the multipage pdf file.)r)   rp  r  r   s    r4   get_pagecountPdfPages.get_pagecount
  s    4$$&//00r6   r&  c                 B    U R                  5       R                  X5        g)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)rp  r-  )r   r*  r+  s      r4   attach_notePdfPages.attach_note
  s     	'';r6   )rc  ra  rb  r  r>   )r   r   r   r   r  r	   delete_parameterr   rf  rl  rp  ra  ru  r|  r  r  r  r   r6   r4   r]  r]  X
  s^    ( 
6<$BDD2
,D,1 .@ <r6   r]  c                   J   ^  \ rS rSrSrSS0rS rSSS.S jrU 4S	 jrS
r	U =r
$ )FigureCanvasPdfi
  r  r  zPortable Document Formatc                     g)Nr  r   r   s    r4   get_default_filetype$FigureCanvasPdf.get_default_filetype
  s    r6   N)bbox_inches_restorerf   c                   U R                   R                  nSU R                   l        U R                   R                  5       u  pV[        U[        5      (       a  UR                  5       nO	[        XS9n UR                  XV5        [        U R                   XVU[        XtXe5      US9nU R                   R                  U5        UR                  5         [        U[        5      (       d  UR                  5         [        U[        5      (       a  UR                  5         g UR                  5         g ! [        U[        5      (       a  UR                  5         f UR                  5         f = f)Nr  ro  )r  )r{  dpiget_size_inchesr?   r]  rp  r  r$  r   ry  drawr^  r  ra  )	r   r
  r  rf   r  r   r   r   renderers	            r4   	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   4BD- -8E%c                 T   > U R                   R                  5         [        TU ]  5       $ r>   )r{  draw_without_renderingr  r  )r   r  s    r4   r  FigureCanvasPdf.draw
  s    **,w|~r6   r   )r   r   r   r   	fixed_dpi	filetypesr  r  r  r  rF  rG  s   @r4   r  r  
  s0     I23I '+T4 r6   r  c                       \ rS rSr\rSrg)_BackendPdfi
  r   N)r   r   r   r   r  FigureCanvasr  r   r6   r4   r  r  
  s    "Lr6   r  )K   )r   )_r  r   r   r   enumr   	functoolsr   ior   r   loggingr{   rX   r1  r  r<  rs   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   rw  matplotlib._afmr   matplotlib.ft2fontr   r   r   r   r   matplotlib.transformsr   r   matplotlib.pathr    matplotlib.datesr!   r"   r*  r$   	getLoggerr   r}  r5   rm   ry   r   r   r   r@   	maketransr   r   r   r   rM   r%  r-  ro  r  r  RendererPDFPSBasery  r  r]  r  FigureManagerPdfexportr  r   r6   r4   <module>r     s       $     	   
        F F )  @ $ I  Q Q 4      "d,Tn0,"*04 }}
u5U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 %  
#( # #r6   