
    i?1i                         d dl Z d dlZd dlmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ  ej                  d      Z e j                  e      Zded	efd
Zded	dfdZ G d d      Zy)    N)DictIterableOptionalcast   )glyphname2unicode)ENCODING)	PSLiteralz[0-9a-fA-F]+namereturnc           	         t        | t              st        d| dt        |             | j	                  d      d   } | j	                  d      }t        |      dkD  rdj                  t        t        |            S | t        v r	t        |    S | j                  d      r| j                  d      }t        j                  |      rt        |      d	z  dk(  rt        dt        |      d	      D cg c]  }t        |||d	z    d
       }}|D ]  }t!        |        t        t"        |      }dj                  |      S | j                  d      r`| j                  d      }t        j                  |      r:d	t        |      cxk  rdk  r&n n#t        |d
      }t!        |       t#        |      S t        d| z        c c}w )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
    z Could not convert unicode name "z?" to character because it should be of type str but is of type .r   _r    uni      )baseu   zXCould not convert unicode name "%s" to character because it does not match specification)
isinstancestrKeyErrortypesplitlenjoinmapname2unicoder   
startswithstripHEXADECIMALmatchrangeint#raise_key_error_for_invalid_unicodechr)	r   
componentsname_without_uniiunicode_digitsdigit
charactersname_without_uunicode_digits	            ]/home/www/therecruiter.miabetepe.com/venv/lib/python3.12/site-packages/pdfminer/encodingdb.pyr   r      s    dC <@$t*N
 	

 ::c?1DCJ
:wws<455 $$$T**__U##zz%0  !12s;K7Lq7PTU7U #1c*:&;Q?" (QU3"=" " , ?E7>? n5
wwz**__S!!ZZ_N  0Q#n:M5RQR5R #N <3MB=))
	*,0	1 #"s   .F<r/   c                 <    d| cxk  rdk  rn yt        d| z        y)zUnicode 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/   s    r0   r&   r&   G   s1     }$u$35BC
 	
 %    c            
          e Zd ZU i Zeeef   ed<   i Zeeef   ed<   i Z	eeef   ed<   i Z
eeef   ed<   eD ]-  \  ZZZZZ ee      Zereee<   ereee<   eree	e<   es)ee
e<   / eee	e
dZe	 ddedeee      d	eeef   fd
       Zy)
EncodingDBstd2unicodemac2unicodewin2unicodepdf2unicode)StandardEncodingMacRomanEncodingWinAnsiEncodingPDFDocEncodingNr   diffr   c                    | j                   j                  || j                        }|ri|j                         }d}|D ]R  }t	        |t
              r|}t	        |t              s'	 t        t        t        |j                              ||<   |dz  }T |S # t        t        f$ r(}t        j                  t        |             Y d }~;d }~ww xY w)Nr   r   )	encodingsgetr5   copyr   r%   r
   r   r   r   r   r   
ValueErrorlogdebug)clsr   r=   cid2unicodecidxes          r0   get_encodingzEncodingDB.get_encodingl   s     mm''coo>%**,KC a%C9-*+7S!&&8I+JC( 1HC  %j1 *		#a&))*s   %&BC#CC)N)__name__
__module____qualname__r5   r   r%   r   __annotations__r6   r7   r8   r	   r   stdmacwinpdfr   cr?   classmethodr   r   objectrJ    r2   r0   r4   r4   T   s    "$Kc3h$"$Kc3h$"$Kc3h$"$Kc3h$&. 	!"sCc K K K K	! ('&%	I ;?&x'78	c3h r2   r4   )loggingretypingr   r   r   r   	glyphlistr   	latin_encr	   psparserr
   compiler"   	getLoggerrK   rC   r   r   r%   r&   r4   rV   r2   r0   <module>r_      sm     	 1 1 (  bjj)g!6s 6s 6r

s 

t 

) )r2   