Пример #1
0
 def get_cairo_font_face(self):
     if self.cairo_font_face is None:
         self.cairo_font_face = pycairoft.create_cairo_font_face_for_file(
             self.filename)
     return self.cairo_font_face
Пример #2
0
	def get_cairo_font_face(self):
		if self.cairo_font_face is None:
			self.cairo_font_face = pycairoft.create_cairo_font_face_for_file (
						self.filename)
		return self.cairo_font_face
Пример #3
0
rows = set([u // NUM_COLS * NUM_COLS for u in charset])
num_rows = len(rows)

width = NUM_COLS * CELL_SIZE + 2 * (2 * MARGIN + LABEL_WIDTH)
height = num_rows * CELL_SIZE + 2 * MARGIN

print("Generating %s at %.3gx%.3gin" % (outfile, width / 72., height / 72.))
if outfile.endswith(".pdf"):
    surface = cairo.PDFSurface(outfile, width, height)
elif outfile.endswith(".ps"):
    surface = cairo.PSSurface(outfile, width, height)
else:
    assert 0
cr = cairo.Context(surface)
noto_sans_lgc = pycairoft.create_cairo_font_face_for_file(
    "../../fonts/individual/unhinted/NotoSans-Regular.ttf")

#cr.select_font_face("@cairo:", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)

cr.set_font_size(FONT_SIZE)
cr.set_line_width(PADDING)

STAGE_BOXES = 0
STAGE_GLYPHS = 1
for stage in range(2):
    cr.save()
    cr.translate(MARGIN, MARGIN)
    for row, row_start in enumerate(sorted(rows)):
        cr.translate(0, PADDING)
        cr.save()
Пример #4
0
rows = set([u // NUM_COLS * NUM_COLS for u in charset])
num_rows = len(rows)

width  = NUM_COLS * CELL_SIZE + 2 * (2 * MARGIN + LABEL_WIDTH)
height = num_rows * CELL_SIZE + 2 * MARGIN

print "Generating %s at %.3gx%.3gin" % (outfile, width/72., height/72.)
if outfile.endswith(".pdf"):
	surface = cairo.PDFSurface(outfile, width, height)
elif outfile.endswith(".ps"):
	surface = cairo.PSSurface(outfile, width, height)
else:
	assert 0
cr = cairo.Context(surface)
noto_sans_lgc = pycairoft.create_cairo_font_face_for_file ("../../fonts/individual/unhinted/NotoSans-Regular.ttf")

#cr.select_font_face("@cairo:", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)

cr.set_font_size(FONT_SIZE)
cr.set_line_width(PADDING)

STAGE_BOXES = 0
STAGE_GLYPHS = 1
for stage in range(2):
	cr.save()
	cr.translate(MARGIN, MARGIN)
	for row,row_start in enumerate(sorted(rows)):
		cr.translate(0, PADDING)
		cr.save()