ox.image: add getTextSize method

This commit is contained in:
rolux 2013-06-06 17:29:52 +02:00
parent f086c64e51
commit cca251bc32

View file

@ -132,6 +132,11 @@ def getRGB(hsl):
rgb[i] = v1
return tuple(map(lambda x: int(x * 255), rgb))
def getTextSize(image, text, font_file, font_size):
draw = ImageDraw.Draw(image)
font = ImageFont.truetype(font_file, font_size, encoding='unic')
return draw.textsize(text, font=font)
def wrapText(text, max_width, max_lines, font_file, font_size):
# wraps text to max_width and max_lines
def get_width(string):