OwlCyberSecurity - MANAGER
Edit File: dviread.cpython-38.pyc
U ��]� � @ s� d Z ddlmZ ddlZddlmZmZmZ ddlZddl Z ddl Z ddlZddlZddl ZddlmZmZ e�e�Ze�dd�Zedd �Zed d�Zedd �Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Ze eeedd�eedd�eedd�eeeed�Z!dKd d!�Z"G d"d#� d#e#�Z$G d$d%� d%e#�Z%G d&d'� d'e$�Z&d(d)� Z'd*d+� Z(G d,d-� d-e#�Z)ed.d/�Z*G d0d1� d1e#�Z+G d2d3� d3e#�Z,d4d5� Z-e� dLd6d7��Z.e� d8d9� �Z/ee/e)d:�Z0ee/e&d;�Z1ed<k�r�dd=l2m3Z3 ddl4Z4e3� Z5e5�6d>� e5j6d?d@e7ddA� e5�8� Z9e$e9j:e9j;���Z<e+e.dB��Z=e<D ]�Z>e?dC� e4�@e>jAdDdE� �D ]^\ZBZCe?dFeBjDdGeBjEdH � eCD ]8ZAe?eAjFeAjGeAjHeIeAjH��J� �r�eIeAjH�ndIeAjK� �qj�qHe>jLD ]\ZFZGZMZNe?eFeGdJeMeN� �q��q*W 5 Q R X dS )MaC A module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor, but it is currently used by the pdf backend for processing usetex text. Interface:: with Dvi(filename, 72) as dvi: # iterate over pages: for page in dvi: w, h, d = page.width, page.height, page.descent for x, y, font, glyph, width in page.text: fontname = font.texname pointsize = font.size ... for x, y, height, width in page.boxes: ... � )� namedtupleN)� lru_cache�partial�wraps)�cbook�rcParamsZDviStatez!pre outer inpage post_post finale�Pageztext boxes height width descent�Textzx y font glyph width�Boxzx y height widthc C s |S )z>Return *delta* without reading anything more from the dvi file� ��dviZdeltar r �4/usr/lib/python3/dist-packages/matplotlib/dviread.py�_arg_rawF s r c C s |� | |�S )ztRead *bytes* bytes, returning the bytes interpreted as a signed integer if *signed* is true, unsigned otherwise.��_arg)�bytes�signedr �_r r r r K s r c C s |dkrdS | � |d�S )z�Signed, length *delta* Read *delta* bytes, returning None if *delta* is zero, and the bytes interpreted as a signed integer otherwise.r NTr r r r r � _arg_slenQ s r c C s | � |d d�S )z^Signed, length *delta*+1 Read *delta*+1 bytes, returning the bytes interpreted as signed.� Tr r r r r � _arg_slen1[ s r c C s | � |d d�S )zaUnsigned length *delta*+1 Read *delta*+1 bytes, returning the bytes interpreted as unsigned.r Fr r r r r � _arg_ulen1b s r c C s | � |d |dk�S )z�Optionally signed, length *delta*+1 Read *delta*+1 bytes, returning the bytes interpreted as unsigned integer for 0<=*delta*<3 and signed if *delta*==3.r � r r r r r � _arg_olen1i s r r F� T)�raw�u1�u4�s4�slen�olen1�slen1�ulen1�r c s � ����fdd�}|S )ad Decorator for dispatch by opcode. Sets the values in *table* from *min* to *max* to this method, adds a check that the Dvi state matches *state* if not None, reads arguments from the file according to *args*. *table* the dispatch table to be filled in *min* minimum opcode for calling this function *max* maximum opcode for calling this function, None if only *min* is allowed *state* state of the Dvi object in which these opcodes are allowed *args* sequence of argument specifications: ``'raw'``: opcode minus minimum ``'u1'``: read one unsigned byte ``'u4'``: read four bytes, treat as an unsigned number ``'s4'``: read four bytes, treat as a signed number ``'slen'``: read (opcode - minimum) bytes, treat as signed ``'slen1'``: read (opcode - minimum + 1) bytes, treat as signed ``'ulen1'``: read (opcode - minimum + 1) bytes, treat as unsigned ``'olen1'``: read (opcode - minimum + 1) bytes, treat as unsigned if under four bytes, signed if four bytes c sj dd� �D �� t ��� ���fdd��}�d kr:|��<