def makeAnimatiom():
    vMasterFont = Font(FONT_PATH)
    axes = vMasterFont.axes

    for sequence in getProofSequences():
        for location in getLocations(
                axes, sequence):  # Expand into a sequence of locations.
            newPage(W, H)
            fill(1)
            rect(0, 0, W, H)
            save()
            textColor = 0
            for gIndex, glyph in enumerate(TEXT):
                # Only works by glyph name.
                drawGlyphPath(vMasterFont.ttFont,
                              glyph,
                              S * 40 + S * gIndex * 6 * 9,
                              S * 22,
                              location=location,
                              s=S * 0.04,
                              fillColor=textColor)
            # TODO To be extended PageBot
            #drawGlyphPaths(vMasterFont, TEXT, x=S*40 + S*gIndex*6*9, y=S*22, location=location, fontSize=S*0.04, fillColor=textColor)
            restore()
            fill(0)
            fontSize(24)
            text('%s %s' % (location['changed1'], location['changed2']),
                 (100, 20))
        saveImage(EXPORT_PATH %
                  (location['changed1'][0], location['changed2'][0]))
    def draw(self, view, origin):

        c = self.context

        p = pointOffset(self.oPoint, origin)
        p = self._applyScale(view, p)
        px, py, _ = self._applyAlignment(p)  # Ignore z-axis for now.

        if self.drawBefore is not None:  # Call if defined
            self.drawBefore(self, view, p)

        fillColor = self.style.get('fill')
        #fillColor = (0, 0, 0)
        #if fillColor is not None:
        #    c = self.doc.context
        #    c.setFillColor(fillColor)
        #    c.setStrokeColor(None)
        #else:
        #    fillColor = (0, 0, 0)
        glyphPathScale = self.fontSize / self.font.info.unitsPerEm
        drawGlyphPath(c, self.font.ttFont, self.glyphNames[0], px, py,
                      self.location, glyphPathScale, fillColor)

        if self.drawAfter is not None:  # Call if defined
            self.drawAfter(self, view, p)
Exemple #3
0
    def _drawGlyphMarker(self,
                         axisName,
                         mx,
                         my,
                         glyphName,
                         fontSize,
                         location,
                         strokeW=2):
        # Middle circle
        fill(1)
        stroke(0.7)
        strokeWidth(strokeW)
        oval(mx - fontSize / 2 * self.R, my - fontSize / 2 * self.R,
             fontSize * self.R, fontSize * self.R)

        variableFont = getVariableFont(self.font, location)
        # Show axis name below circle marker?
        if self.showAxisNames and axisName is not None:
            fs = newFS(axisName,
                       style=dict(font=variableFont.installedName,
                                  fontSize=fontSize / 4,
                                  textFill=0))
            tw, th = textSize(fs)
            text(fs, (mx - tw / 2, my - fontSize / 2 * self.R - th * 2 / 3))
        glyphPathScale = fontSize / self.font.info.unitsPerEm
        drawGlyphPath(variableFont,
                      glyphName,
                      mx,
                      my - fontSize / 3,
                      s=glyphPathScale,
                      fillColor=0)
def makeAnimation():
    axes = vMasterFont.axes

    print 'Variable A X E S'
    for axisName, (minValue, defaultValue,
                   maxValue) in vMasterFont.axes.items():
        print axisName, 'minValue', minValue, 'defaultValue', defaultValue, 'maxValue', maxValue

    location = getDefaultLocation(axes)

    if TERMINAL_VALUES_S[TerminalValue] != 'None':
        location[TERMINALS[TerminalShape]] = TERMINAL_VALUES[TerminalValue]
    if SKELETON_VALUES[SkeletonValue] != 'None':
        location[SKELETONS[SkeletonShape]] = SKELETON_VALUES[SkeletonValue]
    if BLEND_VALUES[BlendValue] != 'None':
        location[BLENDS[BlendShape]] = BLEND_VALUES[BlendValue]
    location['wmx2'] = WEIGHT_VALUES[WeightValue - 2]

    #for sequence in getProofSequences():
    #    for location in getLocations(axes, sequence): # Expand into a sequence of locations.
    #        newPage(W, H)
    context.fill(1)
    context.rect(0, 0, W, H)
    context.save()
    textColor = 0
    for gIndex, glyph in enumerate(TEXT):
        # Only works by glyph name.
        drawGlyphPath(vMasterFont.ttFont,
                      glyph,
                      S * 40 + S * gIndex * 6 * 9,
                      S * 22,
                      location=location,
                      s=S * 0.04,
                      fillColor=textColor)
        drawGlyphPath(vMasterFont.ttFont,
                      glyph,
                      S * 40 + S * gIndex * 6 * 9,
                      S * 22,
                      location=location,
                      s=S * 0.04,
                      fillColor=textColor)
    # TODO To be extended PageBot
    #drawGlyphPaths(vMasterFont, TEXT, x=S*40 + S*gIndex*6*9, y=S*22, location=location, fontSize=S*0.04, fillColor=textColor)
    context.restore()
    context.fill(0)
    context.fontSize(24)
def makeAnimatiom():
    vMasterFont = Font(FONT_PATH)
    axes = vMasterFont.axes
    print axes.keys()

    axisStates = {}
    for axisName, (minValue, defaultValue, maxValue) in axes.items():
        axisStates[axisName] = newAxisState(axisName, minValue, defaultValue,
                                            maxValue)

    c1, c2, c3 = [1, 0.1, 0, 0.7], [0, 1, 0, 0.7], [0, 0, 1, 0.7]

    for n in range(0, FRAMES, STEP):
        newPage(W, H)
        fill(1)
        rect(0, 0, W, H)
        textColor = 0
        """
        for cIndex, c in enumerate((c1, c2, c3)):
            if cIndex == 0:
                c[0] = (1.5+openV[cIndex][0]/2)/2
                #c[1] = (1+lineV[cIndex][0]/16)/2
                #c[2] = (1+wghtV[cIndex][0]/16)/2
            elif cIndex == 1:
                #c[0] = (1+rndoV[cIndex][0]/8)/2
                c[1] = (1.2+rndiV[cIndex][0]/2)/2
                #c[2] = (1+sqroV[cIndex][0]/8)/2
            else:
                #c[0] = (1+rndoV[cIndex][0]/16)/2
                #c[1] = (1+wghtV[cIndex][0]/16)/2
                c[2] = (1.5+wghtV[cIndex][0]/2)/2
        """
        location = getNextLocation(axisStates)
        for gIndex, glyph in enumerate(TEXT):
            # Only works by glyph name.
            drawGlyphPath(vMasterFont.ttFont,
                          glyph,
                          S * 40 + S * gIndex * 6 * 9,
                          S * 22,
                          location=location,
                          s=S * 0.04,
                          fillColor=textColor)
def makeAnimatiom():
    vMasterFont = Font(FONT_PATH)
    axes = vMasterFont.axes

    for sequence in getProofSequences():
        for location in getLocations(
                axes, sequence):  # Expand into a sequence of locations.
            newPage(W, H)
            fill(1)
            rect(0, 0, W, H)
            textColor = 0
            for gIndex, glyph in enumerate(TEXT):
                # Only works by glyph name.
                drawGlyphPath(vMasterFont.ttFont,
                              glyph,
                              S * 40 + S * gIndex * 6 * 9,
                              S * 22,
                              location=location,
                              s=S * 0.04,
                              fillColor=textColor)
Exemple #7
0
    def _drawGlyphMarker(self,
                         mx,
                         my,
                         glyphName,
                         fontSize,
                         location,
                         strokeW=2):
        # Middle circle
        c.fill(1)
        c.stroke(0)
        c.strokeWidth(strokeW)
        c.oval(mx - fontSize * self.R, my - fontSize * self.R,
               fontSize * 2 * self.R, fontSize * 2 * self.R)

        glyphPathScale = fontSize / self.font.info.unitsPerEm
        drawGlyphPath(self.font.ttFont,
                      glyphName,
                      mx,
                      my - fontSize / 4,
                      location,
                      s=glyphPathScale,
                      fillColor=0)