Python cairo.FONT_SLANT_ITALIC Examples
The following are 1
code examples of cairo.FONT_SLANT_ITALIC().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cairo
, or try the search function
.
Example #1
Source File: generate_life_calendar.py From generate_life_calendar with Apache License 2.0 | 3 votes |
def draw_grid(ctx, date): """ Draws the whole grid of 52x90 squares """ start_date = date pos_x = X_MARGIN / 4 pos_y = pos_x # Draw the key for box colours ctx.set_font_size(TINYFONT_SIZE) ctx.select_font_face(FONT, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) pos_x = draw_key_item(ctx, pos_x, pos_y, KEY_BIRTHDAY_DESC, BIRTHDAY_COLOUR) draw_key_item(ctx, pos_x, pos_y, KEY_NEWYEAR_DESC, NEWYEAR_COLOUR) # draw week numbers above top row ctx.set_font_size(TINYFONT_SIZE) ctx.select_font_face(FONT, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) pos_x = X_MARGIN pos_y = Y_MARGIN for i in range(NUM_COLUMNS): text = str(i + 1) w, h = text_size(ctx, text) ctx.move_to(pos_x + (BOX_SIZE / 2) - (w / 2), pos_y - BOX_SIZE) ctx.show_text(text) pos_x += BOX_SIZE + BOX_MARGIN ctx.set_font_size(TINYFONT_SIZE) ctx.select_font_face(FONT, cairo.FONT_SLANT_ITALIC, cairo.FONT_WEIGHT_NORMAL) for i in range(NUM_ROWS): # Generate string for current date ctx.set_source_rgb(0, 0, 0) date_str = date.strftime('%d %b, %Y') w, h = text_size(ctx, date_str) # Draw it in front of the current row ctx.move_to(X_MARGIN - w - BOX_SIZE, pos_y + ((BOX_SIZE / 2) + (h / 2))) ctx.show_text(date_str) # Draw the current row draw_row(ctx, pos_y, start_date, date) # Increment y position and current date by 1 row/year pos_y += BOX_SIZE + BOX_MARGIN date += datetime.timedelta(weeks=52)