HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyo
�
�)�Uc@skdZddljZddlZddlZddlZddlZddlZde	fd��YZ
dS(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����Nt	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.
    tpartstpropcCs}t|t�r-t|�dkr-||_nBt|d�}z|j|�}Wd|j�X|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_readtcloset_splitt_parse(tselftinputtfiletdata((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt__init__/s!cCsF|j�}|jtd��s%|Sd}xt|�dkrA|jtd��sotdt|d��nt|d�}|dkr�tjd|dd!�\}|dd|!}|d|}n|dkr�||7}q.|dkr!|djg|D]}d	t|�^q��7}q.|d
kr1Pq.td|�q.W|S(
sH
        Read the font from a file, decoding into usable parts.
        i�tis+Broken pfb file (expected byte 128, got %d)iis<iis%02xis#Unknown segment type %d in pfb file(ii(	treadt
startswithtchrRtRuntimeErrortordtstructtunpacktjoin(RRtrawdataRttypetlengthtsegmenttchar((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyR@s0
'c
Cs|jd�}|td�7}x||dkr?|d7}q"W|}|jd�d}d}xA|r�||d
kr�||dkr�|d8}n|d8}qbW|r�td	�nd
jgt||d�D]&}tt|||d!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 	
itcleartomarkit0s
s
s(Insufficiently many zeros in Type 1 fontRii(R!s
s
(tindexRtrindexRRtrangeRtint(RRtidxtlen1tzerostitbinary((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyR
as 
	?s[\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>>(
Rt_commenttmatcht_whitespacetgrouptendt	_instringtsearchtNoneR"t_tokentfloatt
ValueError(tclsttexttposR5tstarttdepth((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt_tokens�sL,
	



cCsidd6dd6td6dd6dd	6}|j|jd
�}tjd�|�}x|D]\}}|dkr[|jd
�r[|d}|j�\}}|dkr�|dkr�|dk}q:|jd
�}nc|dkr�|jd�jd�}n<|dkr4d|kr%t	|�}q:t
|�}nd}|dkrb|dk	rb|||<qbq[q[W|jd�s�|j
d�p�|j
d�p�d|d<n|jd�s�|d|d<n|jd�s�d}tj|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(NiR+((tx((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt<lambda>�sR3t/ittruetfalseR.R,R-R2t.tFontInfotFontNametFullNamet
FamilyNametUnknownsT(?i)([ -](regular|plain|italic|oblique|(semi)?bold|(ultra)?light|extra|condensed))+$RN(RNRO(tFalseRDRt	itertoolstifilterRtnexttlstriptrstripR=R%R;thas_keytgettretsubR(RRt	tokenizertfilteredttokentvaluetkeytextras((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyR�s:
+ c#s���fd�}�fd�}��fd�}d�}d�}i||�d6||�d6||�d6|d	6}	xqtr�|j�\}
}|
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%(R3tresult(textendtslant(sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pytfontname�s!!cs(tt|�tj��tjd�S(Ni�(RhR=tnptarctantpi(tangle(Rk(sG/opt/alt/python27/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(Rh(t.0RK((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pys	<genexpr>�s(
RZR[tstriptsplitR=RmteyetarraytdotR(RyRKt	oldmatrixtmodifiert	newmatrix(RjRk(sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt
fontmatrix�s$####cs�fd�}|S(Nc3s�|j�\}}|V|j�\}}x'|dkrR|V|j�\}}q,W|dkrm�|�VnSg}x,|dkr�||7}|j�\}}qvW||7}�dj|��VdS(NR+RrRsR(RYR(ttokensRbRcRy(tfun(sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pytreplacer�s

((R�R�((R�sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pytreplace�scss)xtjd�|�D]}qWdVdS(NcSs|ddkS(Nitdef((RK((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyRLsR(RWt	takewhile(RRK((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pytsuppressss	/FontNames/ItalicAngles/FontMatrixs	/UniqueIDR3(tTrueRYRWtchain(R?RRkRjRlRqR~R�R�ttableRbRc((RjRksG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt_transformer�s		


	,cCs�tj�}|j|jd�}xH|j|d|jdd�d|jdd��D]}|j|�qVW|j�}|j�t	||jd|jdf�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.
        iRkgRjg�?ii(
t	cStringIOtStringIORDRR�R]twritetgetvalueR	R(RteffectstbufferR`RcRi((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt	transform!s

(spartssprop(t__name__t
__module__t__doc__t	__slots__RRR
R^tcompileR6R<R4R9tclassmethodRDRR�R�(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyR s		!	&/	)>(R�tmatplotlib.cbooktcbookR�RWtnumpyRmR^RtobjectR(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/type1font.pyt<module>s