KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux server112.speedpacket.com 3.10.0-962.3.2.lve1.5.36.el7.x86_64 #1 SMP Mon May 18 02:16:06 EDT 2020 x86_64
User : equistyl ( 1341)
PHP Version : 8.1.30
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/matplotlib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/matplotlib/type1font.pyc
�
r`]c@s�dZddlmZddljZddlZddlZddlZddl	Z	ddl
Z
ddlZejddkr�d�Z
ndefd��YZdS(	s�
This module contains a class representing a Type 1 font.

This version reads pfa and pfb files and splits them for embedding in
pdf files. It also supports SlantFont and ExtendFont transformations,
similarly to pdfTeX and friends. There is no support yet for
subsetting.

Usage::

   >>> font = Type1Font(filename)
   >>> clear_part, encrypted_part, finale = font.parts
   >>> slanted_font = font.transform({'slant': 0.167})
   >>> extended_font = font.transform({'extend': 1.2})

Sources:

* Adobe Technical Note #5040, Supporting Downloadable PostScript
  Language Fonts.

* Adobe Type 1 Font Format, Adobe Systems Incorporated, third printing,
  v1.1, 1993. ISBN 0-201-57044-0.
i����(tprint_functionNiicCs|S(N((tx((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytord#st	Type1FontcBs�eZdZdZd�Zd�Zd�Zejd�Z	ejd�Z
ejd�Zejd	�Ze
d
��Zd�Ze
d��Zd
�ZRS(s�
    A class representing a Type-1 font, for use by backends.

    .. attribute:: parts

       A 3-tuple of the cleartext part, the encrypted part, and the
       finale of zeros.

    .. attribute:: prop

       A dictionary of font properties.
    tpartstpropcCstt|t�r-t|�dkr-||_n9t|d��}|j|�}WdQX|j|�|_|j�dS(s�
        Initialize a Type-1 font. *input* can be either the file name of
        a pfb file or a 3-tuple of already-decoded Type-1 font parts.
        itrbN(t
isinstancettupletlenRtopent_readt_splitt_parse(tselftinputtfiletdata((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt__init__6s!cCsI|j�}|jd�s|Sd}xt|�dkrD|jd�sftdt|d���nt|d�}|d
kr�tjd|dd!�\}|dd|!}|d|}n|dkr�||7}q(|dkr!|djg|D]}d	t|�jd
�^q��7}q(|dkr1Pq(td|��q(W|S(sH
        Read the font from a file, decoding into usable parts.
        s�tis+Broken pfb file (expected byte 128, got %d)iis<iis%02xtasciiis#Unknown segment type %d in pfb file(ii(	treadt
startswithR	tRuntimeErrorRtstructtunpacktjointencode(RRtrawdataRttypetlengthtsegmenttchar((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyRDs.
0c
CsK|jd�}|td�7}x||dkr?|d7}q"W|}|jd�d}d}xn|r�t||�td�td�td�fkr�t||�td�kr�|d8}n|d8}qbW|r�td
��ndjgt||d�D]/}tt|||d!d
��j	d�^q��}|| |||fS(sS
        Split the Type 1 font into its three main parts.

        The three parts are: (1) the cleartext part, which ends in a
        eexec operator; (2) the encrypted part; (3) the fixed part,
        which contains 512 ASCII zeros possibly divided on various
        lines, a cleartomark operator, and possibly something else.
        teexecs 	
itcleartomarkit0is
s
s(Insufficiently many zeros in Type 1 fontRiislatin-1R#t
t
R#(
tindexR	trindexRRRtrangetunichrtintR(RRtidxtlen1tzerostitbinary((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyRds"$
	Hs[\0\t\r\014\n ]+s/{0,2}[^]\0\t\r\v\n ()<>{}/%[]+s%[^\r\n\v]*s[()\\]ccsMd}x@|t|�krH|jj||�pD|jj||�}|rqd|j�fV||j�7}q	||dkr7|}|d7}d}x�|r!|jj||�}|dkr�dS||j�7}|j�dkr�|d7}q�|j�dkr|d8}q�|d7}q�Wd|||!fVq	|||d!dkrqd|||d!fV|d7}q	||dkr�|}|||j	d
�7}d|||!fVq	|j
j||�}|r,y%t|j��d|j�fVWn"tk
rd|j�fVnX||j�7}q	d||fV|d7}q	WdS(s�
        A PostScript tokenizer. Yield (token, value) pairs such as
        ('whitespace', '   ') or ('name', '/Foobar').
        it
whitespacet(iNt)tstringis<<s>>t	delimitert<t>tnumbertname(s<<s>>(
R	t_commenttmatcht_whitespacetgrouptendt	_instringtsearchtNoneR&t_tokentfloatt
ValueError(tclsttexttposR:tstarttdepth((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt_tokens�sN
	



cCs�idd6dd6td6dd6dd	6}|j|jd
�}tjd�|�}x|D]\}}|dkr[|jd
�r[|d}t|�\}}|dkr�|dkr�|dk}q:|jd
�}nc|dkr�|jd�jd�}n<|dkr4d|kr%t	|�}q:t
|�}nd}|dkrb|dk	rb|||<qbq[q[Wd|kr�|jd�p�|jd�p�d|d<nd|kr�|d|d<nd|kr�d}t
j|d|d�|d<n||_dS(s�
        Find the values of various font properties. This limited kind
        of parsing is described in Chapter 10 "Adobe Type Manager
        Compatibility" of the Type-1 spec.
        tRegulartweightgtItalicAngletisFixedPitchi����tUnderlinePositioni2tUnderlineThicknessicSs|ddkS(NiR0((R((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt<lambda>�sR8t/ittruetfalseR3R1R2R7t.tFontInfotFontNametFullNamet
FamilyNametUnknownsT(?i)([ -](regular|plain|italic|oblique|(semi)?bold|(ultra)?light|extra|condensed))+$RN(RRRS(tFalseRIRt	itertoolstifilterRtnexttlstriptrstripRBR*R@tgettretsubR(RRt	tokenizertfilteredttokentvaluetkeytextras((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyR
�s>

 c#s���fd�}�fd�}��fd�}d�}d�}i||�d6||�d6||�d6|d	6}	xqtr�t|�\}
}|
d
kr�||	kr�x:|	|tj|
|fg|��D]}|Vq�Wq||Vq|WdS(Ncs^|}�r-|dttd���7}n�dkrZ|dttd���7}n|S(Nt_Slant_i�g�?t_Extend_(tstrR*(R8tresult(textendtslant(s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytfontname�s!!cs(tt|�tj��tjd�S(Ni�(RkRBtnptarctantpi(tangle(Rn(s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytitalicangle�scsE|jd�jd�j�j�}g|D]}t|�^q+}tjdd�}|ddd�|dd�df<|ddd�|dd�df<tj�ddg�ddgdddgg�}tj||�}|dd�df|ddd�<|dd�df|ddd�<ddj	d�|D��dS(	Nt[t]iiiit css|]}t|�VqdS(N(Rk(t.0R((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pys	<genexpr>s(
R^R_tstriptsplitRBRpteyetarraytdotR(R|Rt	oldmatrixtmodifiert	newmatrix(RmRn(s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt
fontmatrix�s$####cs�fd�}|S(Nc3s�t|�\}}|Vt|�\}}x'|dkrR|Vt|�\}}q,W|dkrm�|�VnSg}x,|dkr�||7}t|�\}}qvW||7}�dj|��VdS(NR0RuRvR(R]R(ttokensReRfR|(tfun(s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytreplacer
s

((R�R�((R�s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytreplace	scss)xtjd�|�D]}qWdVdS(NcSs|ddkS(Nitdef((R((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyRPsR(R[t	takewhile(R�R((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pytsuppressss	/FontNames/ItalicAngles/FontMatrixs	/UniqueIDR8(tTrueR]R[tchain(RDR�RnRmRoRtR�R�R�ttableReRf((RmRns:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt_transformer�s 		


	cCs�tj�}z�|j|jd�}x�|j|d|jdd�d|jdd��D]M}tjddkr�t|t	�r�t
|�jd�}n|j|�qYW|j
�}Wd|j�Xt||jd	|jd
f�S(s�
        Transform the font by slanting or extending. *effects* should
        be a dict where ``effects['slant']`` is the tangent of the
        angle that the font is to be slanted to the right (so negative
        values slant to the left) and ``effects['extend']`` is the
        multiplier by which the font is to be extended (so values less
        than 1.0 condense). Returns a new :class:`Type1Font` object.
        iRngRmg�?islatin-1Nii(tiotBytesIORIRR�R`tsystversion_infoRR*tchrRtwritetgetvaluetcloseR(RteffectstbufferRcRfRl((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt	transform/s	"(spartssprop(t__name__t
__module__t__doc__t	__slots__RRRRatcompileR;RAR9R>tclassmethodRIR
R�R�(((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyR's		 	'1	-A(R�t
__future__Rtmatplotlib.cbooktcbookR�R[tnumpyRpRaRR�R�RtobjectR(((s:/usr/lib64/python2.7/site-packages/matplotlib/type1font.pyt<module>s

Anon7 - 2021