mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Use font in ImageDraw examples
This commit is contained in:
parent
912a33f5e9
commit
d3b974b786
|
@ -232,10 +232,10 @@ Previous code::
|
||||||
|
|
||||||
im = Image.new("RGB", (100, 100))
|
im = Image.new("RGB", (100, 100))
|
||||||
draw = ImageDraw.Draw(im)
|
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 = font.getsize_multiline("Hello\nworld")
|
||||||
width, height = draw.multiline_textsize("Hello\nworld")
|
width, height = draw.multiline_textsize("Hello\nworld", font)
|
||||||
|
|
||||||
Use instead::
|
Use instead::
|
||||||
|
|
||||||
|
@ -247,9 +247,9 @@ Use instead::
|
||||||
|
|
||||||
im = Image.new("RGB", (100, 100))
|
im = Image.new("RGB", (100, 100))
|
||||||
draw = ImageDraw.Draw(im)
|
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
|
width, height = right - left, bottom - top
|
||||||
|
|
||||||
FreeTypeFont.getmask2 fill parameter
|
FreeTypeFont.getmask2 fill parameter
|
||||||
|
|
|
@ -69,10 +69,10 @@ Previous code::
|
||||||
|
|
||||||
im = Image.new("RGB", (100, 100))
|
im = Image.new("RGB", (100, 100))
|
||||||
draw = ImageDraw.Draw(im)
|
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 = font.getsize_multiline("Hello\nworld")
|
||||||
width, height = draw.multiline_textsize("Hello\nworld")
|
width, height = draw.multiline_textsize("Hello\nworld", font)
|
||||||
|
|
||||||
Use instead::
|
Use instead::
|
||||||
|
|
||||||
|
@ -84,9 +84,9 @@ Use instead::
|
||||||
|
|
||||||
im = Image.new("RGB", (100, 100))
|
im = Image.new("RGB", (100, 100))
|
||||||
draw = ImageDraw.Draw(im)
|
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
|
width, height = right - left, bottom - top
|
||||||
|
|
||||||
API Additions
|
API Additions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user