HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/PIL/__pycache__/PcfFontFile.cpython-38.pyc
U

g�
^`�@s�ddlZddlmZmZddlmZmZmZ	m
ZmZ
dZdZdZdZdZd	Zd
ZdZdZd
Zdd�dd�dd�dd�gZdd�ZGdd�dej�ZdS)�N�)�FontFile�Image)�i8�i16be�i16le�i32be�i32leifcp����� �@��cCs|dd?S)N�����bitsrr�1/usr/lib/python3/dist-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�sz/sr#csHeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)�PcfFontFile�namec	s t|�d��}|tkrtd��t���t|�d��}i|_t|�D]@}t|�d��}t|�d��t|�d��t|�d��f|j|<qD||_|�	�|_
|��}|�|�}|�
�}td�D]b}	||	}
|
dk	r�||
\}}}
}}}}}|df|
||||
|fdd||f||
f}||j|	<q�dS)Nrznot a PCF filerr)�l32�read�	PCF_MAGIC�SyntaxError�super�__init__�toc�range�fp�_load_properties�info�
_load_metrics�
_load_bitmaps�_load_encoding�glyph)�selfr.�magic�count�i�type�metrics�bitmaps�encodingZchZix�x�y�l�r�w�a�d�fr4��	__class__rrr+;s(
0

,zPcfFontFile.__init__cCsX|j|\}}}|j}|�|�t|�d��}|d@rBtt}}n
tt}}||||fS)Nr)r,r.�seekr&r'�b16�b32�l16)r5�tag�format�size�offsetr.�i16�i32rrr�
_getformat[s

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)Nrrr)
rQ�PCF_PROPERTIESr'r-�appendrrG�io�SEEK_CURr#)
r5Z
propertiesr.rLrOrPZnprops�pr8�data�kr!�vrrrr/ks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)rQ�PCF_METRICSrSr-r'r)r5r:r.rLrOrPrSr8�left�right�widthZascentZdescentZxsizeZysizeZ
attributesrrrr1�s0zPcfFontFile._load_metricscCs.g}|�t�\}}}}||�d��}|t|�kr8td��g}t|�D]}	|�||�d���qDg}
td�D]}	|
�||�d���qj|d@}|d@}|
|}
|�|
�|�|
�}t|}d}|r�d}t|�D]\}	||	\}}}}}}}}||	||	d}}|�t�	d||f|||�d|||���q�|S)	NrzWrong number of bitmapsrrz1;R�1r�raw)
rQ�PCF_BITMAPSr'�len�OSErrorr-rS�
BYTES_PER_ROWrZ	frombytes)r5r:r;r.rLrOrPZnbitmapsZoffsetsr8ZbitmapSizesZbitorderZpadindexZ
bitmapsizerWZpad�moder=r>r?r@rArBrCrD�b�errrr2�s2

,zPcfFontFile._load_bitmapsc
	Cs�dgd}|�t�\}}}}||�d��||�d��}}||�d��||�d��}}	||�d��||d|	|d}
t|
�D]F}||�d��}|dkr�z||||<Wq�tk
r�Yq�Yq�Xq�|S)Nrr
ri��)rQ�PCF_BDF_ENCODINGSr'r-�
IndexError)
r5r<r.rLrOrPZfirstColZlastColZfirstRowZlastRowZ	nencodingr8ZencodingOffsetrrrr3�s
zPcfFontFile._load_encoding)�__name__�
__module__�__qualname__r%r+rQr/r1r2r3�
__classcell__rrrErr$7s (+r$)rT�rrZ_binaryrrrHrrJrrIr	r&r(rRZPCF_ACCELERATORSrZr`ZPCF_INK_METRICSrgZPCF_SWIDTHSZPCF_GLYPH_NAMESZPCF_BDF_ACCELERATORSrcr#r$rrrr�<module>s&�