def make_text(matrix, text): height = matrix.height width = matrix.width font = Font('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', height//2) text_bitmap = font.render_text(text) x_off = (width - text_bitmap.width) // 2 y_off = (height - text_bitmap.height) // 2 def pixel(matrix, x, y, t): text_x = x - x_off text_y = y - y_off text_p = None if text_y < 0 or text_x < 0 or text_y >= text_bitmap.height or text_x >= text_bitmap.width: text_p = False else: text_p = text_bitmap.get(text_x, text_y) if text_p != (simp(matrix, y, x, t/2.0) == BLACK): return COLOR return BLACK return pixel
def make_text(stdscr, text): (scr_h, scr_w) = stdscr.getmaxyx() height = 2 * scr_h width = 2 * scr_w font = Font('/System/Library/Fonts/Monaco.dfont', min(height, 50)) text_bitmap = font.render_text(text) x_off = (width - text_bitmap.width) // 2 y_off = (height - text_bitmap.height) // 2 def pixel(y, x, t): text_x = x - x_off text_y = y - y_off text_p = None if text_y < 0 or text_x < 0 or text_y >= text_bitmap.height or text_x >= text_bitmap.width: text_p = False else: text_p = text_bitmap.get(text_x, text_y) return text_p != (not simp(y, x, t / 2.0) and y % 2 == 0) return pixel