File: //usr/lib/python3/dist-packages/ocrmypdf/pdfinfo/__pycache__/layout.cpython-38.pyc
U
��Z^E$ � @ s` d dl Z d dlmZ d dlmZ d dlmZ d dlZd dlZd dl Zd dl
Zd dlmZ d dl
mZ d dlmZmZmZmZ d dlmZ d d lmZmZmZ d d
lmZ d dlmZmZ dd
lm Z e �!d�Z"ej#dk�r dd� Z$e$ej%_$ej&Z'd$dd�Z(e(e_&ej&Z)dd� Z*e*e_&dd� Z+dd� Z,dd� Z-G dd� de�Z.G dd� de�Z/d d!� Z0d"d#� Z1dS )%� N)�copysign)�Path)�patch)�PDFLayoutAnalyzer)�glyphname2unicode)�LAParams�LTChar�LTPage� LTTextBox)�PDFTextExtractionNotAllowed)�PDFFont�
PDFSimpleFont�PDFUnicodeNotDefined)�PDFPage)�bbox2str�
matrix2str� )�EncryptedPdfErrorz[0-9]+Z20181108c C s� | t krt | S | �d�s$| �d�r,t| ��| �d�rlztt| dd� d��W S tk
rj t| ��Y nX t�| �}|s�t| ��tt|�d���S )aY Fix pdfminer's name2unicode function
Font cids that are mapped to names of the form /g123 seem to be, by convention
characters with no corresponding Unicode entry. These can be subsetted fonts
or symbolic fonts. There seems to be no way to map /g123 fonts to Unicode,
barring a ToUnicode data structure.
�g�aZuni� N� r ) r �
startswith�KeyError�chr�int�
ValueError�
STRIP_NAME�search�group)�name�m� r"