zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
U
T±deã@s¶ddlZddlmZmZddlmZddlmZddlmZ    ddlm
Z ddlm Z d    ZdZd
Zd Zd Zd ZdZdZdZdZdd„dd„dd„dd„gZdd„ZGdd„dejƒZdS)éNé)ÚFontFileÚImage)Úi8)Úi16be)Úi16le)Úi32be)Úi32leifcpééééé é@é€écCs |dd?S)Néé©©ÚbitsrrúFd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PIL/PcfFontFile.pyÚ<lambda>,órcCs|dd?d@S)Néréþÿÿÿrrrrrr-rcCs|dd?d@S)Néréüÿÿÿrrrrrr.rcCs|dd?d@S)Né?riøÿÿÿrrrrrr/rcCs||| d|¡…S)Nó)Úindex)ÚsÚorrrÚsz3sr#csNeZdZdZdZd‡fdd„    Zdd„Zdd    „Zd
d „Zd d „Z    dd„Z
‡Z S)Ú PcfFontFilez(Font file plugin for the X11 PCF format.Únameú    iso8859-1c    s"||_t| d¡ƒ}|tkr(d}t|ƒ‚tƒ ¡t| d¡ƒ}i|_t|ƒD]@}t| d¡ƒ}t| d¡ƒt| d¡ƒt| d¡ƒf|j|<qN||_    | 
¡|_ |  ¡}|  |¡}    | ¡}
t|
ƒD]Z\} } | dk    rÂ|| \} }}}}}}}|df|||| ||fdd| |f|    | f|j| <qÂdS)Nr znot a PCF filer)Úcharset_encodingÚl32ÚreadÚ    PCF_MAGICÚ SyntaxErrorÚsuperÚ__init__ÚtocÚrangeÚfpÚ_load_propertiesÚinfoÚ _load_metricsÚ _load_bitmapsÚ_load_encodingÚ    enumerateZglyph)Úselfr0r'ÚmagicÚmsgÚcountÚiÚtypeÚmetricsÚbitmapsÚencodingÚchÚixÚxsizeÚysizeÚleftÚrightÚwidthÚascentÚdescentÚ
attributes©Ú    __class__rrr-<sB
 0
 
 
÷
üzPcfFontFile.__init__cCsX|j|\}}}|j}| |¡t| d¡ƒ}|d@rBtt}}n
tt}}||||fS)Nr )r.r0Úseekr(r)Úb16Úb32Úl16)r7ÚtagÚformatÚsizeÚoffsetr0Úi16Úi32rrrÚ
_getformatjs
 
zPcfFontFile._getformatc     CsÊi}| t¡\}}}}|| d¡ƒ}g}t|ƒD]2}| || d¡ƒt| d¡ƒ|| d¡ƒf¡q0|d@r‚| d|d@tj¡| || d¡ƒ¡}    |D]*\}
} } t    |    |
ƒ}
| r¼t    |    | ƒ} | ||
<qš|S)Nr rr)
rVÚPCF_PROPERTIESr)r/ÚappendrrLÚioÚSEEK_CURr#) r7Z
propertiesr0rQrTrUZnpropsÚpr;ÚdataÚkr!Úvrrrr1ys 0
 
 
zPcfFontFile._load_propertiesc
Cs\g}| t¡\}}}}|j}|d@dkrÄt|| d¡ƒƒD]†}t| d¡ƒd}t| d¡ƒd}    t| d¡ƒd}
t| d¡ƒd} t| d¡ƒd} |    |} | | }|| |||    |
| | dfƒq:n”t|| d¡ƒƒD]€}|| d¡ƒ}|| d¡ƒ}    || d¡ƒ}
|| d¡ƒ} || d¡ƒ} || d¡ƒ}|    |} | | }|| |||    |
| | |fƒqÖ|S)Niÿrr
rrrr )rVÚ PCF_METRICSrXr/r)r)r7r=r0rQrTrUrXr;rDrErFrGrHrBrCrIrrrr3”s0 zPcfFontFile._load_metricsc Cs,g}| t¡\}}}}|| d¡ƒ}|t|ƒkr<d}t|ƒ‚g}    t|ƒD]}
|     || d¡ƒ¡qHg} tdƒD]}
|  || d¡ƒ¡qn|d@} |d@} | | }|     |¡| |¡}t| }d}| rÈd}t|ƒD]V}
||
dd…\}}|    |
|
d…\}}| t     d||f|||…d|||ƒ¡¡qÐ|S)    Nr zWrong number of bitmapsr rz1;RÚ1r
Úraw)
rVÚ PCF_BITMAPSr)ÚlenÚOSErrorr/rXÚ BYTES_PER_ROWrZ    frombytes)r7r=r>r0rQrTrUZnbitmapsr9Úoffsetsr;Z bitmap_sizesZbitorderZpadindexZ
bitmapsizer\ÚpadÚmoderBrCÚbÚerrrr4¹s8   
 
 "ÿzPcfFontFile._load_bitmapsc     sø| t¡\‰}‰}ˆˆ d¡ƒˆˆ d¡ƒ}}ˆˆ d¡ƒˆˆ d¡ƒ}}ˆˆ d¡ƒ||d||d}dgtd|ƒ}‡‡fdd„t|ƒDƒ}    t|t|ƒƒD]H}
z.|    tt|
gƒ |j    ¡ƒ} | dkrÚ| ||
<Wqªt
k
rðYqªXqª|S)Nr
rrcsg|]}ˆˆ d¡ƒ‘qS)r
)r))Ú.0Ú_©r0rTrrÚ
<listcomp>ósz.PcfFontFile._load_encoding.<locals>.<listcomp>iÿÿ) rVÚPCF_BDF_ENCODINGSr)Úminr/rcÚordÚ    bytearrayÚdecoder'ÚUnicodeDecodeError) r7rQrUZ    first_colZlast_colZ    first_rowZlast_rowZ    nencodingr?Zencoding_offsetsr;Zencoding_offsetrrmrr5æs"ÿ zPcfFontFile._load_encoding)r&) Ú__name__Ú
__module__Ú __qualname__Ú__doc__r%r-rVr1r3r4r5Ú __classcell__rrrJrr$7s.%-r$)rYÚrrÚ_binaryrrrMrrOrrNr    r(r*rWZPCF_ACCELERATORSr_rbZPCF_INK_METRICSroZ PCF_SWIDTHSZPCF_GLYPH_NAMESZPCF_BDF_ACCELERATORSrer#r$rrrrÚ<module>s.     ü