CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
BdfFontFile.cpython-310.pyc28 linesDownload Raw Back to __pycache__
1o

2��YiO
�@sLdZddlmZddlmZddlmZmZdd3d�ZGdd
�d
ej�Z	dS)z*4Parse X Bitmap Distribution Format (BDF)5�)�annotations)�BinaryIO�)�FontFile�Image�fr�return�qtuple[str, int, tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]], Image.Image] | NonecCsn	|��}|s	dS|�d�rnq|dd����d�}i}	|��}|r)|�d�r*n|�d�}||dd��d�||d|��d�<qt�}	|��}|rS|�d	�rTn	||dd�7}qHd6d�|d��D�\}}}}	d
d�|d��D�\}7}|8|f||	||||	fdd||ff}z
t�d||f|dd�}
Wnt	y�t�9d||f�}
Ynw|t|d�||
fS)NTs	STARTCHAR�	�asciisBITMAP� r�����sENDCHARcs��|]}t|�VqdS�N��int��.0�p�r�yE:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\PIL/BdfFontFile.py�	<genexpr>G��zbdf_char.<locals>.<genexpr>ZBBXcsrrrrrrrrKrZDWIDTHr�1�hex�ENCODING)�readline�10startswith�strip�decode�find�	bytearray�splitr�	frombytes�11ValueError�newr)r�s�id�props�iZbitmap�width�heightZx_dispZy_dispZdwxZdwyZbbox�imrrr�bdf_charsF12�13(��1415��r-cs"eZdZdZd�fdd�Z�ZS)	�BdfFontFilez(Font file plugin for the X11 BDF format.�fprr�Nonecst���|��}|�d�sd}t|��i}g}	|��}|r$|�d�r%n7|�d�}||dd��d�||d|��d�<|d|�d	vr[|�d16�dkr[|�||dd��d��q	t|�}|sedS|\}}	\}17}}}
d|	kr{t	|j18�kr�nn	|19|||
f|j20|	<q])Ns
STARTFONT 2.1znot a valid BDF fileTs
ENDPROPERTIESrrr
r)sCOMMENTs	COPYRIGHTsLogicalFontDescriptionr)�super�__init__rr�SyntaxErrorr r�appendr-�lenZglyph)�selfr/r&�msgr(�commentsr)�cr'�chZxy�dst�srcr,��	__class__rrr2_s2212223(�24�zBdfFontFile.__init__)r/rrr0)�__name__�25__module__�__qualname__�__doc__r2�
__classcell__rrr=rr.\sr.N)rrrr	)26rB�27__future__r�typingr�rrr-r.rrrr�<module>s28>
Aluode/PerceptionLabPortable · CoolFace