def draw_bottom_word(canvas, end_index, bottom_translation): yfrom = FIRST_CHARACTER_ROW_Y - (end_index + 1) * CHARACTER_ROW_HEIGHT yfrom_word = yfrom + WORD_OFFSET ymid = PAGE_SIZE[1] - int((PAGE_SIZE[1] - yfrom_word) / 2) draw_vertical_text(canvas, FONT_NAME, WORD_FONT_SIZE, \ SUMMATION_FROM_X, ymid, bottom_translation) draw_bottom_summation_curve(canvas, SUMMATION_FROM_X+SUMMATION_OFFSET, \ yfrom, GRID_OFFSET, \ PAGE_SIZE[1]-SUMMATION_OFFSET)
def draw_full_word(canvas, begin_index, end_index, word): h = CHARACTER_ROW_HEIGHT * (end_index - begin_index + 1) h_word = h - 2 * WORD_OFFSET yto = FIRST_CHARACTER_ROW_Y - begin_index * CHARACTER_ROW_HEIGHT ymid = yto - WORD_OFFSET - h_word / 2 text = combine_and_shorten_definition(word.definition, \ DEFINITION_SEPARATOR, h, \ FONT_NAME, WORD_FONT_SIZE).text draw_vertical_text(canvas, FONT_NAME, WORD_FONT_SIZE, \ SUMMATION_FROM_X, ymid, text) draw_full_summation_curve(canvas, SUMMATION_FROM_X+SUMMATION_OFFSET, \ yto-h, GRID_OFFSET, yto)
def draw_top_word(canvas, begin_index, top_translation): yto = FIRST_CHARACTER_ROW_Y - begin_index * CHARACTER_ROW_HEIGHT yto_word = yto - WORD_OFFSET ymid = int(yto_word / 2) if top_translation == '': draw_opened_top_summation_curve(canvas, \ SUMMATION_FROM_X+SUMMATION_OFFSET, \ SUMMATION_OFFSET, GRID_OFFSET, \ yto) return draw_vertical_text(canvas, FONT_NAME, WORD_FONT_SIZE, SUMMATION_FROM_X, \ ymid, top_translation) draw_top_summation_curve(canvas, SUMMATION_FROM_X+SUMMATION_OFFSET, \ SUMMATION_OFFSET, GRID_OFFSET, \ yto)