ó
    {ñ:i^¦  ã                   óD  • S r SSKJr  SSKrSSKJrJrJr  SSKrSSK	r	SSK
Jr  SSKrSSKrSSKrSSKrSSKrSSKJrJr  \R*                  " \5      r\R0                  " SS5      r\" S	S
5      r\" SS5      r " S S\" SS5      5      r\" S S S S S S S S S9rSJS jr " S S5      r  " S S5      r! " S S\ 5      r"S  r# " S! S"5      r$\" S#S$5      r% " S% S&5      r&S' r' " S( S)5      r(\S* 5       r)\S+ 5       r*\" \*\$S,5      r+\" \*\"S-5      r,\S.:X  Gaõ  SS/K-J.r.  SSK/r/\." 5       r0\0Rc                  S05        \0Rc                  S1S2\2SS39  \0Rg                  5       r4\ " \4Rj                  \4Rl                  5       r7\&" \)" S45      5      r8\7 GHu  r9\:" S5\9Rv                   S6\9Rx                   S7\9Rz                   S835        \/R|                  " \9R~                  S9 5       Hº  u  r@rA\:" S:\@R„                  R‡                  S;5      < S<\@Rˆ                  S=-   35        \:" S>S?S@SASBSCSDSE9  \A Hm  r?\:" \?RŠ                  \?RŒ                  \?RŽ                  \H" \?RŽ                  5      R“                  5       (       a  \H" \?RŽ                  5      OSF\?Rv                  SDSE9  Mo     M¼     \9R”                  (       d  GM$  \:" S>S?SGSBSHSISDSE9  \9R”                   H5  rK\:" \KRŠ                  \KRŒ                  \KRx                  \KRv                  SDSE9  M7     GMx     SSS5        gg! , (       d  f       g= f)KaC  
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)ÚPath)Ú_apiÚcbookÚDviStatez!pre outer inpage post_post finaleÚPageztext boxes height width descentÚBoxzx y height widthc                   ó^   • \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	\S 5       r
Srg	)
ÚTextéA   a•  
A glyph in the dvi file.

The *x* and *y* attributes directly position the glyph.  The *font*,
*glyph*, and *width* attributes are kept public for back-compatibility,
but users wanting to draw the glyph themselves are encouraged to instead
load the font specified by `font_path` at `font_size`, warp it with the
effects specified by `font_effects`, and load the glyph specified by
`glyph_name_or_index`.
c                 óX   • [        [        S5      5      U R                  R                     $ )Nú
pdftex.map)Ú
PsfontsMapÚfind_tex_fileÚfontÚtexname©Úselfs    ÚU/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/matplotlib/dviread.pyÚ_get_pdftexmap_entryÚText._get_pdftexmap_entryM   s!   € Üœ-¨Ó5Ó6°t·y±y×7HÑ7HÑIÐIó    c                 ó   • U R                  5       nUR                  cM  [        SR                  UR                  R                  S5      UR                  R                  S5      5      5      e[        UR                  5      $ )z/The `~pathlib.Path` to the font for this glyph.zINo usable font file found for {} ({}); the font may lack a Type-1 versionÚascii)r   ÚfilenameÚ
ValueErrorÚformatÚpsnameÚdecoder   r   )r   Úpsfonts     r   Ú	font_pathÚText.font_pathP   sp   € ð ×*Ñ*Ó,ˆØ�?‰?Ñ"Üð Bç$™f V§]¡]×%9Ñ%9¸'Ó%BØ%+§^¡^×%:Ñ%:¸7Ó%CóEóFð Fô �F—O‘OÓ$Ð$r   c                 ó.   • U R                   R                  $ )zThe font size.)r   Úsizer   s    r   Ú	font_sizeÚText.font_size[   s   € ð �y‰y�~‰~Ðr   c                 ó6   • U R                  5       R                  $ )zš
The "font effects" dict for this glyph.

This dict contains the values for this glyph of SlantFont and
ExtendFont (if any), read off :file:`pdftex.map`.
)r   Úeffectsr   s    r   Úfont_effectsÚText.font_effects`   s   € ð ×(Ñ(Ó*×2Ñ2Ð2r   c                 ó˜   • U R                  5       nUR                  b"  [        UR                  5      U R                     $ U R                  $ )a<  
Either the glyph name or the native charmap glyph index.

If :file:`pdftex.map` specifies an encoding for this glyph's font, that
is a mapping of glyph indices to Adobe glyph names; use it to convert
dvi indices to glyph names.  Callers can then convert glyph names to
glyph indices (with FT_Get_Name_Index/get_name_index), and load the
glyph using FT_Load_Glyph/load_glyph.

If :file:`pdftex.map` specifies no encoding, the indices directly map
to the font's "native" charmap; glyphs should directly load using
FT_Load_Char/load_char after selecting the native charmap.
)r   ÚencodingÚ
_parse_encÚglyph)r   Úentrys     r   Úglyph_name_or_indexÚText.glyph_name_or_indexj   sD   € ð ×)Ñ)Ó+ˆà—>‘>Ñ-ô ˜5Ÿ>™>Ó*¨4¯:©:Ñ6ð 	?Ø37·:±:ð	?r   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr$   r(   r,   r3   Ú__static_attributes__r5   r   r   r   r   A   s]   † ñ	òJð ñ%ó ð%ð ñó ðð ñ3ó ð3ð ñ?ó ó?r   r   zx y font glyph widthc                 ó   • U$ ©Nr5   ©ÚdviÚdeltas     r   Ú<lambda>rB   …   s   € ™5r   c                 ó"   • U R                  SSS9$ ©Né   F©Úsigned©Ú	_read_argr?   s     r   rB   rB   ‡   ó   € ˜#Ÿ-™-¨°%˜-Ñ8r   c                 ó"   • U R                  SSS9$ )Né   FrF   rH   r?   s     r   rB   rB   ‰   rJ   r   c                 ó"   • U R                  SSS9$ )NrL   TrF   rH   r?   s     r   rB   rB   ‹   s   € ˜#Ÿ-™-¨°$˜-Ñ7r   c                 ó4   • U(       a  U R                  USS9$ S $ )NTrF   rH   r?   s     r   rB   rB   �   s   € Æ˜CŸM™M¨%¸˜MÐ=ÐPÈDÐPr   c                 ó(   • U R                  US-   SS9$ )NrE   TrF   rH   r?   s     r   rB   rB   �   s   € ˜SŸ]™]¨5°1©9¸T˜]ÑBr   c                 ó(   • U R                  US-   SS9$ rD   rH   r?   s     r   rB   rB   ‘   s   € ˜SŸ]™]¨5°1©9¸U˜]ÑCr   c                 ó.   • U R                  US-   US:H  S9$ )NrE   é   rF   rH   r?   s     r   rB   rB   ”   s   € ˜SŸ]™]¨5°1©9¸eÀq¹j˜]ÑJr   )ÚrawÚu1Úu4Ús4ÚslenÚslen1Úulen1Úolen1c                 ó$   ^ ^^^^• UUUUU 4S jnU$ )a)  
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*.

Parameters
----------
table : dict[int, callable]
    The dispatch table to be filled in.

min, max : int
    Range of opcodes that calls the registered function; *max* defaults to
    *min*.

state : _dvistate, optional
    State of the Dvi object in which these opcodes are allowed.

args : list[str], default: ['raw']
    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                 óÒ   >^ ^• T Vs/ s H  n[         U   PM     snm[        T 5      UU UU4S j5       nTc  UT	T'   U$ [        TTS-   5       H  nT	U   b   eUT	U'   M     U$ s  snf )Nc                 óŽ   >• Tb  U R                   T:w  a  [        S5      eT" U /T Vs/ s H  o"" XT-
  5      PM     snQ76 $ s  snf )Nzstate precondition failed)Ústater   )r   ÚbyteÚfÚget_argsÚmethodÚminr^   s      €€€€r   ÚwrapperÚ,_dispatch.<locals>.decorate.<locals>.wrapper»   sK   ø€ àÑ  T§Z¡Z°5Ó%8Ü Ð!<Ó=Ð=Ù˜$ÐG¹XÓ!FºX¸ ! D¨s©(Ö"3¹XÑ!FÒGÐGùÒ!Fs   ¨A
rE   )Ú_arg_mappingr   Úrange)
rb   Úxrd   Úira   ÚargsÚmaxrc   r^   Útables
   `   @€€€€€r   ÚdecorateÚ_dispatch.<locals>.decorate¸   s†   ú€ Ù-1Ó2ªT¨”L ”O©TÑ2ˆä	ˆv‹÷	Hó 
ð	Hð ‰;Ø ˆE�#‰Jð
 ˆô ˜3  A¡Ö&�Ø˜Q‘xÑ'Ð'Ð'Ø"��a“ñ 'ð ˆùò 3s   ˆA$r5   )rl   rc   rk   r^   rj   rm   s   ````` r   Ú	_dispatchro   ˜   s   ü€ ÷@ñ ð €Or   c                   ó   • \ rS rSrSrS/S-  r\" \\5      rS rS r	S r
S rS	 rS
 rS rS]S jr\" SS\R"                  S9S 5       r\" SS\R"                  SS9S 5       r\" S\R"                  SS9S 5       r\" SS\R"                  SS9S 5       rS r\" S\R"                  SS9S 5       rS  r\" S!5      S" 5       r\" S#\R4                  S$S9S% 5       r\" S&\R"                  S'9S( 5       r\" S)\R"                  S'9S* 5       r\" S+\R"                  S'9S, 5       r\" S-S.\R"                  S/S9S0 5       r\" S1S2\R"                  S3S9S4 5       r \" S5S6\R"                  S3S9S7 5       r!\" S8S9\R"                  S/S9S: 5       r"\" S;S<\R"                  S3S9S= 5       r#\" S>S?\R"                  S3S9S@ 5       r$\" SASB\R"                  S9SC 5       r%\" SDSE\R"                  SS9SF 5       r&\" SGSHSISJ9SK 5       r'\" SLSMSNSJ9SO 5       r(SP r)\" SQ\RT                  SRS9SS 5       r+\" ST\R4                  S'9SU 5       r,\" SV5      SW 5       r-\" SXSYSZ9S[ 5       r.S\r/g)^ÚDviéÊ   a!  
A reader for a dvi ("device-independent") file, as produced by TeX.

The current implementation can only iterate through pages in order,
and does not even attempt to verify the postamble.

This class can be used as a context manager to close the underlying
file upon exit. Pages can be read via iteration. Here is an overly
simple way to extract text without trying to detect whitespace::

    >>> with matplotlib.dviread.Dvi('input.dvi', 72) as dvi:
    ...     for page in dvi:
    ...         print(''.join(chr(t.glyph) for t in page.text))
Né   c                 ó¤   • [         R                  SU5        [        US5      U l        X l        0 U l        [        R                  U l        SU l	        g)zÑ
Read the data from the file named *filename* and convert
TeX's internal units to units of *dpi* per inch.
*dpi* only sets the units and does not limit the resolution.
Use None to return TeX's internal units.
zDvi: %sÚrbN)
Ú_logÚdebugÚopenÚfileÚdpiÚfontsÚ	_dvistateÚprer^   Ú_missing_font)r   r   rz   s      r   Ú__init__ÚDvi.__init__Ý   s?   € ô 	�
‰
�9˜hÔ'Ü˜ 4Ó(ˆŒ	ØŒØˆŒ
Ü—]‘]ˆŒ
Ø!ˆÕr   c                 ó   • U $ )z+Context manager enter method, does nothing.r5   r   s    r   Ú	__enter__ÚDvi.__enter__ë   s   € àˆr   c                 ó$   • U R                  5         g)zH
Context manager exit method, closes the underlying file if it is open.
N)Úclose)r   ÚetypeÚevalueÚetraces       r   Ú__exit__ÚDvi.__exit__ï   s   € ð 	�
‰
�r   c              #   óŠ   #   • U R                  5       (       a*  U R                  5       v •  U R                  5       (       a  M)  gg7f)aô  
Iterate through the pages of the file.

Yields
------
Page
    Details of all the text and box objects on the page.
    The Page tuple contains lists of Text and Box tuples and
    the page dimensions, and the Text and Box tuples contain
    coordinates transformed into a standard Cartesian
    coordinate system at the dpi value given when initializing.
    The coordinates are floating point numbers, but otherwise
    precision is not lost and coordinate values are not clipped to
    integers.
N)Ú_readÚ_outputr   s    r   Ú__iter__ÚDvi.__iter__õ   s+   é € ð  �j‰j�l‰lØ—,‘,“.Ò ð �j‰j�l�lùs   ‚=AÁAc                 óp   • U R                   R                  (       d  U R                   R                  5         gg)z(Close the underlying file if it is open.N)ry   Úclosedr…   r   s    r   r…   Ú	Dvi.close  s"   € à�y‰y××Ø�I‰I�O‰OÕð  r   c                 ó$  • [         R                  =p[         R                  * =p4[         R                  * nU R                  U R                  -    Hy  n[	        U[
        5      (       a  Uu  pxpšSnOUu  pxpÍn
UR                  U5      u  p›[        X5      n[        X(U	-
  5      n[        X7U
-   5      n[        XHU-   5      n[        XX5      nM{     U R                  b  U R                  nSU l	        U R                  (       d  U R                  (       d  [        / / SSSS9$ U R                  c'  [        U R                  U R                  X1-
  XR-
  XE-
  S9$ U R                  S-  nXE-
  U-  nU R                   VVVVV
s/ s H%  u  pxnpÚ[        Xq-
  U-  XH-
  U-  U-
  UXÚU-  5      PM'     nnnnnn
U R                   VVV	V
s/ s H%  u  pxpš[        Xq-
  U-  XH-
  U-  U-
  Xž-  X®-  5      PM'     nn	nnn
[        UUX1-
  U-  XR-
  U-  US9$ s  sn
nnnnf s  sn
n	nnf )zS
Output the text and boxes belonging to the most recent page.
page = dvi._output()
r   N©ÚtextÚboxesÚwidthÚheightÚdescentgáz®GRA)ÚnpÚinfr•   r–   Ú
isinstancer   Ú_height_depth_ofrc   rk   Ú_baseline_vr   rz   r   )r   ÚminxÚminyÚmaxxÚmaxyÚ	maxy_pureÚeltrh   ÚyÚhÚwÚer   ÚgÚdr™   r`   r•   r–   s                      r   r�   ÚDvi._output  s  € ô
 —f‘fÐˆÜ—v‘v�gÐˆÜ—V‘V�Gˆ	Ø—9‘9˜tŸz™zÔ)ˆCÜ˜#œs×#Ñ#Ø ‘
��aØ‘à#&Ñ ��d˜qØ×,Ñ,¨QÓ/‘�Ü�t“<ˆDÜ�t ™UÓ#ˆDÜ�t ™UÓ#ˆDÜ�t ™UÓ#ˆDÜ˜IÓ)ŠIñ *ð ×ÑÑ'Ø×(Ñ(ˆIØ#ˆDÔà�y�y §§Ü˜R r°¸1ÀaÑHÐHà�8‰8Ñä˜TŸY™Y¨d¯j©jØ"™i°	±Ø $¡ñ0ð 0ð
 �H‰H˜Ñ&ˆØÑ# qÑ(ˆð (,§y¢y÷2Ú'0‘O�Q˜1˜aô �a‘f˜a‘Z $¡&¨!¡¨gÑ!5°q¸!¸q¹SÖAÙ'0ð 	ô 2ð &*§Z¢Zö1Ú%/‘\�a˜Aô �a‘f˜a‘Z $¡&¨!¡¨gÑ!5°q±s¸A¹CÖ@Ù%/ð 	ó 1ô ˜ U°4±9¸a±-Ø%™N¨AÑ-°wñ@ð 	@ùö2ùõ1s   Å6,HÆ9,H

c                 ó‚  • S/nSU l          U R                  R                  S5      S   nU R                  U   " X5        U R                  (       a  U R                  R                  5       eU R                  U   R                  nUS:X  a  UR                  US   5        O*US:X  a  UR                  5         OUS:X  a  US==   S-  ss'   U R                   c4  [        [        U S	/ 5      5      S
:X  a  US   S:¼  a  U R                  U l         US:X  a  gU R                  [        R                  L a  U R                  5         gGM5  )ú\
Read one page from the file. Return True if successful,
False if there were no more pages.
r   NTrE   Ú_pushéÿÿÿÿÚ_popÚ_downÚstackrR   rL   éŒ   F)rž   ry   ÚreadÚ_dtabler~   Úto_exceptionr6   ÚappendÚpopÚlenÚgetattrÚvr^   r|   Ú	post_postr…   )r   Ú
down_stackr_   Únames       r   rŒ   Ú	Dvi._read:  s  € ð. �Sˆ
ØˆÔØØ—9‘9—>‘> !Ó$ QÑ'ˆDØ�L‰L˜Ò˜tÔ*Ø×!×!Ø×(Ñ(×5Ñ5Ó7Ð7Ø—<‘< Ñ%×.Ñ.ˆDØ�w‹Ø×!Ñ! *¨R¡.Õ1Ø˜“Ø—‘Õ Ø˜“Ø˜2“ !Ñ#“Ø× Ñ Ñ(ÜœG D¨'°2Ó6Ó7¸1Ó<Ø" 2™¨!Ó+Ø#'§6¡6�Ô Ø�s‹{ØØ�z‰zœY×0Ñ0Ò0Ø—
‘
”Øò) r   c                 ó^   • [         R                  U R                  R                  U5      SUS9$ )zg
Read and return a big-endian integer *nbytes* long.
Signedness is determined by the *signed* keyword.
ÚbigrF   )ÚintÚ
from_bytesry   r´   )r   ÚnbytesrG   s      r   rI   ÚDvi._read_argi  s&   € ô
 �~‰~˜dŸi™iŸn™n¨VÓ4°eÀFˆ~ÐKÐKr   r   é   )rc   rk   r^   c                 ó
  • U R                  U5        [        U R                  U R                     [        R
                  5      (       a  g U =R                  U R                  U R                     R                  U5      -  sl        g r>   ©Ú_put_char_realrœ   r{   r`   r	   Ú_ExceptionInfor¦   Ú	_width_of©r   Úchars     r   Ú_set_char_immediateÚDvi._set_char_immediatep  óY   € à×Ñ˜DÔ!Ü�d—j‘j §¡Ñ(¬%×*>Ñ*>×?Ñ?ØØ�Š�$—*‘*˜TŸV™VÑ$×.Ñ.¨tÓ4Ñ4Žr   é€   éƒ   )rZ   )rc   rk   r^   rj   c                 ó
  • U R                  U5        [        U R                  U R                     [        R
                  5      (       a  g U =R                  U R                  U R                     R                  U5      -  sl        g r>   rÈ   rÌ   s     r   Ú	_set_charÚDvi._set_charw  rÐ   r   é„   )rV   rV   )r^   rj   c                 óP   • U R                  X5        U =R                  U-  sl        g r>   )Ú_put_rule_realr¦   ©r   ÚaÚbs      r   Ú	_set_ruleÚDvi._set_rule~  s   € à×Ñ˜AÔ!Ø�Š�!‰Žr   é…   éˆ   c                 ó&   • U R                  U5        g r>   )rÉ   rÌ   s     r   Ú	_put_charÚDvi._put_charƒ  s   € à×Ñ˜DÕ!r   c                 ó  • U R                   U R                     n[        U[        R                  5      (       a  X l        g UR                  cK  U R                  R                  [        U R                  U R                  X!UR                  U5      5      5        g UR                  nUR                  U   R                   H¦  u  pEpgn[        [        X6R                  5      UR                   UR"                  UR                  S9n	U R                  R                  [        U R                  [        XC5      -   U R                  [        XS5      -   X—U	R                  U5      5      5        M¨     U R$                  R'                  UR                  U   R$                   VVV
Vs/ s HR  u  pEp«[)        U R                  [        XC5      -   U R                  [        XS5      -   [        X£5      [        X³5      5      PMT     snn
nn5        g s  snn
nnf )N©ÚscaleÚtfmr   Úvf)r{   r`   rœ   r	   rÊ   r~   Ú_vfr•   r·   r   r¦   r»   rË   Ú_scaleÚDviFontÚ_mul2012Ú_tfmr   r–   Úextendr   )r   rÍ   r   rå   rh   r¥   r`   r©   r§   ÚnewfrÚ   rÛ   s               r   rÉ   ÚDvi._put_char_real‡  sŽ  € Ø�z‰z˜$Ÿ&™&Ñ!ˆÜ�dœE×0Ñ0×1Ñ1Ø!%ÕØ�X‰XÑØ�I‰I×ÑœT $§&¡&¨$¯&©&°$Ø"&§.¡.°Ó"6ó8õ 9ð —K‘KˆEØ!%§¡¨$¡×!4Ô!4‘��a˜AÜ¤X¨e·X±XÓ%>Ø#$§6¡6°1·9±9ÀÇÁñH�à—	‘	× Ñ ¤ d§f¡f¬x¸Ó/AÑ&AØ&*§f¡f¬x¸Ó/AÑ&AØ&*¨t¯~©~¸aÓ/@ó"Bö Cñ "5ð �J‰J×Ñð 26·±¸$±×1EÒ1EöGò 2F¡: 1¨ô  # 4§6¡6¬H°QÓ,>Ñ#>Ø#'§6¡6¬H°QÓ,>Ñ#>Ü#+¨AÓ#5´xÀÓ7Iö Kñ 2FôGõ Hùõ Gs   ÆAG>é‰   c                 ó&   • U R                  X5        g r>   )rØ   rÙ   s      r   Ú	_put_ruleÚDvi._put_rule›  s   € à×Ñ˜AÕ!r   c                 ó”   • US:”  aB  US:”  a;  U R                   R                  [        U R                  U R                  X5      5        g g g ©Nr   )r–   r·   r   r¦   r»   rÙ   s      r   rØ   ÚDvi._put_rule_realŸ  s9   € Øˆq‹5�Q˜“UØ�J‰J×Ñœc $§&¡&¨$¯&©&°!Ó7Õ8ð ˆ5r   éŠ   c                 ó   • g r>   r5   ©r   Ú_s     r   Ú_nopÚDvi._nop£  s   € àr   é‹   )rV   rV   rV   rV   rV   rV   rV   rV   rV   rV   rV   c                 ó¬   • [         R                  U l        S=U l        =U l        =U l        =U l        =U l        U l        / U l	        / U l
        / U l        g rõ   )r|   Úinpager^   r¦   r»   r§   rh   r¥   Úzr²   r•   r–   )r   Úc0Úc1Úc2Úc3Úc4Úc5Úc6Úc7Úc8Úc9Úps               r   Ú_bopÚDvi._bop§  sN   € ä×%Ñ%ˆŒ
Ø>?Ð?ˆŒÐ?�”Ð?˜$œ&Ð? 4¤6Ð?¨D¬F°T´VØˆŒ
ØˆŒ	Øˆ�
r   r³   )r^   c                 óJ   • [         R                  U l        U ?U ?U ?U ?U ?U ?U ?	g r>   )
r|   Úouterr^   r¦   r»   r§   rh   r¥   r   r²   rù   s     r   Ú_eopÚDvi._eop¯  s*   € ä—_‘_ˆŒ
ØˆF�D�F˜D˜F D F¨D¨F°D°F¸D¹Jr   é�   c                 ó¾   • U R                   R                  U R                  U R                  U R                  U R
                  U R                  U R                  45        g r>   )r²   r·   r¦   r»   r§   rh   r¥   r   rù   s     r   r®   Ú	Dvi._push´  s9   € à�
‰
×Ñ˜4Ÿ6™6 4§6¡6¨4¯6©6°4·6±6¸4¿6¹6À4Ç6Á6ÐJÕKr   éŽ   c                 ó‚   • U R                   R                  5       u  U l        U l        U l        U l        U l        U l        g r>   )r²   r¸   r¦   r»   r§   rh   r¥   r   rù   s     r   r°   ÚDvi._pop¸  s+   € à9=¿¹¿¹Ó9IÑ6ˆŒ�”˜œ ¤¨¬°µr   é�   é’   )rX   c                 ó.   • U =R                   U-  sl         g r>   )r¦   )r   rÛ   s     r   Ú_rightÚ
Dvi._right¼  ó   € à�Š�!‰Žr   é“   é—   )rW   c                 óT   • Ub  Xl         U =R                  U R                   -  sl        g r>   )r§   r¦   )r   Únew_ws     r   Ú_right_wÚDvi._right_wÀ  ó   € àÑØŒFØ�Š�$—&‘&ÑŽr   é˜   éœ   c                 óT   • Ub  Xl         U =R                  U R                   -  sl        g r>   )rh   r¦   )r   Únew_xs     r   Ú_right_xÚDvi._right_xÆ  r$  r   é�   é    c                 ó.   • U =R                   U-  sl         g r>   )r»   )r   rÚ   s     r   r±   Ú	Dvi._downÌ  r  r   é¡   é¥   c                 óT   • Ub  Xl         U =R                  U R                   -  sl        g r>   )r¥   r»   )r   Únew_ys     r   Ú_down_yÚDvi._down_yÐ  r$  r   é¦   éª   c                 óT   • Ub  Xl         U =R                  U R                   -  sl        g r>   )r   r»   )r   Únew_zs     r   Ú_down_zÚDvi._down_zÖ  r$  r   é«   éê   c                 ó   • Xl         g r>   ©r`   )r   Úks     r   Ú_fnt_num_immediateÚDvi._fnt_num_immediateÜ  s   € à�r   éë   éî   c                 ó   • Xl         g r>   r>  )r   Únew_fs     r   Ú_fnt_numÚDvi._fnt_numà  s   € à�r   éï   éò   )rY   )rc   rk   rj   c                 óì   • U R                   R                  U5      n[        R                  SSR	                  U Vs/ s H#  nSUs=::  a  S:  a  O  O[        U5      OSU-  PM%     sn5      5        g s  snf )Nz!Dvi._xxx: encountered special: %sÚ é    rÆ   z<%02x>)ry   r´   rv   rw   ÚjoinÚchr)r   ÚdatalenÚspecialÚchs       r   Ú_xxxÚDvi._xxxä  sf   € à—)‘)—.‘. Ó)ˆÜ�
‰
Ø/Ø�G‰GÙ&ó(Ú&˜ð !# b¥¨3¦”S˜”W°H¸r±MÒAÙ&ñ(ó )õ	*ùò(s   »*A1éó   éö   )rZ   rU   rU   rU   rT   rT   c                 ó*   • U R                  XX4XV5        g r>   )Ú_fnt_def_real)r   r?  ÚcÚsrª   rÚ   Úls          r   Ú_fnt_defÚDvi._fnt_defì  s   € à×Ñ˜1  qÕ,r   c                 óÔ  • U R                   R                  XV-   5      nXv* S  R                  S5      n [        U5      n	US:w  a-  U	R                  S:w  a  X)R                  :w  a  [        SU 35      e [        U5      n[        X9X{S9U R                  U'   g ! [         a6  n
[
        R                  R                  U
5      U R                  U'    S n
A
g S n
A
ff = f! [         a    S n Nif = f)Nr   r   ztfm checksum mismatch: rä   )ry   r´   r"   Ú_tfmfileÚFileNotFoundErrorr	   rÊ   Úfrom_exceptionr{   Úchecksumr   Ú_vffilerê   )r   r?  rX  rY  rª   rÚ   rZ  ÚnÚfontnameræ   Úexcrç   s               r   rW  ÚDvi._fnt_def_realð  sØ   € Ø�I‰I�N‰N˜1™5Ó!ˆØ�R�S�6—=‘= Ó)ˆð		Ü˜8Ó$ˆCð �‹6�c—l‘l aÓ'¨A·±Ó,=ÜÐ6°q°cÐ:Ó;Ð;ð	Ü˜Ó"ˆBô   a¸!ÑCˆ�
‰
�1Šøô !ó 	ô "×0Ñ0×?Ñ?ÀÓDˆD�J‰J�q‰MÜûð	ûô !ó 	ØŠBð	ús)   ³B Á2C Â
CÂ,CÃCÃC'Ã&C'é÷   )rT   rU   rU   rU   rT   c                 óÜ   • U R                   R                  U5        US:w  a  [        SU 35      eUS:w  d  US:w  a  [        S5      eUS:w  a  [        S5      e[        R                  U l        g )Né   zUnknown dvi format iÀ’ƒi  ;zNonstandard units in dvi fileéè  z%Nonstandard magnification in dvi file)ry   r´   r   r|   r  r^   )r   ri   ÚnumÚdenÚmagr?  s         r   Ú_preÚDvi._pre  sh   € à�	‰	�‰�qÔØ�‹6ÜÐ2°1°#Ð6Ó7Ð7Ø�(‹?˜c \Ó1ÜÐ<Ó=Ð=ð �$‹;ÜÐDÓEÐEô —_‘_ˆ�
r   éø   c                 ó.   • [         R                  U l        g r>   )r|   r¼   r^   rù   s     r   Ú_postÚ	Dvi._post  s   € ä×(Ñ(ˆ�
r   éù   c                 ó   • [         er>   )ÚNotImplementedErrorrù   s     r   Ú
_post_postÚDvi._post_post  s   € ä!Ð!r   éú   éÿ   )rc   rk   c                 ó$   • [        SSU-    35      e)Nzunknown command: byte ry  )r   )r   Úoffsets     r   Ú
_malformedÚDvi._malformed!  s   € äÐ1°#¸±,°Ð@ÓAÐAr   )rž   r~   r–   rz   r`   ry   r{   r¦   r²   r^   r•   r»   r§   rh   r¥   r   )F)0r6   r7   r8   r9   r:   rµ   r   ro   r   r‚   r‰   rŽ   r…   r�   rŒ   rI   r|   rÿ   rÎ   rÔ   rÜ   rá   rÉ   rò   rØ   rû   r  r  r  r®   r°   r  r"  r)  r±   r3  r9  r@  rF  rR  r[  rW  r}   rn  rr  rw  r}  r<   r5   r   r   rq   rq   Ê   s”  † ñð ˆf�s‰l€GÙ˜	 7Ó+€Iò"òòò!ò&ò
+@òZ-ô^Lñ �1˜# Y×%5Ñ%5Ñ6ñ5ó 7ð5ñ �3˜C y×'7Ñ'7¸jÑIñ5ó Jð5ñ ˆs˜)×*Ñ*°Ñ>ñó ?ðñ �3˜C y×'7Ñ'7¸jÑIñ"ó Jð"òHñ( ˆs˜)×*Ñ*°Ñ>ñ"ó ?ð"ò9ñ ˆsƒ^ñó ðñ ˆs˜)Ÿ/™/°
Ñ;ñó <ðñ ˆs˜)×*Ñ*Ñ+ñGó ,ðGñ ˆs˜)×*Ñ*Ñ+ñLó ,ðLñ ˆs˜)×*Ñ*Ñ+ñJó ,ðJñ �3˜C y×'7Ñ'7¸jÑIñó Jðñ �3˜C y×'7Ñ'7¸iÑHñó Iðñ
 �3˜C y×'7Ñ'7¸iÑHñó Iðñ
 �3˜C y×'7Ñ'7¸jÑIñó Jðñ �3˜C y×'7Ñ'7¸iÑHñó Iðñ
 �3˜C y×'7Ñ'7¸iÑHñó Iðñ
 �3˜C y×'7Ñ'7Ñ8ñó 9ðñ �3˜C y×'7Ñ'7¸jÑIñó Jðñ �3˜C jÑ1ñ*ó 2ð*ñ �3˜CÐ&MÑNñ-ó Oð-òDñ* ˆs˜)Ÿ-™-Ð.LÑMñ%ó Nð%ñ" ˆs˜)Ÿ/™/Ñ*ñ)ó +ð)ñ
 ˆsƒ^ñ"ó ð"ñ �3˜CÑ ñBó !óBr   rq   c                   ó@   • \ rS rSrSrSrS rS rS rS r	S r
S	 rS
rg)rê   i&  a  
Encapsulation of a font that a DVI file can refer to.

This class holds a font's texname and size, supports comparison,
and knows the widths of glyphs in the same units as the AFM file.
There are also internal attributes (for use by dviread.py) that
are *not* used for comparison.

The size is in Adobe points (converted from TeX points).

Parameters
----------
scale : float
    Factor by which the font is scaled from its natural size.
tfm : Tfm
    TeX font metrics for this font
texname : bytes
   Name of the font as used internally by TeX and friends, as an ASCII
   bytestring.  This is usually very different from any external font
   names; `PsfontsMap` can be used to find the external name of the font.
vf : Vf
   A TeX "virtual font" file, or None if this font is not virtual.

Attributes
----------
texname : bytes
size : float
   Size of the font in Adobe points, converted from the slightly
   smaller TeX points.
widths : list
   Widths of glyphs in glyph-space units, typically 1/1000ths of
   the point size.

)r   r'   Úwidthsré   rè   rì   c                 ó\  • [         R                  " [        US9  Xl        X l        X0l        X@l        US-  U l         [        UR                  5      S-   n[        U5       Vs/ s H%  nSUR                  R                  US5      -  S-	  PM'     snU l        g ! [         a    Sn NPf = fs  snf )N)r   g]Ÿeáï>rE   r   rj  é   )r   Úcheck_isinstanceÚbytesré   rì   r   rè   r'   rk   r—   r   rg   Úgetr€  )r   rå   ræ   r   rç   ÚncharsrÍ   s          r   r   ÚDviFont.__init__K  s¢   € Ü×Òœe¨WÒ5ØŒØŒ	ØŒØŒØÐ3Ñ4ˆŒ	ð	Ü˜Ÿ™“^ aÑ'ˆFô $)¨¤=ó2Ú#0˜4ð ˜SŸY™YŸ]™]¨4°Ó3Ñ3¸Ô:Ù#0ñ2ˆ�øô ó 	ØŠFð	üò2s   ½B Á",B)ÂB&Â%B&c                 ó®   • [        U 5      [        U5      L =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r>   )Útyper   r'   ©r   Úothers     r   Ú__eq__ÚDviFont.__eq__Y  sD   € Ü�T“
œd 5›kÐ)÷ NØ—L‘L E§M¡MÑ1÷NØ6:·i±iÀ5Ç:Á:Ñ6Mð	Or   c                 ó.   • U R                  U5      (       + $ r>   )rŒ  rŠ  s     r   Ú__ne__ÚDviFont.__ne__]  s   € Ø—;‘;˜uÓ%Ô%Ð%r   c                 óN   • S[        U 5      R                   SU R                   S3$ )NÚ<z: Ú>)r‰  r6   r   r   s    r   Ú__repr__ÚDviFont.__repr__`  s&   € Ø”4˜“:×&Ñ&Ð' r¨$¯,©,¨°qÐ9Ð9r   c                 óÀ   • U R                   R                  R                  US5      nUb  [        X R                  5      $ [
        R                  SXR                  5        g)zWidth of char in dvi units.Nz No width for char %d in font %s.r   )rì   r—   r…  rë   ré   rv   rw   r   )r   rÍ   r—   s      r   rË   ÚDviFont._width_ofc  sG   € à—	‘	—‘×#Ñ# D¨$Ó/ˆØÑÜ˜E§;¡;Ó/Ð/Ü�
‰
Ð5°t¿\¹\ÔJØr   c                 ó¸  • / nU R                   R                  S4U R                   R                  S44 Hr  u  p4UR                  US5      nUc4  [        R                  SXAU R                  5        UR                  S5        MN  UR                  [        XPR                  5      5        Mt     [        R                  " SU R                  5      (       a  US:X  a  SUS'   U$ )z&Height and depth of char in dvi units.r˜   ÚdepthNzNo %s for char %d in font %sr   s	   ^cmsy\d+$r¯   )rì   r˜   r™  r…  rv   rw   r   r·   rë   ré   ÚreÚmatch)r   rÍ   ÚresultÚmetricr¾   Úvalues         r   r�   ÚDviFont._height_depth_ofk  s°   € àˆØ"Ÿi™i×.Ñ.°Ð9Ø"Ÿi™iŸo™o¨wÐ7ó9‰LˆFà—J‘J˜t TÓ*ˆEØ‰}Ü—
‘
Ð9Ø t§|¡|ô5à—‘˜aÖ à—‘œh u¯k©kÓ:Ö;ñ9ô �8Š8�M 4§<¡<×0Ñ0°T¸Q³YØˆF�2‰JØˆr   )ré   rì   rè   r'   r   r€  N)r6   r7   r8   r9   r:   Ú	__slots__r   rŒ  r�  r”  rË   r�   r<   r5   r   r   rê   rê   &  s/   † ñ!ðD G€Iò2òOò&ò:òõr   rê   c                   óJ   ^ • \ rS rSrSrU 4S jrS rS rS rS r	S r
S	rU =r$ )
ÚVfi�  a¶  
A virtual font (\*.vf file) containing subroutines for dvi files.

Parameters
----------
filename : str or path-like

Notes
-----
The virtual font format is a derivative of dvi:
http://mirrors.ctan.org/info/knuth/virtual-fonts
This class reuses some of the machinery of `Dvi`
but replaces the `_read` loop and dispatch mechanism.

Examples
--------
::

    vf = Vf(filename)
    glyph = vf[code]
    glyph.text, glyph.boxes, glyph.width
c                 ó®   >• [         TU ]  US5         S U l        0 U l        U R	                  5         U R                  5         g ! U R                  5         f = frõ   )Úsuperr   Ú_first_fontÚ_charsrŒ   r…   )r   r   Ú	__class__s     €r   r   ÚVf.__init__™  sB   ø€ Ü‰Ñ˜ 1Ô%ð	Ø#ˆDÔØˆDŒKØ�J‰JŒLà�J‰J�LøˆD�J‰J�Lús   “A ÁAc                 ó    • U R                   U   $ r>   )r¦  )r   Úcodes     r   Ú__getitem__ÚVf.__getitem__¢  s   € Ø�{‰{˜4Ñ Ð r   c                 ó*  • S=pS=p4 U R                   R                  S5      S   nU R                  [        R                  L a  U R                   R                  5       S-
  nXb:X  a  U R                  X5        S=n=pOFXb:”  a  [        S5      eUS;   d  US:¼  a  [        SU S35      e[        R                  U   " X5        M»  US	:  aL  UnU R                  S5      nU R                  S
5      nU R                  U5      n[        R                  U l        GO~US	:X  aF  U R                  S5      nU R                  S5      nU R                  S5      nU R                  U5        GO2SUs=::  a  S::  a—  O  O”U R                  US	-
  US:H  5      nU R                  S5      nU R                  S5      n	U R                  S5      n
U R                  S5      nU R                  S5      nU R                  XxXšX¼5        U R                  c  Xpl        OŽUS:X  as  U R                  S5      nU R                  S5      nU R                   R                  U5      nU R                  S5      nU R                  S5      nU R                  XÞUU5        OUS:X  a  g[        SU 35      eGM�  )r­   NrE   r   z!Packet length mismatch in vf file)rý   r³   rT  zInappropriate opcode z in vf filerI  rR   rL   rU  rg  rp  zUnknown vf opcode )ry   r´   r^   r|   rÿ   ÚtellÚ_finalize_packetr   rq   rµ   rI   Ú_init_packetrW  r¥  rn  )r   Úpacket_charÚpacket_endsÚ
packet_lenÚpacket_widthr_   Úbyte_atr?  rX  rY  rª   rÚ   rZ  ri   rh   ÚcsÚdss                    r   rŒ   ÚVf._read¥  s[  € ð
 %)Ð(ˆØ$(Ð(ˆ
ØØ—9‘9—>‘> !Ó$ QÑ'ˆDà�z‰zœY×-Ñ-Ò-ØŸ)™)Ÿ.™.Ó*¨1Ñ,�ØÓ)Ø×)Ñ)¨+ÔDØ>BÐB�JÐB ¨|àÓ*Ü$Ð%HÓIÐIà˜zÓ)¨T°S«[Ü(Ð+@ÀÀÀkÐ)RÓSÐSÜ—K‘K Ò% dÔ1Ùð �c‹zØ!�
Ø"Ÿn™n¨QÓ/�Ø#Ÿ~™~¨aÓ0�Ø"×/Ñ/°Ó5�Ü&×-Ñ-�–
Ø˜“Ø!Ÿ^™^¨AÓ.�
Ø"Ÿn™n¨QÓ/�Ø#Ÿ~™~¨aÓ0�Ø×!Ñ! *Ö-Ø˜Õ# Ö#Ø—N‘N 4¨#¡:¨t°s©{Ó;�Ø—N‘N 1Ó%�Ø—N‘N 1Ó%�Ø—N‘N 1Ó%�Ø—N‘N 1Ó%�Ø—N‘N 1Ó%�Ø×"Ñ" 1¨¨qÔ4Ø×#Ñ#Ñ+Ø'(Ô$øØ˜“Ø—N‘N 1Ó%�Ø—N‘N 1Ó%�Ø—I‘I—N‘N 1Ó%�Ø—^‘^ AÓ&�Ø—^‘^ AÓ&�Ø—	‘	˜!  BÕ'Ø˜“Øä Ð#5°d°VÐ!<Ó=Ð=òc r   c                 ó<  • U R                   [        R                  :w  a  [        S5      eS=U l        =U l        =U l        =U l        =U l        U l	        / U l
        / U l        / U l        U R                  U l        S U l        U R                   R#                  5       U-   $ )NzMisplaced packet in vf filer   )r^   r|   r  r   r¦   r»   r§   rh   r¥   r   r²   r•   r–   r¥  r`   r~   ry   r®  )r   Úpls     r   r°  ÚVf._init_packetß  sˆ   € Ø�:‰:œŸ™Ó(ÜÐ:Ó;Ð;Ø>?Ð?ˆŒÐ?�”Ð?˜$œ&Ð? 4¤6Ð?¨D¬F°T´VØˆŒ
ØˆŒ	ØˆŒ
Ø×!Ñ!ˆŒØ!ˆÔØ�y‰y�~‰~Ó "Ñ$Ð$r   c                 ó¬   • U R                   (       d.  [        U R                  U R                  US S S9U R                  U'   [
        R                  U l        g )Nr”   )r~   r   r•   r–   r¦  r|   r  r^   )r   r±  r´  s      r   r¯  ÚVf._finalize_packetê  s?   € Ø×!×!Ü'+Ø—Y‘Y d§j¡j¸Ø Tñ(+ˆD�K‰K˜Ñ$ô —_‘_ˆ�
r   c                 óò   • U R                   [        R                  La  [        S5      eUS:w  a  [        SU 35      e[	        U5      (       a  [
        R                  SU5        [        R                  U l         g )Nz pre command in middle of vf filerr   zUnknown vf format zvf file comment: %s)r^   r|   r}   r   r¹   rv   rw   r  )r   ri   rh   r¶  r·  s        r   rn  ÚVf._preñ  s[   € Ø�:‰:œYŸ]™]Ò*ÜÐ?Ó@Ð@Ø�‹8ÜÐ1°!°Ð5Ó6Ð6Üˆq�6‰6Ü�J‰JÐ,¨aÔ0Ü—_‘_ˆ�
r   )r¦  r¥  r~   r–   r`   r¦   r²   r^   r•   r»   r§   rh   r¥   r   )r6   r7   r8   r9   r:   r   r«  rŒ   r°  r¯  rn  r<   Ú__classcell__)r§  s   @r   r¢  r¢  �  s,   ø† ñõ.ò!ò8>òt	%ò%÷%ð %r   r¢  c                 ó   • X-  S-	  $ )z1Multiply two numbers in 20.12 fixed point format.r‚  r5   )Únum1Únum2s     r   rë   rë   ü  s   € ð ‰I˜"ÑÐr   c                   ó"   • \ rS rSrSrSrS rSrg)ÚTfmi  aÛ  
A TeX Font Metric file.

This implementation covers only the bare minimum needed by the Dvi class.

Parameters
----------
filename : str or path-like

Attributes
----------
checksum : int
   Used for verifying against the dvi file.
design_size : int
   Design size of the font (unknown units)
width, height, depth : dict
   Dimensions of each character, need to be scaled by the factor
   specified in the dvi file. These are dicts because indexing may
   not start from 0.
)ra  Údesign_sizer—   r˜   r™  c           
      óÌ  • [         R                  SU5        [        US5       nUR                  S5      n[        R
                  " SUSS 5      u  pEpgp‰[         R                  SXEXgX‰5        UR                  SU-  5      n
[        R
                  " S	U
S S
 5      u  U l        U l        UR                  SXe-
  S-   -  5      n[        R
                  " SU S3UR                  SU-  5      5      n[        R
                  " SU S3UR                  SU-  5      5      n[        R
                  " SU	 S3UR                  SU	-  5      5      nS S S 5        0 U l        0 U l	        0 U l
        [        [        WWS-   5      5       HU  u  nnWSU-     nUSU-  S-      nWU   U R                  U'   WUS-	     U R                  U'   WUS-     U R                  U'   MW     g ! , (       d  f       N•= f)Nzopening tfm file %sru   é   z!6Hri  é   z(lh=%d, bc=%d, ec=%d, nw=%d, nh=%d, nd=%drL   z!2Ié   rE   Ú!ri   é   )rv   rw   rx   r´   ÚstructÚunpackra  rÆ  r—   r˜   r™  Ú	enumeraterg   )r   r   ry   Úheader1ÚlhÚbcÚecÚnwÚnhÚndÚheader2Ú	char_infor€  ÚheightsÚdepthsÚidxrÍ   Úbyte0Úbyte1s                      r   r   ÚTfm.__init__  s´  € Ü�
‰
Ð(¨(Ô3Ü�(˜DÔ! TØ—i‘i “mˆGÜ%+§]¢]°5¸'À!ÀB¸-Ó%HÑ"ˆB�B˜BÜ�J‰JÐAØ˜r rô/à—i‘i  "¡“oˆGÜ.4¯mªm¸EÀ7È2ÈAÀ;Ó.OÑ+ˆDŒM˜4Ô+àŸ	™	 ! R¡U¨1¡W¡+Ó.ˆIÜ—]’] Q r d¨! 9¨d¯i©i¸¸"¹«oÓ>ˆFÜ—m’m a¨ t¨1 I¨t¯y©y¸¸2¹«Ó?ˆGÜ—]’] Q r d¨! 9¨d¯i©i¸¸"¹«oÓ>ˆF÷ "ð ˆŒ
ØˆŒØˆŒ
Ü"¤5¨¨R°©T£?Ö3‰IˆC�Ø˜a ™eÑ$ˆEØ˜a ™e A™gÑ&ˆEØ% e™}ˆD�J‰J�tÑØ '¨°©
Ñ 3ˆD�K‰K˜ÑØ% e¨c¡kÑ2ˆD�J‰J�tÓò 4÷ "Õ!ús   £D#GÇ
G#)ra  r™  rÆ  r˜   r—   N)r6   r7   r8   r9   r:   r   r   r<   r5   r   r   rÅ  rÅ    s   † ñð( H€Iõ3r   rÅ  ÚPsFontz(texname psname effects encoding filenamec                   ó8   • \ rS rSrSrSr\S 5       rS rS r	Sr
g)	r   i5  aå  
A psfonts.map formatted file, mapping TeX fonts to PS fonts.

Parameters
----------
filename : str or path-like

Notes
-----
For historical reasons, TeX knows many Type-1 fonts by different
names than the outside world. (For one thing, the names have to
fit in eight characters.) Also, TeX's native fonts are not Type-1
but Metafont, which is nontrivial to convert to PostScript except
as a bitmap. While high-quality conversions to Type-1 format exist
and are shipped with modern TeX distributions, we need to know
which Type-1 fonts are the counterparts of which native fonts. For
these reasons a mapping is needed from internal font names to font
file names.

A texmf tree typically includes mapping files called e.g.
:file:`psfonts.map`, :file:`pdftex.map`, or :file:`dvipdfm.map`.
The file :file:`psfonts.map` is used by :program:`dvips`,
:file:`pdftex.map` by :program:`pdfTeX`, and :file:`dvipdfm.map`
by :program:`dvipdfm`. :file:`psfonts.map` might avoid embedding
the 35 PostScript fonts (i.e., have no filename for them, as in
the Times-Bold example above), while the pdf-related files perhaps
only avoid the "Base 14" pdf fonts. But the user may have
configured these files differently.

Examples
--------
>>> map = PsfontsMap(find_tex_file('pdftex.map'))
>>> entry = map[b'ptmbo8r']
>>> entry.texname
b'ptmbo8r'
>>> entry.psname
b'Times-Bold'
>>> entry.encoding
'/usr/local/texlive/2008/texmf-dist/fonts/enc/dvips/base/8r.enc'
>>> entry.effects
{'slant': 0.16700000000000001}
>>> entry.filename
)Ú	_filenameÚ	_unparsedÚ_parsedc                 ó`  • [         R                  U 5      n[        R                  " U5      Ul        [        US5       n0 Ul        U HC  nUR                  SS5      S   nUR                  R                  U/ 5      R                  U5        ME     S S S 5        0 Ul
        U$ ! , (       d  f       N= f)Nru   ó    rE   r   )ÚobjectÚ__new__ÚosÚfsdecoderá  rx   râ  ÚsplitÚ
setdefaultr·   rã  )Úclsr   r   ry   ÚlineÚtfmnames         r   rç  ÚPsfontsMap.__new__f  s�   € ä�~‰~˜cÓ"ˆÜŸš XÓ.ˆŒô
 �(˜DÔ! TØˆDŒNÛ�ØŸ*™* T¨1Ó-¨aÑ0�Ø—‘×)Ñ)¨'°2Ó6×=Ñ=¸dÖCñ ÷ "ð
 ˆŒØˆ÷ "Õ!ús   ½ABÂ
B-c                 óZ  • [        U[        5      (       d   eXR                  ;   a:  U R                  R                  U5       H  nU R	                  U5      (       d  M    O    U R
                  U   $ ! [         a/    [        SUR                  S5      < SU R                  < S35      S ef = f)NzWAn associated PostScript font (required by Matplotlib) could not be found for TeX font r   z in zo; this problem can often be solved by installing a suitable PostScript font package in your TeX package manager)
rœ   r„  râ  r¸   Ú_parse_and_cache_linerã  ÚKeyErrorÚLookupErrorr"   rá  )r   r   rí  s      r   r«  ÚPsfontsMap.__getitem__v  s¯   € Ü˜'¤5×)Ñ)Ð)Ð)Ø—n‘nÓ$ØŸ™×*Ñ*¨7Ö3�Ø×-Ñ-¨d×3Ó3Ùñ 4ð	.Ø—<‘< Ñ(Ð(øÜó 	.Üð3Ø3:·>±>À'Ó3JÑ2Mð NØ—n‘nÑ'ð ("ð#ó$ð
 *.ð.ð	.ús   Á"A1 Á19B*c           	      óØ  • U(       a  UR                  S5      (       a  gS=n=n=n=pVS=n=p‰[        R                  " SU5      n
U
 Hß  nUR                  5       u  pÍU(       a¸  UR                  S5      (       a  USS nM9  UR                  S5      (       a  USS nMV  UR                  S5      (       aX  US	S =(       d,    [	        [        S[	        U
5      R                  5       5      5      nUR                  S
5      (       a  UnM¾  UnSnMÄ  Uc  UnMË  Uc  UnMÒ  MÔ  U(       d  MÝ  UnMá     0 nU(       a`  [        UR                  5       5      nU HA  nUS:X  a  [        [	        U5      5      US'   M"  US:X  d  M*  [        [	        U5      5      US'   MC     Ub2  UR                  S5      (       a  Sn	OUR                  S5      (       d  SnOUb  SnU	(       a  U(       a  Uc  gU(       d  SU;   d  SU;   a  g[        UR                  SS5      5      S	:”  a  g[        UR                  SS5      5      S:”  a  gUc  UnUb  [        U5      nUb  [        U5      n[        X#UXVS9U R                  U'   g)a•  
Parse a line in the font mapping file.

The format is (partially) documented at
http://mirrors.ctan.org/systems/doc/pdftex/manual/pdftex-a.pdf
https://tug.org/texinfohtml/dvips.html#psfonts_002emap
Each line can have the following fields:

- tfmname (first, only required field),
- psname (defaults to tfmname, must come immediately after tfmname if
  present),
- fontflags (integer, must come immediately after psname if present,
  ignored by us),
- special (SlantFont and ExtendFont, only field that is double-quoted),
- fontfile, encodingfile (optional, prefixed by <, <<, or <[; << always
  precedes a font, <[ always precedes an encoding, < can precede either
  but then an encoding file must have extension .enc; < and << also
  request different font subsetting behaviors but we ignore that; < can
  be separated from the filename by whitespace).

special, fontfile, and encodingfile can appear in any order.
)rå  ó   %ó   *ó   ;ó   #NFs   "([^"]*)(?:"|$)|(\S+)s   <<ri  s   <[ó   <rE   s   .encTs	   SlantFontÚslants
   ExtendFontrí   )s   .ttfs   .ttcs   .otfr   )r   r!   r+   r/   r   )Ú
startswithrš  ÚfinditerÚgroupsÚnextÚfilterÚendswithÚreversedrê  ÚfloatÚabsr…  r   rß  rã  )r   rí  rî  ÚbasenamerP  ÚencodingfileÚfontfileÚis_subsettedÚis_t1Úis_truetypeÚmatchesr›  ÚquotedÚunquotedÚwordr+   Úwordss                    r   rñ  Ú PsfontsMap._parse_and_cache_line†  se  € ö8 �t—‘Ð'E×FÑFØØAEÐEˆÐE�(ÐE˜WÐE |Ø-2Ð2ˆÐ2�uÜ—+’+Ð7¸Ó>ˆÛˆEØ$Ÿ|™|›~ÑˆFÞØ×&Ñ& u×-Ñ-Ø'¨¨˜|’HØ×(Ñ(¨×/Ñ/Ø#+¨A¨B <’LØ×(Ñ(¨×.Ñ.ð !  ˜÷ Fä¤ t¬T°'«]×-AÑ-AÓ-CÓ DÓEð	 ð
 —}‘} W×-Ñ-Ø'+šà#'˜Ø'+šØ‘_Ø&’GØÑ%Ø'’Hñ &ç�Ø ’ñ/ ð0 ˆÞÜ˜WŸ]™]›_Ó-ˆEÛ�Ø˜<Ó'Ü',¬T°%«[Ó'9�G˜GÓ$Ø˜]Õ*Ü(-¬d°5«kÓ(:�G˜HÓ%ñ	 ð ÑØ× Ñ Ð!3×4Ñ4Ø"‘Ø×&Ñ& w×/Ñ/Ø�øØÑ!ØˆEÞž<¨LÑ,@ØÞ˜' WÓ,°¸GÓ0CØÜˆw�{‰{˜7 AÓ&Ó'¨!Ó+ØÜˆw�{‰{˜8 QÓ'Ó(¨1Ó,ØàÑØˆHØÑ#Ü(¨Ó6ˆLØÑÜ$ XÓ.ˆHÜ &Ø°gØ!ñ!6ˆ�‰�WÑð r   )rá  rã  râ  N)r6   r7   r8   r9   r:   r   r   rç  r«  rñ  r<   r5   r   r   r   r   5  s.   † ñ*ðV 6€Ið
 ñó ðò.õ ]r   r   c                 ó„  • [         R                  " SS[        U 5      R                  SS95      n[         R                  " SU5      R                  S5      nUR                  5        Vs/ s H  o3(       d  M  UPM     nn[        S U 5       5      (       a  U Vs/ s H  o3SS PM	     sn$ [        S	U  S
35      es  snf s  snf )a  
Parse a \*.enc file referenced from a psfonts.map style file.

The format supported by this function is a tiny subset of PostScript.

Parameters
----------
path : `os.PathLike`

Returns
-------
list
    The nth entry of the list is the PostScript glyph name of the nth
    glyph.
z%.*rK  r   )r/   z(?s)\[(.*)\]rE   c              3   óB   #   • U  H  oR                  S 5      v •  M     g7f)Ú/N)rü  )Ú.0rí  s     r   Ú	<genexpr>Ú_parse_enc.<locals>.<genexpr>ù  s   é € Ð
2ªE D�?‰?˜3×ÐªEùs   ‚NzFailed to parse z as Postscript encoding)	rš  Úsubr   Ú	read_textÚsearchÚgrouprê  Úallr   )ÚpathÚno_commentsÚarrayrí  Úliness        r   r0   r0   æ  s§   € ô  —&’&˜ ¤D¨£J×$8Ñ$8À'Ð$8Ð$JÓK€KÜ�IŠI�o {Ó3×9Ñ9¸!Ó<€EØ#Ÿk™kœmÓ4šm�d«t�T™m€EÐ4Ü
Ñ
2©EÓ
2×2Ñ2Ù%*Ó+¢U˜T�Q�R“¡UÑ+Ð+äÐ+¨D¨6Ð1HÐIÓJÐJùò	 5ùâ+s   Á'
B8Á5B8ÂB=c                   ó0   • \ rS rSr\S 5       rS rS rSrg)Ú_LuatexKpsewhichiÿ  c                 óZ   • [         R                  U 5      nUR                  5       Ul        U$ r>   )ræ  rç  Ú	_new_procÚ_proc)rì  r   s     r   rç  Ú_LuatexKpsewhich.__new__   s#   € ä�~‰~˜cÓ"ˆØ—^‘^Ó%ˆŒ
Øˆr   c           	      ó¦   • [         R                  " SS[        [        R                  " S5      5      /[         R
                  [         R
                  S9$ )NÚluatexz	--luaonlyzkpsewhich.lua)ÚstdinÚstdout)Ú
subprocessÚPopenÚstrr	   Ú_get_data_pathÚPIPEr   s    r   r#  Ú_LuatexKpsewhich._new_proc  s?   € Ü×ÒØ�{Ü”×%Ò% oÓ6Ó7ð9ä—/‘/¬*¯/©/ñ;ð 	;r   c                 óÂ  • U R                   R                  5       b  U R                  5       U l         U R                   R                  R	                  [
        R                  " U5      S-   5        U R                   R                  R                  5         U R                   R                  R                  5       R                  5       nUS:X  a  S $ [
        R                  " U5      $ )Nó   
s   nil)r$  Úpollr#  r(  Úwriterè  ÚfsencodeÚflushr)  ÚreadlineÚrstripré  )r   r   Úouts      r   r  Ú_LuatexKpsewhich.search  s˜   € Ø�:‰:�?‰?ÓÑ(ØŸ™Ó)ˆDŒJØ�
‰
×Ñ×ÑœrŸ{š{¨8Ó4°uÑ<Ô=Ø�
‰
×Ñ×ÑÔ Ø�j‰j×Ñ×(Ñ(Ó*×1Ñ1Ó3ˆØ˜f“}ˆtÐ:¬"¯+ª+°cÓ*:Ð:r   )r$  N)	r6   r7   r8   r9   r   rç  r#  r  r<   r5   r   r   r!  r!  ÿ  s   † Øñó ðò
;õ;r   r!  c                 ó  • [        U [        5      (       a  U R                  SSS9n  [        5       nU(       a  UR                  U 5      nOt[        R                  S:X  a  0 [        R                  ESS0ESS.nO[        R                  " 5       SS	.n [        R                  " S
U /[        40 UD6R                  S5      nU(       a  U$ [	        SU < S35      e! [         a    Sn N´f = f! [        [        4 a    Sn N?f = f)a¥  
Find a file in the texmf tree using kpathsea_.

The kpathsea library, provided by most existing TeX distributions, both
on Unix-like systems and on Windows (MikTeX), is invoked via a long-lived
luatex process if luatex is installed, or via kpsewhich otherwise.

.. _kpathsea: https://www.tug.org/kpathsea/

Parameters
----------
filename : str or path-like

Raises
------
FileNotFoundError
    If the file is not found.
zutf-8Úreplace)ÚerrorsNÚwin32Úcommand_line_encoding)Úenvr/   Úsurrogateescape)r/   r<  Ú	kpsewhichÚ
z:Matplotlib's TeX implementation searched for a file named z* in your texmf tree, but could not find it)rœ   r„  r"   r!  r_  r  ÚsysÚplatformrè  ÚenvironÚgetfilesystemencodingr	   Ú_check_and_log_subprocessrv   r7  ÚRuntimeError)r   Úlkr  Úkwargss       r   r   r     s  € ô. �(œE×"Ñ"Ø—?‘? 7°9�?Ð=ˆðÜÓˆö 
Ø�y‰y˜Ó"‰ä�<‰<˜7Ó"ð N¤§
¡
ÐMÐ,CÀWÑMØ")ñ+‰Fô #&×";Ò";Ó"=Ø 1ñ3ˆFð	Ü×3Ò3°[À(Ð4KÜ48ñDØ<BñDç‘V˜D“\ð ö ØˆäØHØ‰lÐDðFóGð 	Gøô5 ó ØŠðûô( "¤<Ð0ó 	ØŠDð	ús#   §
C Â-C) ÃC&Ã%C&Ã)C>Ã=C>c                 ó(   • U " [        X!-   5      5      $ r>   )r   )rì  Úsuffixr   s      r   Ú	_fontfilerM  P  s   € áŒ}˜WÑ-Ó.Ó/Ð/r   z.tfmz.vfÚ__main__)ÚArgumentParserr   rz   Ú?)Únargsr‰  Údefaultr   z=== new page === (w: z, h: z, d: Ú)c                 ó   • U R                   $ r>   )r   )r•   s    r   rB   rB   g  s   € ¨D¯IªIr   zfont: zlatin-1z	scale: i   rh   r¥   r1   rN  r§   z(glyphs)Ú	)ÚsepÚ.r¦   rK  z(boxes))NN)rS   )Lr:   Úcollectionsr   ÚenumÚ	functoolsr   r   r   Úloggingrè  Úpathlibr   rš  rÍ  r*  rC  Únumpyrš   Ú
matplotlibr   r	   Ú	getLoggerr6   rv   ÚEnumr|   r   r   r   Údictrf   ro   rq   rê   r¢  rë   rÅ  rß  r   r0   r!  r   rM  r^  rb  ÚargparserO  Ú	itertoolsÚparserÚadd_argumentr  Ú
parse_argsrj   r   rz   r@   ÚfontmapÚpageÚprintr—   r˜   r™   Úgroupbyr•   r   r  r   r"   ré   rh   r¥   r1   rN  Úisprintabler–   Úboxr5   r   r   Ú<module>rm     s2  ðñõ& #Û ß /Ñ /Û Û 	Ý Û 	Û Û Û 
ã ç "à×Ò˜Ó"€ð, �IŠI�jÐ"EÓF€	ñ �&Ð;Ó<€Ù�Ð*Ó+€ô:?‰:�fÐ4Ó5ô :?ñD á á8á8á7á	Pá
Bá
Cñ Kñ#€ô*/÷dYBñ YB÷x
Xñ Xôvw%ˆô w%òv÷-3ñ -3ñ` 
�HÐHÓ	I€÷nñ nòbK÷2;ñ ;ð, ñ7Gó ð7Gðt ñ0ó ð0ñ �9˜c 6Ó*€Ù
�)˜R Ó
'€ð ˆzÔÝ'ÛáÓ€FØ
×Ñ˜
Ô#Ø
×Ñ˜ S¨u¸dÐÑCØ×ÑÓ€DÙ	ˆT�]‰]˜DŸH™HÔ	%¨Ù™]¨<Ó8Ó9ˆÜˆDÙð ØŸ™˜ E¨$¯+©+¨°e¸D¿L¹L¸>ÈðLô Mà(×0Ò0Ø—I‘IÑ5ö 7‘��eá˜˜tŸ|™|×2Ñ2°9Ó=Ñ@ð A Ø $§¡¨gÑ 5Ð6ð8ô 9á�c˜3 ¨°°ZÀTÒJÛ!�DÙ˜$Ÿ&™& $§&¡&¨$¯*©*Ù-0°·±«_×-HÑ-H×-JÑ-J™#˜dŸj™jœ/Ø"ØŸ*™*¨$ô0ó "ñ 7ð �z�zŠzÙ�c˜3  S¨"¨i¸TÒBØŸ:œ:�CÙ˜#Ÿ%™% §¡¨¯
©
°C·I±IÀ4ÔHô &ñ ÷ 
&Ð	%ð ÷ 
&Õ	%ús   Å<D0LÊ1ALÌ
L