mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 18:23:24 +03:00
Clarify variable names in BdfFontFile
Co-authored-by: Yay295 <Yay295@users.noreply.github.com>
This commit is contained in:
parent
879e77a446
commit
f52bbf8950
|
@ -64,16 +64,25 @@ def bdf_char(f):
|
||||||
bitmap.append(s[:-1])
|
bitmap.append(s[:-1])
|
||||||
bitmap = b"".join(bitmap)
|
bitmap = b"".join(bitmap)
|
||||||
|
|
||||||
[x, y, l, d] = [int(p) for p in props["BBX"].split()]
|
# The word BBX followed by the width in x (BBw), height in y (BBh),
|
||||||
[dx, dy] = [int(p) for p in props["DWIDTH"].split()]
|
# and x and y displacement (BBox, BBoy) of the lower left corner
|
||||||
|
# from the origin of the character.
|
||||||
|
width, height, x_disp, y_disp = [int(p) for p in props["BBX"].split()]
|
||||||
|
|
||||||
bbox = (dx, dy), (l, -d - y, x + l, -d), (0, 0, x, y)
|
# The word DWIDTH followed by the width in x and y of the character in device units.
|
||||||
|
dx, dy = [int(p) for p in props["DWIDTH"].split()]
|
||||||
|
|
||||||
|
bbox = (
|
||||||
|
(dx, dy),
|
||||||
|
(x_disp, -y_disp - height, width + x_disp, -y_disp),
|
||||||
|
(0, 0, width, height),
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
im = Image.frombytes("1", (x, y), bitmap, "hex", "1")
|
im = Image.frombytes("1", (width, height), bitmap, "hex", "1")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# deal with zero-width characters
|
# deal with zero-width characters
|
||||||
im = Image.new("1", (x, y))
|
im = Image.new("1", (width, height))
|
||||||
|
|
||||||
return id, int(props["ENCODING"]), bbox, im
|
return id, int(props["ENCODING"]), bbox, im
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user