def barCoord(n):
'''
returns ((x-left-top, y-left-top),
(x-left-buttom, y-right-buttom),
(x-right-top, y-right-top),
(x-right-buttom, y-right-buttom))
coordinate of a bar area
'''
return ((100 + (n % 6) * 380, 430 + (n // 6) * 331), # left x-axis 100pt for margin blank
(100 + (n % 6) * 380, 430 + (n // 6) * 331 + 252), # top y-axis 430pt for title
(100 + (n % 6) * 380 + 380, 430 + (n // 6) * 331), # 252 is 1.5em for chord 1em * 3 for melody 56pt per em
(100 + (n % 6) * 380 + 380, 430 + (n // 6) * 331 + 252))
# ctx = cairo.Context(cairo.PDFSurface("haha.pdf", 2480.0, 3508.0))
# ctx.set_font_size(30)
# ctx.select_font_face("FreeSerif", cairo.FONT_SLANT_NORMAL,
# cairo.FONT_WEIGHT_NORMAL)
评论列表
文章目录