HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pdfminer/__pycache__/encodingdb.cpython-38.pyc
U

�R�]�
�@stddlZddlZddlZddlmZddlmZddlmZe�	d�Z
e�e�Z
dd�Zd	d
�ZGdd�de�ZdS)
�N�)�glyphname2unicode)�ENCODING)�	PSLiteralz[0-9a-fA-F]+cs*|�d�d}|�d�}t|�dkr4d�tt|��S|tkrFt�|�S|�d�r�|�d��t	�
��r�t��ddkr��fdd	�tdt��d�D�}|D]}t|�q�tt
j|�}d�|�Sn^|�d
��r|�d
�}t	�
|��rdt|�kr�dk�rnnt|dd
�}t|�t
�|�Std|��dS)a�Converts Adobe glyph names to Unicode numbers.

    In contrast to the specification, this raises a KeyError instead of return an empty string when the key is unknown.
    This way the caller must explicitly define what to do when there is not a match.

    Reference: https://github.com/adobe-type-tools/agl-specification#2-the-mapping

    :returns unicode character if name resembles something, otherwise a KeyError
    �.r�_r�Zuni�cs$g|]}t�||d�dd��qS)r	���base)�int)�.0�i�Zname_without_uni��5/usr/lib/python3/dist-packages/pdfminer/encodingdb.py�
<listcomp>'sz name2unicode.<locals>.<listcomp>�u�r
rzXCould not convert unicode name "%s" to character because it does not match specificationN)�split�len�join�map�name2unicoder�get�
startswith�strip�HEXADECIMAL�match�range�#raise_key_error_for_invalid_unicode�sixZunichrr
�KeyError)�nameZ
componentsZunicode_digitsZdigitZ
charactersZname_without_u�
unicode_digitrrrrs*






*
rcCs(d|krdkr$nntd|��dS)z�Unicode values should not be in the range D800 through DFFF because that is used for surrogate pairs in UTF-16

    :raises KeyError if unicode digit is invalid
    i��i�zHUnicode digit %d is invalid because it is in the range D800 through DFFFN)r#)r%rrrr!8sr!c@s�eZdZiZiZiZiZeD]F\ZZ	Z
ZZe
e�Ze	r>eee	<e
rJeee
<erVeee<ereee<qeeeed�Zeddd��ZdS)�
EncodingDB)ZStandardEncodingZMacRomanEncodingZWinAnsiEncodingZPDFDocEncodingNcCs�|j�||j�}|r�|��}d}|D]j}t|t�r8|}q$t|t�r$zt|j�||<Wn0t	k
r�}zt
�t|��W5d}~XYnX|d7}q$|S)Nrr)
�	encodingsr�std2unicode�copy�
isinstancer
rrr$r#�log�debug�str)�klassr$ZdiffZcid2unicodeZcid�x�errr�get_encodingYs

 
zEncodingDB.get_encoding)N)�__name__�
__module__�__qualname__r(Zmac2unicodeZwin2unicodeZpdf2unicoderr$ZstdZmac�winZpdfr�cr'�classmethodr1rrrrr&As*
�r&)Zlogging�rer"Z	glyphlistrZ	latin_encrZpsparserr�compilerZ	getLoggerr2r+rr!�objectr&rrrr�<module>s

)