from pagebot.toolbox.units import pt from pagebot.contributions.filibuster.blurb import Blurb from flat import * # rgb, font, shape, strike, document import random w, h = pt(A5) w = int(w) h = int(h) red = rgb(255, 0, 0) black = rgb(0, 0, 0) bungee = findFont('Bungee-Regular') bungeeFlat = font.open(bungee.path) blurb = Blurb() types = blurb.getBlurbTypes() txts = [] for i in range(5): i = random.randint(0, len(types)) t = types[i] print(t) txts.append(blurb.getBlurb(t, noTags=True)) txt = '. '.join(txts) #print(txt) headline = strike(bungeeFlat).color(red).size(20, 24) body = strike(bungeeFlat).color(black).size(10, 12) redStroke = shape().stroke(red).width(0.5)
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import codecs import os from pagebot.contributions.filibuster.blurb import Blurb from pagebot.contributions.filibuster.content import index # see if we can generate all of them w = Blurb() names = w.getBlurbTypes() dst = os.path.join(os.getcwd(), "_export") # Make output not write to Git. if not os.path.exists(dst): os.makedirs(dst) maxTests = 20 count = 0 for name in names: count += 1 namePath = os.path.join(dst, "%s.txt" % name) nameTagPath = os.path.join(dst, "___%s_trying.txt" % name) t = codecs.open(nameTagPath, 'w', 'utf-8') t.write("a") success = False f = codecs.open(namePath, 'w', 'utf-8') f.write("Results for \"%s\"" % name) definedIn, usedIn = index(name) usedMods = {}