
    )i                         S SK r S SKrS SKJrJrJrJr  SSKJr  SSK	J
r
  SSKJr  \R                  " S5      r\ R                  " \5      rS\S	\4S
 jrS\S	S4S jr " S S5      rg)    N)DictIterableOptionalcast   )glyphname2unicode)ENCODING)	PSLiteralz[0-9a-fA-F]+namereturnc           	         [        U [        5      (       d  [        SU < S[        U 5      < 35      eU R	                  S5      S   n U R	                  S5      n[        U5      S:  a  SR                  [        [        U5      5      $ U [        ;   a	  [        U    $ U R                  S5      (       a  U R                  S5      n[        R                  U5      (       az  [        U5      S	-  S:X  ah  [        S[        U5      S	5       Vs/ s H  n[        X#US	-    S
S9PM     nnU H  n[!        U5        M     [        ["        U5      nSR                  U5      $ OzU R                  S5      (       ad  U R                  S5      n[        R                  U5      (       a9  S	[        U5      s=::  a  S::  a#  O  O [        US
S9n[!        U5        [#        U5      $ [        SU -  5      es  snf )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	            S/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pdfminer/encodingdb.pyr   r      s    dC  <@$t*N
 	

 ::c?1DCJ
:wws<455 $$$T**__U###zz%0  !122s;K7Lq7PTU7U #1c*:&;Q?"? (QU3"=?  " ,E7> , n5
wwz**__S!!!ZZ_N  00Q#n:M5RQR5R #N <3MB=))
	*,0	1 #"s   Gr/   c                 @    SU s=:  a  S:  a  O  g[        SU -  5      eg)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            
       R   \ rS rSr% 0 r\\\4   \S'   0 r	\\\4   \S'   0 r
\\\4   \S'   0 r\\\4   \S'   \ HC  u  rrrrr\" \5      r\(       a  \\\'   \(       a  \\	\'   \(       a  \\
\'   \(       d  M>  \\\'   ME     \\	\
\S.r\ SS\S	\\\      S
\\\4   4S jj5       rSrg)
EncodingDBT   std2unicodemac2unicodewin2unicodepdf2unicode)StandardEncodingMacRomanEncodingWinAnsiEncodingPDFDocEncodingNr   diffr   c                    U R                   R                  XR                  5      nU(       av  UR                  5       nSnU H^  n[	        U[
        5      (       a  UnM  [	        U[        5      (       d  M3   [        [        [        UR                  5      5      X4'   US-  nM`     U$ ! [        [        4 a(  n[        R                  [        U5      5         S nAN>S nAff = f)Nr   r   )	encodingsgetr6   copyr   r%   r
   r   r   r   r   r   
ValueErrorlogdebug)clsr   r>   cid2unicodecidxes          r0   get_encodingEncodingDB.get_encodingl   s     mm''oo>%**,KCa%%C9--*+7S!&&8I+J( 1HC   %j1 *		#a&))*s   5%B%%C5CC )N)__name__
__module____qualname____firstlineno__r6   r   r%   r   __annotations__r7   r8   r9   r	   r   stdmacwinpdfr   cr@   classmethodr   r   objectrK   __static_attributes__rM   r2   r0   r4   r4   T   s    "$Kc3h$"$Kc3h$"$Kc3h$"$Kc3h$&."sCc K K K3 K '/ ('&%	I ;?&x'78	c3h r2   r4   )loggingretypingr   r   r   r   	glyphlistr   	latin_encr	   psparserr
   compiler"   	getLoggerrN   rD   r   r   r%   r&   r4   rM   r2   r0   <module>rc      si     	 1 1 (  jj)!6s 6s 6r

s 

t 

) )r2   