Files
intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/dviread.cpython-312.pyc
T

484 lines
53 KiB
Plaintext
Raw Normal View History

Ë
†Rj^¦ã ó4dZddlmZddlZddlmZmZmZddlZddl Z ddl
m Z ddl Z ddl
Z
ddlZddlZddlZddlmZmZej*e«Zej0dd«Zed d
«Zed d «ZGd
dedd««Zedddddddd¬«ZdJdZGdd«Z Gdd«Z!Gdde «Z"d „Z#Gd!„d"«Z$ed#d$«Z%Gd%„d&«Z&d'„Z'Gd(„d)«Z(ed*„«Z)ed+„«Z*ee*e$d,«Z+ee*e"d-«Z,ed.k(rñdd/l-m.Z.ddl/Z/e.«Z0e0jcd0«e0jcd1d2e2d¬3«e0jg«Z4e e4jje4jl«5Z7e&e)d4««Z8e7D]nZ9e:d5e9jvd6e9jxd7e9jzd8«e/j|e9j~d9„«D\Z@ZAe:d:e@j„j‡d;«d<e@jˆd=z «e:d>d?d@dAdBdCdD¬E«eAD]jZ?e:e?jŠe?jŒe?jŽeHe?jŽ«j“«reHe?jŽ«ndFe?jvdD¬E«ŒlŒ¹e9j”sŒe:d>d?dGdBdHdIdD¬E«e9j”D]7ZKe:eKjŠeKjŒeKjxeKjvdD¬E«Œ9Œq ddd«yy#1swYyxYw)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ÚPageztext boxes height width descentÚBoxzx y height widthcóVeZdZdZdZed«Zed«Zed«Zed«Z y)ÚTextaµ
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óXttd««|jjS)
pdftex.map)Ú
PsfontsMapÚ
find_tex_fileÚfontÚtexname©Úselfs úU/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/dviread.pyÚ_get_pdftexmap_entryzText._get_pdftexmap_entryMs!Üœ-¨ Ó6°t·y±y×7HÑ7HÑcóþ|j«}|j€Mtdj|jj d«|j j d«««t|j«S)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Údecoderr)rÚpsfonts rÚ font_pathzText.font_pathPspðר ?‰?Ð ðBç$™f V§]¡]×%9Ñ%9¸'Ó%BØ%+§^¡^×%:Ñ%:¸7Ó%CóEóFð
FôF—O$rcó.|jjS)zThe font size.)rÚsizers rÚ font_sizezText.font_size[sðy‰y~‰~Ðrcó6|j«jS)
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Úeffectsrs rÚ font_effectszText.font_effects`sð×2rcó–|j«}|j"t|j«|jS|jS)
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_indexzText.glyph_name_or_indexjsDð×+ˆà—>˜5Ÿ>™>Ó*¨4¯:©:Ñ ?Ø37·:±:ð ?rN)
Ú__name__Ú
__module__Ú __qualname__Ú__doc__rÚpropertyr"r%r(r.©rrrrAs]ñ òJðñðñóððñðññ?rrzx y font glyph widthcó|S©Nr4©ÚdviÚdeltas rú<lambda>r:s˜5€rcó(|jdd¬«S©Úsigned©Ú _read_argr7s rr:r:ó˜#Ÿ-™-¨°%˜-Ó8€rcó(|jdd¬«S)Fr>r@r7s rr:r:rBrcó(|jdd¬«S)NrDTr>r@r7s rr:r:s˜#Ÿ-™-¨°$˜-Ó7€rcó0|r|j|d¬«SdS)NTr>r@r7s rr:r:sÁ˜CŸM™M¨%¸˜MÓ=€ÈD€rcó.|j|dzd¬«S)Nr=Tr>r@r7s rr:r:s˜SŸ]™]¨5°1©9¸T˜]ÓB€rcó.|j|dzd¬«Sr<r@r7s rr:r:s˜SŸ]™]¨5°1©9¸U˜]ÓC€rcó4|j|dz|dk(¬«S)Nr=ér>r@r7s rr:r:s˜SŸ]™]¨5°1©9¸eÀq¹j˜J€r)ÚrawÚu1Úu4Ús4ÚslenÚslen1Úulen1Úolen1có"ˆˆˆˆˆfd}|S)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óÂDcgc] }t|Œ
c}Št«ˆˆˆˆfd«}|‰ ‰<|Stdz«D]}‰ |J|‰ |<Œ|Scc}w)Nc óˆ|jk7r td«|gDcgc]}|||z
«Œc}¢­ŽScc}w)Nzstate precondition failed)Ústater)rÚbyteÚget_argsÚmethodÚminrVs €€€€rÚwrapperz,_dispatch.<locals>.decorate.<locals>.wrapper»sIø€àÐ  T§Z¡Z°5Ò%8Ü Ð!<Ó˜G¸XÖ!F¸¡! D¨$¨s©(Õ"3Ò!FÒ GùÒ!Fs¦?
r=)Ú _arg_mappingrÚrange)
rZÚxr\ÚirYÚargsÚmaxr[rVÚtables
` @€€€€€rÚdecoratez_dispatch.<locals>.decorate¸s‡ú€Ø-1Ö”L “OÒä ˆv‹ö Hó
ð Hð ˆ;Ø ˆE#‰Jð
ˆô˜3  Ó
#ؘQ"að
ˆùò3sˆAr4)rcr[rbrVrards````` rÚ _dispatchre˜sü€÷@ðð €OrcóeZdZdZdgdzZeee«ZdZdZdZ dZ
dZ d „Z d
Z
d[d Zed d
ej ¬«d«Zeddej d¬«d«Zedej d¬«d«Zeddej d¬«d«ZdZedej d¬«d«ZdZed «d!„«Zed"ej2d#¬«d$„«Zed%ej ¬&«d'„«Zed(ej ¬&«d)„«Zed*ej ¬&«d+„«Zed,d-ej d.¬«d/„«Zed0d1ej d2¬«d3„«Zed4d5ej d2¬«d6„«Z ed7d8ej d.¬«d9„«Z!ed:d;ej d2¬«d<„«Z"ed=d>ej d2¬«d?„«Z#ed@dAej ¬«dB„«Z$edCdDej d¬«dE„«Z%edFdGdH¬I«dJ„«Z&edKdLdM¬I«dN„«Z'dO„Z(edPejRdQ¬«dR„«Z*edSej2¬&«dT„«Z+edU«dV„«Z,edWdX¬Y«dZ„«Z-y)\ÚDviaI
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))
có¦tjd|«t|d«|_||_i|_t j|_d|_ y)
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.
zDvi: %sÚrbN)
Ú_logÚdebugÚopenÚfileÚdpiÚfontsÚ _dvistateÚprerVÚ
_missing_font)rrros rÚ__init__z Dvi.__init__ÝsAô
9˜˜ 4ÓŒ ؈ŒØˆŒ
Ü—]]ˆŒ
ØÕrcó|S)z+Context manager enter method, does nothing.r4rs rÚ __enter__z
Dvi.__enter__ësàˆ rcó$|j«y)zX
Context manager exit method, closes the underlying file if it is open.
N)Úclose)rÚetypeÚevalueÚetraces rÚ__exit__z Dvi.__exit__ïs
ð
rc#ótK|j«r$|j«|j«rŒ#yy­w)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Ú_outputrs rÚ__iter__z Dvi.__iter__õs(èø€ð j‰jŒlØ—,‘,“.Ò ðj‰jlùs388cóf|jjs|jj«yy)z(Close the underlying file if it is open.N)rnÚclosedrxrs rrxz Dvi.closes"ày‰y×ÒØ I‰IO‰OÕ ð rcó>tjx}}tj x}}tj }|j|jzD]}}t |t
«r
|\}}} }
d} n|\}}} }
}
| j
|
«\} } t||«}t||| z
«}t|||
z«}t||| z«}t||«}Œ|j|j}d|_ |js|jstggddd¬«S|j€-t|j|j||z
||z
||z
¬«S|jdz }||z
|z}|jD
cgc])\}}}}
}
t||z
|z||z
|z|z
||
|
|z«Œ+}}
}}}}
|jD
cgc]*\}}} }
t ||z
|z||z
|z|z
| |z|
|z«Œ,}} }}}
t||||z
|z||z
|z|¬«Scc}
}
}}}wcc}
} }}w)zk
Output the text and boxes belonging to the most recent page.
page = dvi._output()
rÚtextÚboxesÚwidthÚheightÚdescentgáz®GRA)
ÚnpÚinfr…r†Ú
isinstancer Ú_height_depth_ofr[rbÚ _baseline_vr ror)rÚminxÚminyÚmaxxÚmaxyÚ maxy_pureÚeltr_ÚerÚdr‰rXr…r†s rrz Dvi._output
sNô
—f‘fЈˆtÜ—v‘vˆˆtÜ—V‘VGˆ Ø—9‘9˜tŸz™zÑ *ˆCܘ#œsÔ
1a˜Øà#&Ñ 1d˜A˜×,¨QÓ/t˜Q“<ˆt˜Q ™UÓ#ˆt˜Q ™UÓ#ˆDÜt˜Q ™UÓ#ˆ˜I qÓ)‰Ið  × Ñ Ð ×(ˆIØ#ˆDÔ àyŠy §¢Ü˜R r°¸1ÀaÔ 8‰8Ð ä˜TŸY™Y¨d¯j©jØ" 4™i° ¸Ø $ ô
H‰H˜
Ñ &ˆØ˜# (ˆð(,§y¡y÷#˜1˜a ôa˜f˜aZ $ q¡&¨!¡¨gÑ!5°q¸!¸Q¸q¹SÕ2ˆô&*§Z¡Z÷!˜A˜a˜f˜aZ $ q¡&¨!¡¨gÑ!5°q¸±s¸A¸a¹CÕó˜ U°4¸±9¸a±-Ø% d™N¨AÑ-°wô@ð @ùö 2ùõ1s Å9.H Æ>/H
cóhdg}d|_ |jjd«d}|j|||«|jr|jj «|j|j }|dk(r|j|d«n(|dk(r|j«n|dk(r
|dxxdz
cc<|j€2tt|d g««d
k(r|dd k\r|j|_|d k(ry|jtjur|j«y
Œ()út
Read one page from the file. Return True if successful,
False if there were no more pages.
rNTr=Ú_pushéÿÿÿÿÚ_popÚ_downÚstackrJrDéŒF)rnÚreadÚ_dtablersÚ to_exceptionr/ÚappendÚpopÚlenÚgetattrÚvrVrqÚ post_postrx)rÚ
down_stackrWÚnames rr~z Dvi._read:sð.Sˆ
ØˆÔØØ—99—>> $ 'ˆ ˆDL‰L˜Ñ ˜t TÔ ××(×—<< Ñ%×.ˆØ×! *¨R¡.Õ˜ØÕ ؘؘ2“ !Ñ#“Ø× Ñ ÐœG D¨'°2Ó7¸" 2™¨!Ò+Ø#'§6¡6Ô ØsŠ{ØØz‰zœY×
Øñ)rcódtj|jj|«d|¬«S)z
Read and return a big-endian integer *nbytes* long.
Signedness is determined by the *signed* keyword.
Úbigr>)ÚintÚ
from_bytesrn)rÚnbytesr?s rrAz
Dvi._read_argis&ô
~‰~˜dŸi™iŸn™n¨VÓ4°eÀFˆKrré)r[rbrVcó|j|«t|j|jtj
«ry|xj |j|jj|«z
c_yr6©Ú_put_char_realrŒrprXr Ú_ExceptionInforÚ _width_of©rÚchars rÚ_set_char_immediatezDvi._set_char_immediatepóVà ×јDÔ d—j‘j §¡Ñ(¬%×*>Ñ*>Ô Ø Š$—*‘*˜TŸV™VÑ.¨tÓré€éƒ)rR)r[rbrVracó|j|«t|j|jtj
«ry|xj |j|jj|«z
c_yr6s rÚ _set_charz
Dvi._set_charwré„)rNrN)rVracóR|j||«|xj|z
c_yr6)Ú_put_rule_realr©rÚbs rÚ _set_rulez
Dvi._set_rule~sà ×јA˜qÔ Š!‰ Žré…éˆcó&|j|«yr6)s rÚ _put_charz
Dvi._put_charƒsà ×јDÕ!rcó|j|j}t|tj«r||_y|j €L|jjt|j|j|||j|«««y|j}|j |jD\}}}}}tt||j«|j |j"|j ¬«} |jjt|jt||«z|jt||«z| || j|«««Œ°|j$j'|j |j$D
cgc]W\}}}
} t)|jt||«z|jt||«zt|
|«t| |««ŒYc} }
}}«ycc} }
}}w)ÚscaleÚtfmrÚvf)rprXr rsÚ_vfr…rrr¸Ú_scaleÚDviFontÚ_mul2012Ú_tfmrr†Úextendr ) rrr_r•rXr™r—ÚnewfrÅs rzDvi._put_char_real‡Øz‰z˜$Ÿ&™&Ñ!ˆÜ dœE× 1Ø!%ˆDÕ Ø
X‰XÐ
Ø I‰I× Ñ œT $§&¡&¨$¯&©&°$¸Ø"&§.¡.°Ó"6ó
—K‘KˆEØ!%§¡¨$¡×!4Ñ!4ò
C
1a˜˜¤X¨e°Q·X±XÓ%>Ø#$§6¡6°1·9±9ÀÇÁôHà— ‘ × Ñ ¤ d§f¡f¬x¸¸5Ó/AÑ&AØ&*§f¡f¬x¸¸5Ó/AÑ&AØ&*¨A¨t¯~©~¸aÓ/@ó"BõCð
Cð
J‰J× Ñ ð26·±¸$±×1EÑ1E÷GñGñ$. 1 ¨Aô # 4§6¡6¬H°Q¸Ó,>Ñ#>Ø#'§6¡6¬H°Q¸Ó,>Ñ#>Ü#+¨A¨uÓ#5´À5Ó7Iõ KõGõ
HùõGsÆAHé‰có(|j||«yr6)s rÚ _put_rulez
Dvi._put_rulesà ×јA˜qÕ!rcó’|dkDrB|dkDr<|jjt|j|j||««yyy©Nr)r†r rs rzDvi._put_rule_realŸs;Ø ˆqŠ5’UØ J‰J× Ñ œc $§&¡&¨$¯&©&°!°QÓ ˆ5réŠcóyr6r4©rÚ_s rÚ_nopzDvi._nop£sà ré‹) rNrNrNrNrNrNrNrNrNrNrNc ó¬tj|_dx|_x|_x|_x|_x|_|_g|_ g|_
g|_ y) rqÚinpagerVrr—r_r•Úzr¡r…r†) rÚc0Úc1Úc2Úc3Úc4Úc5Úc6Úc7Úc8Úc9Úps rÚ_bopzDvi._bop§sNä׌
Ø>?Ð?ˆŒÐ?Ð?˜$œ&Ð? 4¤6Ð?¨D¬F°T´ˆŒ
؈Œ ؈
r)rVcóJtj|_|`|`|`|`|`|`|` yr6)
rqÚouterrVrr—r_r•s rÚ_eopzDvi._eop¯s*ä—_Œ
Ø ˆFDF˜D˜F D F¨D¨F°D°F¸D¹Jrécó¾|jj|j|j|j|j
|j |jf«yr6)rr—r_r•s rrz Dvi._push´s9à
×ј4Ÿ6™6 4§6¡6¨4¯6©6°4·6±6¸4¿6¹6À4Ç6Á6ÐKréŽcó‚|jj«\|_|_|_|_|_|_yr6)rr—r_r•s rzDvi._pop¸s+à9=¿¹¿¹Ó9IÑŒ˜œ ¤¨¬°µréé’)rPcó.|xj|z
c_yr6)r)rs rÚ_rightz
Dvi._right¼óà Š!‰ Žré“é—)rOcóT|||_|xj|jz
c_yr6)r—r)rÚnew_ws rÚ_right_wz Dvi._right_wÀó!à Р؈DŒFØ Š$—&Žré˜éœcóT|||_|xj|jz
c_yr6)r_r)rÚnew_xs rÚ_right_xz Dvi._right_xÆrréé có.|xj|z
c_yr6))rs rr z Dvi._downÌré¡é¥cóT|||_|xj|jz
c_yr6)r•)rÚnew_ys rÚ_down_yz Dvi._down_yÐrré¦éªcóT|||_|xj|jz
c_yr6))rÚnew_zs rÚ_down_zz Dvi._down_zÖrré«éêcó||_yr6©rX)rÚks rÚ_fnt_num_immediatezDvi._fnt_num_immediateÜs àˆréëéîcó||_yr6r)rÚnew_fs rÚ_fnt_numz Dvi._fnt_numàs àˆréïéò)rQ)r[rbrac óâ|jj|«}tjddj |Dcgc] }d|cxkrdkrnn t |«nd|zŒ"c}««ycc}w)Nz!Dvi._xxx: encountered special: %sÚé z<%02x>)rnrkrlÚjoinÚchr)rÚdatalenÚspecialÚchs rÚ_xxxzDvi._xxxäsaà—))—.‘. ÓÜ
Ø G‰GØð!# ¨3¥”S˜”W°H¸r±MÑ
 *ùò(s»%A,éóéö)rRrMrMrMrLrLcó0|j||||||«yr6)Ú
_fnt_def_real)rrÚsršÚls rÚ_fnt_defz Dvi._fnt_defìsà ×ј1˜a  A q¨!Õ,rcóÚ|jj||z«}|| djd«} t|«} |dk7r,| jdk7r|| jk7rtd|« t|«} t|| || ¬«|j|<y#t$r6}
t
j j|
«|j|<Yd}
~
yd}
~
wwxYw#t$rd} YŒlwxYw)Nrrztfm checksum mismatch: rÍ)
rnr Ú_tfmfileÚFileNotFoundErrorr Úfrom_exceptionrpÚchecksumrÚ_vffilerÓ) rrr0r1r2ÚfontnamerÏÚexcrÐs rr/zDvi._fnt_def_realðØ I‰IN‰N˜1˜q™5Ó !ˆØaRS6—=‘= Ó)ˆð ܘ8Ó$ˆCð
Š6c—ll '¨A°·±Ò,=ÜÐ6°q°cÐ  ܘÓ"ˆBô  a¨S¸ÔCˆ
øô ô "×0×ÓDˆDJ‰Jq‰MÜ ûð ûô ØŠBð ús)µ BÁ2 CÂ CÂ#,CÃCÃ C*Ã)C*é÷)rLrMrMrMrLcóÔ|jj|«|dk7rtd|«|dk7s|dk7r td«|dk7r td«tj|_y)zUnknown dvi format iÀ’ƒi;zNonstandard units in dvi fileéèz%Nonstandard magnification in dvi file)rnrrqrV)rr`ÚnumÚdenÚmagrs rÚ_prezDvi._preshà Ø Š6ÜÐ2°1°#Ð (Š?˜c Ð $Š;ÜÐ —_‘_ˆ
réøcó.tj|_yr6)rqrVs rÚ_postz Dvi._postsä×
réùcótr6)ÚNotImplementedErrorrßs rÚ
_post_postzDvi._post_postsä!réúéÿ)r[rbcó$tdd|z«)Nzunknown command: byte rL)r)rÚoffsets rÚ
_malformedzDvi._malformed!säÐ1°#¸±,°ÐAr)F).r/r0r1r2rrertrvr|r€rxrr~rArqrrrr rrrr r+r3r/rrrDrGrKrPr4rrrgrgÊs”ñ
ðˆfs‰l€GÙ˜  +€Iò òò !ò&ò
+@òZ-ó^Lñ1˜# Y×%5Ñ%5Ô 3˜C y×'7Ñ'7¸Jð ˆs˜Ôóñ3˜C y×'7Ñ'7¸JðHñ(ˆs˜)×Ôˆsƒ^ñ
óð
ñˆs˜)Ÿ/™/°
Ôóñˆs˜)×GóGñˆs˜)×LóLñˆs˜)×JóJñ3˜C y×'7Ñ'7¸óJðñ3˜C y×'7Ñ'7¸óIðñ
3˜C y×'7Ñ'7¸óIðñ
3˜C y×'7Ñ'7¸óJðñ3˜C y×'7Ñ'7¸óIðñ
3˜C y×'7Ñ'7¸óIðñ
3˜C y×'7Ñ'7Ôóñ3˜C y×'7Ñ'7¸óJðñ3˜C jÔ3˜CÐ&MÔOðDñ*ˆs˜)Ÿ-™-Ð.LÔNð%ñ"ˆs˜)Ÿ/™/Ô
ˆsƒ^ñð3˜ ñBóBrrgcó8eZdZdZdZdZdZdZdZdZ dZ
y )
au
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.
)rr$ÚwidthsrÒcó`tjt|¬«||_||_||_||_|dz|_ t|j«dz}t|«Dcgc]$}d|jj|d«zdz Œ&c}|_
y#t$rd}YŒLwxYwcc}w)N)rg]Ÿeáï>r=rr@é)rÚcheck_isinstanceÚbytesrÒrr$rbr‡rr^ÚgetrR)rrÚncharsrºs rrtzDviFont.__init__KÜ ×Ñœe¨WÕˆŒ ؈Œ ؈Œ ؈ŒØÐŒ ð ܘŸ“^ aÑ'ˆFô$)¨£=öð˜SŸY™YŸ]™]¨4°ÓÓ øôò ØŠFð üò2sÁBÁ()B+ B(Â'B(cóšt|«t|«uxr4|j|jk(xr|j|jk(Sr6)Útyperr$©rÚothers rÚ__eq__zDviFont.__eq__YsDÜT“
œd 5NØ—LL E§M¡MÑNØ6:·i±iÀ5Ç:Á:Ñ6Mð Orcó&|j|« Sr6)r]r[s rÚ__ne__zDviFont.__ne__]sØ—;;˜%rcóNdt|«jd|jdS)<z: ú>)rZr/rrs rÚ__repr__zDviFont.__repr__`s&Ø”4˜“:×' r¨$¯,©,¨°qÐ9rcóÂ|jjj|d«}|t||j«St
j
d||j«y)zWidth of char in dvi units.Nz No width for char %d in font %s.r)r‡rWrkrlr)rr‡s rr¸zDviFont._width_ofcsKà×# D¨$ÓØ РܘE 4§;¡;Ó 
Ð5°t¸T¿\¹\Ôrcó¨g}|jjdf|jjdffD]r\}}|j|d«}|€4tj d|||j «|jd«ŒN|jt||j««Œttjd|j «r
|dk(rd|d<|S)z&Height and depth of char in dvi units.rˆÚdepthNzNo %s for char %d in font %srs ^cmsy\d+$rž) rˆrfrWrkrlrÚreÚmatch)rÚresultÚmetricr­Úvalues rrzDviFont._height_depth_ofks¸àˆØ"Ÿi™i×Ð"Ÿi™iŸo™o¨wÐ <‰LˆF—JJ˜t *ˆE؈}Ü
Р t§|¡|ô
˜ à
œh u¨d¯k©kÓ 8‰8M 4§<¡<Ô 0°T¸Q²Y؈F2‰J؈
rN) r/r0r1r2Ú __slots__rtr]r_rcr¸rr4rr&s/ñ!ðDG€Iò Oòórcó@eZdZdZˆfdZdZdZdZdZdZ ˆxZ
S)ÚVfaú
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||d« d|_i|_|j «|j «y#|j «wxYw)ÚsuperrtÚ _first_fontÚ_charsr~rx)rrÚ __class__s €rrtz Vf.__init__™sBø€Ü
ј 1Ô Ø#ˆDÔ ØˆDŒKØ J‰JŒLà J‰JLøˆDJ‰JLús AÁAcó |j|Sr6)rr)rÚcodes rÚ __getitem__zVf.__getitem__¢sØ{‰{˜ Ð rcó"dx}}dx}} |jjd«d}|jtjur}|jj «dz
}||k(r|j
||«dx}x}}nB||kDr td«|dvs|dk\rtd|d«tj|||«Œ¸|d krL|}|jd«}|jd
«}|j|«}tj|_n}|d k(rF|jd «}|jd «}|jd «}|j|«n2d|cxkrd kršnn—|j|d z
|d k(«}|jd «}|jd «} |jd «}
|jd«} |jd«} |j||| |
| | «|j€•||_
n|d
k(rt|jd«}
|jd«}|jj|«}|jd «}|jd «}|j|
|||«n|dk(rytd|«Œ‡)Nr=rz!Packet length mismatch in vf file)r,zInappropriate opcode z in vf filer"rJrDr-r=rEzUnknown vf opcode )rnrVrqÚtellÚ_finalize_packetrrgrAÚ _init_packetr/rqrD)rÚ packet_charÚ packet_endsÚ
packet_lenÚ packet_widthrWÚbyte_atrr0r1r2r`r_ÚcsÚdss rr~zVf._read¥spð
%)Ð(ˆ kØ$(Ð(ˆ
Ø—99—>> $ 'ˆz‰zœYן)™)Ÿ.™.Ó*¨1Ñ,ؘkÒ×)¨+°|ÔDØ>BÐBB ©|à˜$Ð%HÓ˜zÑ)¨T°Sª[Ü(Ð+@ÀÀÀkÐ)RÓ—K‘K Ñ% d¨DÔðcŠzØ!
Ø"Ÿn™n¨QÓ/ Ø#Ÿ~™~¨aÓ0 Ø"×Ó5 Ü&×-
ؘØ!Ÿ^™^¨AÓ.
Ø"Ÿn™n¨QÓ/ Ø#Ÿ~™~¨aÓ0 Ø×! *Ö˜ÔÕ—N‘N 4¨#¡:¨t°s©{Ó;Ø—N‘N 1Ó%Ø—N‘N %Ø—N‘N %Ø—N‘N %Ø—NN %Ø×" 1 ¨A¨q°!Ô×+Ø'(˜Ø—N‘N 1Ó%Ø—N‘N %Ø—I‘I—N‘N %Ø—^^ &Ø—^^ &Ø ˜!˜Q  ˜Øä Ð#5°d°VÐ!<Ó=ñcrcó:|jtjk7r td«dx|_x|_x|_x|_x|_|_ g|_
g|_ g|_ |j|_d|_|j j#«|zS)NzMisplaced packet in vf filer)rVrqrrr—r_r•r…r†rqrXrsrnrx)rÚpls rrzzVf._init_packetßsˆØ :‰:œŸÒ Ð ;Ø>?Ð?ˆŒÐ?Ð?˜$œ&Ð? 4¤6Ð?¨D¬F°T´ˆŒ
؈Œ ؈Œ
Ø×ŒØÔØy‰y~‰~Ó $rcó¨|js1t|j|j|dd¬«|j|<t
j |_y)Nr„)rsr r…r†rrrqrV)rr{r~s rryzVf._finalize_packetês?Ø×!Ü'+Ø—YY d§j¡j¸ Ø (+ˆDK‰K˜ Ñ —_
rcóä|jtjur td«|dk7rtd|«t |«rt
j
d|«tj|_y)Nz pre command in middle of vf fileéÊzUnknown vf format zvf file comment: %s)rVrqrrrrkrl)rr`r_r€rs rrDzVf._preñsYØ :‰:œYŸ]™]Ñ Ð Š8ÜÐ1°!°Ð ˆqŒ6Ü J‰JÐ,¨aÔ —_‘_ˆ
r) r/r0r1r2rtrvr~rzryrDÚ
__classcell__)rss@rrnrns'ø„ñô.ò8>òt %rrncó||zdz S)z1Multiply two numbers in 20.12 fixed point format.rTr4)Únum1Únum2s rüsð
‰I˜ ÐrcóeZdZdZdZdZy)ÚTfma
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.
)r8Ú design_sizer‡rˆrfc
óÂtjd|«t|d«5}|jd«}t j
d|dd«\}}}}}} tjd|||||| «|jd|z«}
t j
d |
dd
«\|_|_|jd||z
d zz«} t j
d |d
|jd|z««} t j
d |d
|jd|z««}
t j
d | d
|jd| z««}ddd«i|_i|_ i|_
ttd z««D]T\}} d|z}| d|zd z} ||j|<
|dz |j|<|dz|j|<ŒVy#1swYŒŽxYw)Nzopening tfm file %srjéz!6Hr?éz(lh=%d, bc=%d, ec=%d, nw=%d, nh=%d, nd=%drDz!2Iér=ú!r`é)
rkrlrmÚstructÚunpackr8rr‡rˆrfÚ enumerater^)rrrnÚheader1ÚlhÚbcÚecÚnwÚnhÚndÚheader2Ú char_inforRÚheightsÚdepthsÚidxrºÚbyte0Úbyte1s rrtz Tfm.__init__Ü
Ð(¨(Ô
(˜
? —ii “mˆGÜ%+§]¡]°5¸'À!ÀB¸-Ó%HÑ "ˆBB˜˜B Ü J‰JИ2˜r 2 r¨2ô
—ii  “oˆGÜ.4¯m©m¸EÀ7È2ÈAÀ;Ó.OÑ +ˆDŒM˜Ÿ ™  ! R¨¡U¨1¡W¡+Ó.ˆ—]] Q r d¨! 9¨d¯i©i¸¸«oÓ>ˆ—mm  t¨1 I¨t¯y©y¸¸2¹«Ó?ˆ—]‘] Q r d¨! 9¨d¯i©i¸¸«oÓ>ˆ ˆŒ
؈Œ ؈Œ
Ü"¤5¨¨R°©T£?Ó 3‰IˆCؘa ™eÑ$ˆ˜a ™e A™gÑ&ˆ% e™}ˆDJ‰J Ø '¨°©
Ñ 3ˆDK‰K˜Ñ Ø% e¨c¡kÑ2ˆDJ‰J ñ  ?ús £D%GÇGN)r/r0r1r2rlrtr4rrsñð(H€Ió3rÚPsFontz(texname psname effects encoding filenamecó0eZdZdZdZed«ZdZdZy)ra}
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óRtj|«}tj|«|_t |d«5}i|_|D]B}|jdd«d}|j j|g«j|«ŒD ddd«i|_
|S#1swYŒxYw)Nrjó r=r) ÚobjectÚ__new__ÚosÚfsdecoder§rmÚsplitÚ
setdefaultr¦)ÚclsrrrnÚlineÚtfmnames rr­zPsfontsMap.__new__fä~‰~˜ÜŸ XÓŒô
(˜
 D ˆDŒNØò
DØŸ*™* T¨1Ó-¨aÑ0Ø×)¨'°2Ó6×=¸
D÷ Dð
ˆŒ ؈ ÷
 Dð Dús ¼ABÂB&có:t|t«sJ||jvr3|jj|«D]}|j |«sŒn |j
|S#t $r-td|jd«d|jd«dwxYw)NzWAn associated PostScript font (required by Matplotlib) could not be found for TeX font rz in zo; this problem can often be solved by installing a suitable PostScript font package in your TeX package manager)
rVÚ_parse_and_cache_liner©ÚKeyErrorÚ LookupErrorr )rrs rrvzPsfontsMap.__getitem__vܘ'¤5Ô d—n‘nÑ Ÿ×*¨7Ó
Ø×-¨dÕð
ð—<< Ñ (øÜòð3Ø3:·>±>À'Ó3JÐ2MðNØ—n("ð
*.ð 
 .ús ÁA$Á$6Bc ó|r|jd«rydx}x}x}x}}dx}x}} tjd|«}
|
D} | j«\} }
|
r|