Merge d502827e9b into 94ec04d33e
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 4.0 KiB |
@ -1376,8 +1376,8 @@ def test_textbbox_stroke() -> None:
|
||||
# Act / Assert
|
||||
assert draw.textbbox((2, 2), "A", font, stroke_width=2) == (0, 4, 16, 20)
|
||||
assert draw.textbbox((2, 2), "A", font, stroke_width=4) == (-2, 2, 18, 22)
|
||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=2) == (0, 4, 52, 44)
|
||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=4) == (-2, 2, 54, 50)
|
||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=2) == (0, 4, 52, 48)
|
||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=4) == (-2, 2, 54, 54)
|
||||
|
||||
|
||||
@skip_unless_feature("freetype2")
|
||||
|
||||
@ -223,7 +223,7 @@ def test_float_size(layout_engine: ImageFont.Layout) -> None:
|
||||
def test_render_multiline(font: ImageFont.FreeTypeFont) -> None:
|
||||
im = Image.new(mode="RGB", size=(300, 100))
|
||||
draw = ImageDraw.Draw(im)
|
||||
line_spacing = font.getbbox("A")[3] + 4
|
||||
line_spacing = font.getbbox("Aj")[3] + 4
|
||||
lines = TEST_TEXT.split("\n")
|
||||
y: float = 0
|
||||
for line in lines:
|
||||
|
||||
@ -154,8 +154,8 @@ def test_wrap_height() -> None:
|
||||
text = ImageText.Text("Text does not fit within height")
|
||||
wrapped = text.wrap(width, 25 if features.check_module("freetype2") else 40)
|
||||
assert wrapped is not None
|
||||
assert wrapped.text == " within height"
|
||||
assert text.text == "Text does\nnot fit"
|
||||
assert wrapped.text == " not fit within height"
|
||||
assert text.text == "Text does"
|
||||
|
||||
text = ImageText.Text("Text does not fit\nwithin height")
|
||||
wrapped = text.wrap(width, 20)
|
||||
@ -166,8 +166,8 @@ def test_wrap_height() -> None:
|
||||
text = ImageText.Text("Text does not fit\n\nwithin height")
|
||||
wrapped = text.wrap(width, 25 if features.check_module("freetype2") else 40)
|
||||
assert wrapped is not None
|
||||
assert wrapped.text == "\nwithin height"
|
||||
assert text.text == "Text does\nnot fit"
|
||||
assert wrapped.text == " not fit\n\nwithin height"
|
||||
assert text.text == "Text does"
|
||||
|
||||
|
||||
def test_wrap_scaling_unsupported() -> None:
|
||||
|
||||
@ -353,7 +353,7 @@ class Text(Generic[AnyStr]):
|
||||
fontmode = self._get_fontmode()
|
||||
line_spacing = (
|
||||
self.font.getbbox(
|
||||
"A",
|
||||
"Aj",
|
||||
fontmode,
|
||||
None,
|
||||
self.features,
|
||||
|
||||