#!/usr/bin/env python # # Reproducer for # https://bugs.freedesktop.org/show_bug.cgi?id=77298 # https://bugs.launchpad.net/inkscape/+bug/1174909 # https://bugzilla.novell.com/show_bug.cgi?id=817724 # # (C) 2014 Juergen Weigert # import math import cairo import sys width, height = 800, 600 pt2mm = 72/25.4 surface = cairo.PDFSurface ("output.pdf", width, height) ctx = cairo.Context (surface) ctx.scale(pt2mm, pt2mm) ctx.set_source_rgb(1,1,1) ctx.rectangle(0,0,width,height) ctx.fill() ctx.set_source_rgb(1,0,0) if len(sys.argv) <= 1: ctx.move_to(10,10) ctx.set_font_size(8) ctx.show_text("libcairo-" + cairo.cairo_version_string()) ctx.show_text(" (PyCairo-" + cairo.version + ')') ctx.set_font_size(5) print("using libcairo-" + cairo.cairo_version_string()) xoff=10 all = (0.001, 0.007, 0.01, 0.015, 0.0176, 0.018, 0.02, 0.035, 0.036, 1.0) if len(sys.argv) > 1: all = (float(sys.argv[1]),) all *= 10 for width in all: ctx.move_to(xoff+20,30) ctx.arc(xoff+10, 30, 10, 0,math.pi*2) ctx.rectangle(xoff+-2,18,24,24) ctx.move_to(xoff+2,30) ctx.line_to(xoff+10,22) ctx.move_to(xoff+2,30) ctx.line_to(xoff+18,30) ctx.set_line_width(width) ctx.stroke() if len(sys.argv) <= 1: ctx.move_to(xoff,50) ctx.show_text('w='+str(width)) xoff+=30 ctx.show_page()