
    ]Hj                    l    S r SSKJr  SSKJr  SSKJrJr      S
S jr " S S\R                  5      r	g	)z*
Parse X Bitmap Distribution Format (BDF)
    )annotations)BinaryIO   )FontFileImagec                z    U R                  5       nU(       d  g UR                  S5      (       a  OM1  USS  R                  5       R                  S5      n0 n U R                  5       nU(       a  UR                  S5      (       a  O=UR	                  S5      nXS-   S R                  S5      X1S U R                  S5      '   Mk  [        5       n U R                  5       nU(       a  UR                  S5      (       a  O	XQS S -  nM7  S	 US
   R                  5        5       u  pgp[        R                  " Xg45        S US   R                  5        5       u  pX4X* U-
  Xh-   U	* 4SSXg44n [        R                  " SXg4USS5      nU[        US   5      X4$ ! [         a    [        R                  " SXg45      n N5f = f)Ns	   STARTCHAR	   asciis   BITMAP    r   s   ENDCHARc              3  8   #    U  H  n[        U5      v   M     g 7fNint.0ps     Q/Users/admin/workspace/tools/venv/lib/python3.13/site-packages/PIL/BdfFontFile.py	<genexpr>bdf_char.<locals>.<genexpr>H   s     $J5ISVV5I   BBXc              3  8   #    U  H  n[        U5      v   M     g 7fr   r   r   s     r   r   r   M   s     8 71A 7r   DWIDTHr   1hexENCODING)readline
startswithstripdecodefind	bytearraysplitr   _decompression_bomb_check	frombytes
ValueErrornewr   )fsidpropsibitmapwidthheightx_dispy_dispdwxdwybboxims                 r   bdf_charr7      s    JJL<<%%  
12		g	&B E
JJLALL++FF4L'(Q}';';G'Dell7#$  [F
JJLALL,,CR&	  %KU5\5G5G5I$J!E6	##UO4 9h 5 5 78HC 

	6!5>F7;	
AuD-__S5/65#F
 s5$%t//	  -YYsUO,-s   )F "F:9F:c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )BdfFontFile^   z(Font file plugin for the X11 BDF format.c                  > [         TU ]  5         UR                  5       nUR                  S5      (       d  Sn[	        U5      e0 n/ n UR                  5       nU(       a  UR                  S5      (       a  OUR                  S5      nX&S-   S R                  S5      XBS U R                  S5      '   US U S;   a:  UR                  S	5      S
:  a%  UR                  X&S-   S R                  S5      5        M   [        U5      nU(       d  g Uu  pu  ppS
U	s=::  a  [        U R                  5      :  a  O  OXX4U R                  U	'   MQ  )Ns   STARTFONT 2.1znot a valid BDF files   ENDPROPERTIESr   r   r   r
   )s   COMMENTs	   COPYRIGHTs   LogicalFontDescriptionr   )super__init__r   r   SyntaxErrorr"   r!   appendr7   lenglyph)selffpr*   msgr,   commentsr-   cr+   chxydstsrcr6   	__class__s                 r   r=   BdfFontFile.__init__a   s0   KKM||,--(Cc""A%566tA+,UR=+?+?+HEBQ%,,w'(!u226634q8OOA!ebM$8$8$AB  A)*&BNRcB(TZZ(!##!1

2      )rC   r   returnNone)__name__
__module____qualname____firstlineno____doc__r=   __static_attributes____classcell__)rK   s   @r   r9   r9   ^   s    22 2rM   r9   N)r)   r   rO   zqtuple[str, int, tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]], Image.Image] | None)
rU   
__future__r   typingr    r   r   r7   r9   rN   rM   r   <module>r[      s?   ( #  <0<0<0~2(## 2rM   