aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pillow/py3/PIL/BdfFontFile.py
diff options
context:
space:
mode:
authorkickbutt <kickbutt@yandex-team.com>2024-01-23 23:36:43 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-01-24 15:02:13 +0300
commit299dc21a6f70a16b00e1d564fa56961331552415 (patch)
tree183f498a2e98a04f9a6143a11006ba0c10f867f3 /contrib/python/Pillow/py3/PIL/BdfFontFile.py
parent5ccb6ae864be6b53df427dc3a0fa14dbb95aa11c (diff)
downloadydb-299dc21a6f70a16b00e1d564fa56961331552415.tar.gz
Fix separator in CUDA_ARCHITECTURES
Diffstat (limited to 'contrib/python/Pillow/py3/PIL/BdfFontFile.py')
-rw-r--r--contrib/python/Pillow/py3/PIL/BdfFontFile.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/contrib/python/Pillow/py3/PIL/BdfFontFile.py b/contrib/python/Pillow/py3/PIL/BdfFontFile.py
index 161954831a..e3eda4fe98 100644
--- a/contrib/python/Pillow/py3/PIL/BdfFontFile.py
+++ b/contrib/python/Pillow/py3/PIL/BdfFontFile.py
@@ -20,7 +20,9 @@
"""
Parse X Bitmap Distribution Format (BDF)
"""
+from __future__ import annotations
+from typing import BinaryIO
from . import FontFile, Image
@@ -36,7 +38,17 @@ bdf_slant = {
bdf_spacing = {"P": "Proportional", "M": "Monospaced", "C": "Cell"}
-def bdf_char(f):
+def bdf_char(
+ f: BinaryIO,
+) -> (
+ tuple[
+ str,
+ int,
+ tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]],
+ Image.Image,
+ ]
+ | None
+):
# skip to STARTCHAR
while True:
s = f.readline()
@@ -56,13 +68,12 @@ def bdf_char(f):
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
# load bitmap
- bitmap = []
+ bitmap = bytearray()
while True:
s = f.readline()
if not s or s[:7] == b"ENDCHAR":
break
- bitmap.append(s[:-1])
- bitmap = b"".join(bitmap)
+ bitmap += s[:-1]
# The word BBX
# followed by the width in x (BBw), height in y (BBh),
@@ -92,7 +103,7 @@ def bdf_char(f):
class BdfFontFile(FontFile.FontFile):
"""Font file plugin for the X11 BDF format."""
- def __init__(self, fp):
+ def __init__(self, fp: BinaryIO):
super().__init__()
s = fp.readline()