Use font in ImageDraw examples

This commit is contained in:
Andrew Murray 2024-02-17 11:19:32 +11:00
parent 912a33f5e9
commit d3b974b786
2 changed files with 8 additions and 8 deletions

View File

@ -232,10 +232,10 @@ Previous code::
im = Image.new("RGB", (100, 100))
draw = ImageDraw.Draw(im)
width, height = draw.textsize("Hello world")
width, height = draw.textsize("Hello world", font)
width, height = font.getsize_multiline("Hello\nworld")
width, height = draw.multiline_textsize("Hello\nworld")
width, height = draw.multiline_textsize("Hello\nworld", font)
Use instead::
@ -247,9 +247,9 @@ Use instead::
im = Image.new("RGB", (100, 100))
draw = ImageDraw.Draw(im)
width = draw.textlength("Hello world")
width = draw.textlength("Hello world", font)
left, top, right, bottom = draw.multiline_textbbox((0, 0), "Hello\nworld")
left, top, right, bottom = draw.multiline_textbbox((0, 0), "Hello\nworld", font)
width, height = right - left, bottom - top
FreeTypeFont.getmask2 fill parameter

View File

@ -69,10 +69,10 @@ Previous code::
im = Image.new("RGB", (100, 100))
draw = ImageDraw.Draw(im)
width, height = draw.textsize("Hello world")
width, height = draw.textsize("Hello world", font)
width, height = font.getsize_multiline("Hello\nworld")
width, height = draw.multiline_textsize("Hello\nworld")
width, height = draw.multiline_textsize("Hello\nworld", font)
Use instead::
@ -84,9 +84,9 @@ Use instead::
im = Image.new("RGB", (100, 100))
draw = ImageDraw.Draw(im)
width = draw.textlength("Hello world")
width = draw.textlength("Hello world", font)
left, top, right, bottom = draw.multiline_textbbox((0, 0), "Hello\nworld")
left, top, right, bottom = draw.multiline_textbbox((0, 0), "Hello\nworld", font)
width, height = right - left, bottom - top
API Additions