font

Functions

get_font([font_file_name, font_size])

get_readable_font_size(img_size)

Get size of font for image with given sizes

load_font(font_file_name[, font_size])

Set global font true-type for drawing.

Description

Font utilities.

get_font(font_file_name=None, font_size=12)[source]
Parameters:
font_file_name : str

name of font file (example: ‘DejaVuSansMono.ttf’)

font_size : int

selected font size

Returns:

Font object

Return type:

PIL.ImageFont.FreeTypeFont

get_readable_font_size(img_size)[source]

Get size of font for image with given sizes

Parameters:
img_size : Tuple[int, int]

size of image

Returns:

size of font

Return type:

int

load_font(font_file_name, font_size=12)[source]

Set global font true-type for drawing.

Parameters:
font_file_name : str

name of font file (example: ‘DejaVuSansMono.ttf’)

font_size : int

selected font size

Returns:

Font object

Return type:

PIL.ImageFont.FreeTypeFont