Beispiel #1
0
 def __init__(self, f, **kwargs):
     u"""
     >>> from pagebot.fonttoolbox.objects.font import findFont
     >>> from pagebot.document import Document
     >>> from pagebot.constants import Letter
     >>> from pagebot.contexts.drawbotcontext import DrawBotContext
     >>> from pagebot.conditions import *
     >>> c = DrawBotContext()
     >>> w, h = Letter
     >>> doc = Document(w=w, h=h, padding=80, originTop=False, autoPages=2, context=c)
     >>> style = dict(gh=16, fill=0.95, rLeading=1.4, fontSize=24)
     >>> conditions = [Fit()]
     >>> page = doc[1]
     >>> font1 = findFont('AmstelvarAlpha-VF')
     >>> gs = GlyphSet(font1, parent=page, conditions=conditions, padding=40, style=style, context=c)
     >>> style = dict(stroke=0, strokeWidth=0.25, gh=8, rLeading=1.4, fontSize=18) # Smaller fontSize and grid.
     >>> page = doc[2]
     >>> font2 = findFont('RobotoDelta-VF')
     >>> #font2 = findFont('Upgrade-Regular')
     >>> #font2 = findFont('Escrow-Bold')
     >>> gs = GlyphSet(font2, parent=page, conditions=conditions, style=style, padding=40, context=c)
     >>> score = doc.solve()
     >>> doc.export('_export/%sGlyphSet.pdf' % font1.info.familyName)
     """
     BaseFontShow.__init__(self, **kwargs)
     self.f = f  # Font instance
Beispiel #2
0
 def __init__(self, f, **kwargs):
     """
     >>> from pagebot.fonttoolbox.objects.font import findFont
     >>> from pagebot.document import Document
     >>> from pagebot.constants import Letter
     >>> from pagebot import getContext
     >>> from pagebot.conditions import *
     >>> from pagebot.toolbox.color import color, blackColor
     >>> from pagebot.toolbox.units import em
     >>> c = getContext()
     >>> w, h = Letter
     >>> doc = Document(w=w, h=h, padding=80, autoPages=2, context=c)
     >>> style = dict(gh=16, fill=color(0.95), leading=em(1.4), fontSize=24)
     >>> conditions = [Fit()]
     >>> page = doc[1]
     >>> font1 = findFont('AmstelvarAlpha-VF')
     >>> gs = GlyphSet(font1, parent=page, conditions=conditions, padding=40, style=style, context=c)
     >>> style = dict(stroke=blackColor, strokeWidth=0.25, gh=8, leading=em(1.4), fontSize=18) # Smaller fontSize and grid.
     >>> page = doc[2]
     >>> font2 = findFont('RobotoDelta-VF')
     >>> #font2 = findFont('Upgrade-Regular')
     >>> #font2 = findFont('Escrow-Bold')
     >>> gs = GlyphSet(font2, parent=page, conditions=conditions, style=style, padding=40, context=c)
     >>> score = doc.solve()
     >>> doc.export('_export/%sGlyphSet.pdf' % font1.info.familyName)
     """
     BaseFontShow.__init__(self, **kwargs)
     self.f = f  # (Variable) font instance
Beispiel #3
0
 def __init__(self, f, words=None, labelFontSize=None, **kwargs):
     """
     >>> from pagebot.fonttoolbox.objects.font import findFont
     >>> from pagebot.document import Document
     >>> from pagebot.constants import Letter
     >>> from pagebot.contexts.drawbotcontext import DrawBotContext
     >>> from pagebot.conditions import *
     >>> from pagebot.toolbox.units import em
     >>> c = DrawBotContext()
     >>> w, h = Letter
     >>> doc = Document(w=w, h=h, padding=80, originTop=False, autoPages=2, context=c)
     >>> conditions = [Fit()]
     >>> page = doc[1]
     >>> font1 = findFont('AmstelvarAlpha-VF')
     >>> style = dict(gh=16, fill=0.95, leading=em(1.4))
     >>> gs = Stacked(font1, parent=page, conditions=conditions, padding=40, style=style, context=c)
     >>> page = doc[2]
     >>> font2 = findFont('RobotoDelta-VF')
     >>> #font2 = findFont('Upgrade-Regular')
     >>> #font2 = findFont('Escrow-Bold')
     >>> style = dict(stroke=0, strokeWidth=0.25, gh=8, leading=em(1.4))
     >>> gs = Stacked(font2, parent=page, conditions=conditions, style=style, padding=40, context=c)
     >>> score = doc.solve()
     >>> doc.export('_export/%sStacked.pdf' % font1.info.familyName)
     """
     BaseFontShow.__init__(self, **kwargs)
     self.f = f # Font instance
     self.words = words or {} # Optional dictionary for headline words. Keys is frame index number.
     self.usedText = set() # Avoid double use of headline words.
     # Add semi-random generated content, styles of fitting.
     self.blurb = Blurb() # Random content creator, in case there is no content supplied.
     self.lineTag = 'design_headline' # Default label where to find random word choices.
     self.headlineTag = 'design_headline' # Default label where to find (or create) random headline text.
     self.textTag = 'da_text' # Default label where to find (or create) random body text.
Beispiel #4
0
 def __init__(self, f, label=None, dx=None, dy=None, steps=None, axes=None, **kwargs):
     u"""   
     >>> from pagebot.fonttoolbox.objects.font import findFont
     >>> from pagebot.document import Document
     >>> from pagebot.constants import Letter
     >>> from pagebot.contexts.drawbotcontext import DrawBotContext
     >>> from pagebot.conditions import *
     >>> c = DrawBotContext()
     >>> w, h = Letter
     >>> doc = Document(w=w, h=h, padding=80, originTop=False, autoPages=2, context=c)
     >>> style = dict(fill=0.95, rLeading=1.4, fontSize=28)
     >>> conditions = [Fit()]
     >>> page = doc[1]
     >>> font1 = findFont('AmstelvarAlpha-VF')
     >>> gs = Cube(font1, parent=page, conditions=conditions, padding=50, steps=4, style=style, label="An", context=c)
     >>> style = dict(stroke=0, strokeWidth=0.25, fontSize=24, rLeading=1.4)
     >>> page = doc[2]
     >>> font2 = findFont('RobotoDelta-VF')
     >>> gs = Cube(font2, parent=page, conditions=conditions, style=style, steps=3, padding=40, context=c)
     >>> score = doc.solve()
     >>> doc.export('_export/%sCube.pdf' % font1.info.familyName)
     >>> #doc.export('_export/%sCube.svg' % font1.info.familyName)
     >>> #doc.export('_export/%sCube.gif' % font1.info.familyName)
     """
     BaseFontShow.__init__(self, **kwargs)
     self.f = f # Font instance
     self.label = label or 'Hn'
     self.steps = steps or 5
     self.dx = dx 
     self.dy = dy
     # Set the relation between the axes and the cube ribs
     if axes is None:
         axes = {LEFT: 'wght', RIGHT: 'wdth', TOP: 'opsz'}
     self.axes = axes
Beispiel #5
0
    def __init__(self, f, glyphName=None, **kwargs):
        """

        >>> from pagebot.fonttoolbox.objects.font import findFont
        >>> from pagebot.document import Document
        >>> from pagebot.constants import Letter
        >>> from pagebot.contexts.drawbotcontext import DrawBotContext
        >>> from pagebot.conditions import *
        >>> from pagebot.toolbox.units import em
        >>> c = DrawBotContext()
        >>> w, h = Letter
        >>> doc = Document(w=w, h=h, padding=80, originTop=False, autoPages=2, context=c)
        >>> style = dict(gh=16, fill=0.95, leading=em(1.4), fontSize=24)
        >>> conditions = [Fit()]
        >>> page = doc[1]
        >>> font1 = findFont('AmstelvarAlpha-VF', lazy=False)
        >>> gs = GlyphDimensions(font1, parent=page, conditions=conditions, glyphName='S', padding=40, style=style, context=c)
        >>> style = dict(stroke=0, strokeWidth=0.25, gh=8, leading=em(1.4), fontSize=18) # Smaller fontSize and grid.
        >>> page = doc[2]
        >>> font2 = findFont('RobotoDelta-VF')
        >>> #font2 = findFont('Upgrade-Regular')
        >>> #font2 = findFont('Escrow-Bold')
        >>> gs = GlyphDimensions(font2, parent=page, conditions=conditions, glyphName='Q', style=style, padding=40, context=c)
        >>> score = doc.solve()
        >>> doc.export('_export/%sGlyphDimensions.pdf' % font1.info.familyName)

        >>> from pagebot.fonttoolbox.objects.font import Font
        >>> from pagebot.document import Document
        >>> from pagebot.constants import Letter
        >>> from pagebot.contexts.drawbotcontext import DrawBotContext
        >>> from pagebot.conditions import *
        >>> c = DrawBotContext()
        >>> w, h = Letter
        >>> from pagebot.fonttoolbox.objects.font import findFont
        >>> font = findFont('RobotoDelta-VF')
        >>> location = dict(SHPE=360, wght=500)
        >>> doc = Document(w=w, h=h, padding=80, originTop=False, autoPages=1, context=c)
        >>> style = dict(gh=16, fill=0.95, leading=em(1.4), fontSize=24)
        >>> conditions = [Fit()]
        >>> page = doc[1]
        >>> instance = font.getInstance(location=location)
        >>> gs = GlyphDimensions(instance, parent=page, glyphName='H', conditions=conditions, padding=40, style=style, context=c)
        >>> score = doc.solve()
        >>> doc.export('_export/%sGlyphDimensions.pdf' % font.info.familyName)
        """
        BaseFontShow.__init__(self, **kwargs)
        self.f = f  # Font instance
        self.glyphName = glyphName or 'H'