def drawBackground1(keyFrame, frame):
    fs = c.newString('8 weight fonts\nTotal 400k',
                     style=dict(font=LABEL_FONT.installedName,
                                rLeading=1.2,
                                fontSize=18,
                                textFill=(1, 0, 0)))
    c.textBox(fs, (50, H - 60, 200, 50))
def drawBackground3(keyFrame, frame):
    drawBackground1(keyFrame, frame)
    varFontIcon = id2FontIcon['VarFont']
    fs = c.newString('%d weights\nTotal 100k' % ((2**15) + 1),
                     style=dict(font=LABEL_FONT.installedName,
                                rLeading=1.2,
                                fontSize=18,
                                textFill=(1, 0, 0)))
    c.textBox(fs, (varFontIcon.x, H - 60, 200, 50))
Exemplo n.º 3
0
def run():
    s = u"""글자가 일상이 된다 산돌커뮤니케이션 ABCD123 Latin すべての文化集団は,独自の言語,文字,書記システムを持つ.それゆえ,個々の書記システムをサイバースペースに移転することは. ABCD123 Latin included"""
    c.newPage(W, H)
    fsr = c.newString(s, style=dict(font='Generic-Regular', fontSize=FontSize))
    fsb = c.newString(s,
                      style=dict(font='Generic-Regular_Bold',
                                 fontSize=FontSize))
    fsbRed = c.newString(s,
                         style=dict(font='Generic-Regular_Bold',
                                    fill=(1, 0, 0),
                                    fontSize=FontSize))
    c.textBox(fsr, (100, 600, 820, 350))
    c.textBox(fsb, (100, 300, 820, 350))
    c.textBox(fsbRed, (100, 0, 820, 350))
    c.textBox(fsr, (100, 0, 820, 350))
def buildDesignPages(w, h):

    cw = w - ML - MR

    # Page 66
    context.newPage(w, h)

    bs = context.newText(t)

    R = (ML, MB, w - ML - MR, h - MB - MT)
    overFill = context.textOverflow(bs, R)
    context.textBox(bs, R)

    pn = context.newString(66, style=pageNumberStyle)
    context.text(pn, (w / 2 - pn.w / 2, M / 2))

    pt = context.newString(bookTitle, style=pageTitleStyle)
    context.textBox(pt, (ML, h - MT * 0.75, cw, pt.h))

    # Page 67
    context.newPage(w, h)

    # Assume that we have a footnote on this page, calc it's space.
    fnMark = context.newString(footNoteRef, style=footNoteRefStyle)
    fn = fnMark + ' ' + context.newString(footNoteText, style=footNoteStyle)
    fnw, fnh = fn.textSize(cw)
    cfnh = fnh + bodyStyle['fontSize'] * bodyStyle['rLeading']
    ch = h - MB - MT - cfnh
    R = (ML, MB + cfnh, cw, ch)
    context.textBox(overFill, R)

    context.textBox(fn, (ML, MB, cw, fnh))

    pt = context.newString(chapterTitle, style=pageChapterStyle)
    context.textBox(pt, (ML, h - MT * 0.75, cw, pt.h))

    pn = context.newString(67, style=pageNumberStyle)
    context.text(pn, (w / 2 - pn.w / 2, M / 2))
Exemplo n.º 5
0
def buildBusinessCard2(w, h):

    M = 4  # Margin

    # Page 66
    context.newPage(w, h)

    y = h

    context.image('docs/images/IMG_2379-50.jpg', (0, 0), w=w * 1.3)

    # Title of cover, make it fit in with and add shadow
    style = dict(font='Upgrade-Regular',
                 fontSize=14,
                 textFill=1,
                 xTextAlign=CENTER)
    styleTitle = dict(font='Upgrade-Italic',
                      fontSize=10,
                      textFill=(0xEC / 255, 0x3E / 255, 0x2B / 255),
                      xTextAlign=CENTER)
    styleEmail = dict(font='Upgrade-Light',
                      fontSize=8,
                      textFill=1,
                      xTextAlign=CENTER,
                      leading=10,
                      rTracking=0.02)
    bs = context.newString('Claudia Mens\n', style=style)
    bs += context.newString('Designer | Educator | Founder\n',
                            style=styleTitle)
    bs += context.newString('[email protected] ', style=styleEmail)
    tw, th = bs.size()
    context.textBox(bs, (w / 2 - tw / 2, h / 2 - th / 2, tw, th))

    styleLogo = dict(font='Upgrade-Thin',
                     fontSize=14,
                     textFill=1,
                     openTypeFeatures=dict(case=True))
Exemplo n.º 6
0
def drawFigures():
    W, H = 860, 451
    newPage(W, H)
    LEADING = 0.9
    fs = c.newString('ABC0123456789\n',
                     style=dict(textFill=0,
                                rLeading=1,
                                font='BitcountPropSingle-RegularCircle',
                                fontSize=90))
    fs += c.newString('abc0123456789\n',
                      style=dict(textFill=0,
                                 font='BitcountPropSingle-RegularCircle',
                                 rLeading=LEADING,
                                 fontSize=90,
                                 openTypeFeatures=dict(smcp=True)))
    fs += c.newString('ABCabc0123456789\n',
                      style=dict(textFill=0,
                                 font='BitcountPropSingle-RegularCircle',
                                 rLeading=LEADING,
                                 fontSize=90,
                                 openTypeFeatures=dict(onum=True,
                                                       ss07=True)))
    fs += c.newString('ABCabc0123456789\n',
                      style=dict(textFill=0,
                                 font='BitcountPropSingle-RegularCircle', 
                                 rLeading=LEADING,
                                 fontSize=90,
                                 openTypeFeatures=dict(ss07=True)))
    fs += c.newString('Fraction 1/2 12345/67890\n',
                      style=dict(textFill=0,
                                 font='BitcountPropSingle-RegularCircle',
                                 rLeading=LEADING,
                                 fontSize=90,
                                 openTypeFeatures=dict(frac=True)))
    M = 30
    c.textBox(fs, (M+10, -10, W-2*M, H))
    c.saveImage('_export/figures.png') # Save the sample as file or animated gif.
Exemplo n.º 7
0
#!/usr/bin/env python
# -----------------------------------------------------------------------------
#
#     P A G E B O T
#
#     Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens & Font Bureau
#     www.pagebot.io
#       from https://github.com/fonttools/fonttools/blob/master/Lib/fontTools/varLib/mutator.py
#     Licensed under MIT conditions
#
#     Supporting usage of DrawBot, www.drawbot.com
#     Supporting usage of Flat, https://github.com/xxyxyz/flat
# -----------------------------------------------------------------------------

from pagebot.contexts import defaultContext as context
from pagebot.fonttoolbox.objects.font import Font

f = Font("fonts/_instances/AmstelvarAlpha-Default.ttf")
fs = context.newString(u'Ae', style=dict(font=f.installedName, fontSize=500))
context.textBox(fs, (20, -10, 900, 900))
Exemplo n.º 8
0
    F = 50
    R = 10
    x = y = 20

    rLeading = 0.6

    for angle in range(0, 360, 10):
        context.newPage(1000, 1000)
        dx = sin(angle/360*2*pi) * R
        dy = cos(angle/360*2*pi) * R
        fs = context.newString(scriptGlobals.s1,
                               style=dict(font='BitpathGridDouble-RegularLineSquare',
                                          fontSize=F,
                                          textFill=(1, 0, 0),
                                          rLeading=rLeading))
        context.textBox(fs, (x, y, 1000, 900))

        fs = context.newString(scriptGlobals.s2,
                               style=dict(font='BitpathGridDouble-RegularLineSquare',
                                          fontSize=F,
                                          textFill=(0, 1, 0),
                                          rLeading=rLeading))
        context.textBox(fs, (x+7, y+7, 1000, 900))

        fs = context.newString(scriptGlobals.s3,
                               style=dict(font='BitpathGridDouble-RegularLineSquare',
                                          fontSize=F,
                                          textFill=(0, 1, 1),
                                          rLeading=rLeading))
        context.textBox(fs, (x, y+7, 1000, 900))
Exemplo n.º 9
0
from pagebot.contexts import defaultContext as context

W = 600
H = 300

HEAD_LINE = """When fonts started a new world"""

TEXT = """The advent of variable fonts means doing nothing, or everything, or something in between for font users and type designers. """

newPage(W, H)

bs = context.newString(HEAD_LINE + '\n',
                       style=dict(font='Verdana', fontSize=24, textFill=0))
bs += context.newString(TEXT,
                        style=dict(font='Verdana', fontSize=12, textFill=0))

tw, th = context.textSize(bs, w=200)
print tw, th
context.textBox(bs, (100, -th + H, 200, th))
Exemplo n.º 10
0
#     P A G E B O T
#
#     Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens & Font Bureau
#     www.pagebot.io
#     Licensed under MIT conditions
#
#     Supporting usage of DrawBot, www.drawbot.com
#     Supporting usage of Flat, https://github.com/xxyxyz/flat
# -----------------------------------------------------------------------------
#
from pagebot.contexts import defaultContext as c

c.newPage(1000, 1000)
fs = c.newString("b", style=dict(lineHeight=74, font="Times", fontSize=38))
fs += c.newString("hello world ",
                  style=dict(font="Helvetica", fontSize=10, lineHeight=12))
fs += c.newString("hi agian " * 10)

r = (10, 10, 200, 200)
c.textBox(fs, r)

c.fill(None)
c.stroke(1, 0, 0)
c.rect(*r)

positions = c.textBoxBaseLines(fs, r)

s = 2
for x, y in positions:
    c.oval(x - s, y - s, s * 2, s * 2)
Exemplo n.º 11
0
## https://github.com/thomgb/drawbot
## download my DrawBot: https://www.dropbox.com/s/xsu1mz89ipo5x3y/DrawBot.dmg?dl=0
from pagebot.contexts import defaultContext as context
from pagebot.contributions.filibuster.blurb import Blurb

#text = Blurb().getBlurb('article_ankeiler', noTags=True)
text = """Considering the fact that the application allows individuals to call a phone number and leave a voice mail, which is automatically translated into a tweet with a hashtag from the country of origin."""

t = context.newString(text,
                      style=dict(fontSize=30,
                                 hyphenationHead=4,
                                 hyphenationTail=3))

w = 554  # change width to see other hyphenations

W = 1000
H = 2000
context.newPage(W, H)

context.hyphenation(True)
context.textBox(t, (100, 600, w, 400))
context.fill(None)
context.stroke(0)
context.rect(100, 600, w, 600)

context.hyphenation(False)
context.textBox(t, (100, 100, w, 400))
context.fill(None)
context.stroke(0)
context.rect(100, 100, w, 600)
Exemplo n.º 12
0
    leading = 24
    for n in range(0, 1000, leading):
        context.stroke(1, 0, 0)
        context.fill(None)
        context.line((0, n),(1000,n))
   
    fs1 = context.newString('')   
    fs2 = context.newString('aaa vvv bbbbbb\nss' * 5,
                      style=dict(fontSize=14,
                                 lineHeight=24))
    appendS(fs1, fs2, 300, 24)

    bx, by, bw, bh = 50, 50, leading*3, 200#, leading*20
    context.stroke(0)
    context.fill(None)
    context.rect(bx, by, bw, bh)

    Y = 100
    bx, by, bw, bh = box = (100, Y, 400, 500)
    baselines = context.textBoxBaseLines(fs, box)
    for x, y in baselines:
        context.stroke(0, 1, 0)
        context.fill(None)
        context.line((x-10, y), (400+10, y))
    dy = round(baselines[0][1]/leading)*leading - baselines[0][1]
    print dy
    box2 = (bx,by+dy, 400, 500)
    context.textBox(fs, box2)
    context.rect(bx, by+dy, bw, bh)
    context.saveImage(path)
Exemplo n.º 13
0
from pagebot.contributions.filibuster.blurb import blurb

if __name__ == '__main__':

	#for k in getFamilyFontPaths('Bitpath'):
	#    print k

	F = 50
	x = y = 20

	s = blurb.getBlurb('article_content', noTags=True)
	fs = context.newString(s, style=dict(font='BitpathGridDouble-RegularLineSquare',
                                             fontSize=F,
                                             textFill=(1, 0, 0),
                                             rLeading=0.5))
	context.textBox(fs, (x, y, 1000, 900))

	s = blurb.getBlurb('article_content', noTags=True)
	fs = context.newString(s, style=dict(font='BitpathGridDouble-RegularLineSquare',
                                             fontSize=F,
                                             textFill=(0, 1, 0),
                                             rLeading=0.5))
	context.textBox(fs, (x, y, 1000, 900))

	s = blurb.getBlurb('article_content', noTags=True)
	fs = context.newString(s, style=dict(font='BitpathGridDouble-RegularLineSquare',
                                             fontSize=F,
                                             textFill=(0, 1, 1),
                                             rLeading=0.5))
	context.textBox(fs, (x, y, 1000, 900))
Exemplo n.º 14
0
 def draw(self):
     c.textBox(self.fs, (self.x, self.y, self.w, self.h))
Exemplo n.º 15
0
                           style=dict(lineHeight=1,
                                      font=f.installedName,
                                      fontSize=12))

# Create DrawBotString, inheriting from BabelString, based on view type.
bs = context.newString('Hlxg',
                       style=dict(font=f.installedName,
                                  textFill=(1, 0, 0),
                                  fontSize=300,
                                  leading=320,
                                  baselineShift=200))

M = 20
context.fill(0.9)
context.rect(M, M, 1000 - 2 * M, 800 - 2 * M)

Y = 1000 - M
BASE = (f.info.ascender + f.info.descender + f.info.lineGap) / 2
print('%s %s %s %s' % (f.info.familyName, f.info.styleName,
                       'Ascender + Descender + lineGap =', BASE))
YS = (BASE, )
print YS
for y in YS:
    context.stroke(0)
    context.strokeWidth(0.5)
    context.line((0, y), (1000, y))

context.fill(0)
context.stroke(None)
context.textBox(bs, (M, M, 1000 - 2 * M, 400 - 2 * M))