MCPcopy Create free account
hub / github.com/JacquesLucke/code_autocomplete / draw_text

Function draw_text

graphics.py:43–54  ·  view source on GitHub ↗
(text = "", position = (0, 0), size = 200, horizontal_align = "LEFT", vertical_align = "BOTTOM", color = (0.2, 0.2, 0.2, 1.0), font_id = font_id)

Source from the content-addressed store, hash-verified

41 draw_text(text, position, size = size, horizontal_align = align, vertical_align = "BOTTOM")
42
43def draw_text(text = "", position = (0, 0), size = 200, horizontal_align = "LEFT", vertical_align = "BOTTOM", color = (0.2, 0.2, 0.2, 1.0), font_id = font_id):
44
45 set_text_size(size, font_id)
46 dimensions = blf.dimensions(font_id, text)
47
48 if horizontal_align == "CENTER":
49 position = (position[0] - dimensions[0] / 2, position[1])
50 if vertical_align == "TOP":
51 position = (position[0], position[1] - dimensions[1])
52 glColor4f(*color)
53 blf.position(font_id, int(position[0]), int(position[1]), 0)
54 blf.draw(font_id, text)
55
56def get_text_dimensions(text, size, font_id = font_id):
57 set_text_size(size, font_id = font_id)

Callers 3

draw_text_on_rectangleFunction · 0.85
drawMethod · 0.85

Calls 2

set_text_sizeFunction · 0.85
drawMethod · 0.45

Tested by

no test coverage detected