Esempio n. 1
0
def typeQualities(isBold=False):
    fill(*BLACK)
    stroke(None)
    openTypeFeatures(tnum=True)
    if not isBold:
        font('.SFNS-Regular', 9)
    else:
        font('.SFNS-Bold', 9)
Esempio n. 2
0
 def test_openTypeFeatures(self):
     drawBot.newDrawing()
     fea = drawBot.listOpenTypeFeatures()
     self.assertEqual(fea, ['liga'])
     drawBot.font("Helvetica")
     fea = drawBot.listOpenTypeFeatures()
     self.assertEqual(fea, ['liga', 'pnum', 'tnum'])
     fea = drawBot.listOpenTypeFeatures("HoeflerText-Regular")
     self.assertEqual(fea, ['dlig', 'liga', 'lnum', 'onum', 'pnum', 'titl', 'tnum'])
     fea = drawBot.openTypeFeatures(liga=False)
     self.assertEqual(fea, {'liga': False})
     drawBot.font("LucidaGrande")
     fea = drawBot.openTypeFeatures(resetFeatures=True)
     self.assertEqual(fea, {})
Esempio n. 3
0
 def test_openTypeFeatures(self):
     drawBot.newDrawing()
     fea = drawBot.listOpenTypeFeatures()
     self.assertEqual(fea, {'liga': True})
     drawBot.font("Helvetica")
     fea = drawBot.listOpenTypeFeatures()
     self.assertEqual(fea, {'liga': True, 'tnum': True, 'pnum': False})
     fea = drawBot.listOpenTypeFeatures("HoeflerText-Regular")
     self.assertEqual(fea, {'liga': True, 'dlig': False, 'tnum': True, 'pnum': False, 'titl': True, 'onum': True, 'lnum': False})
     fea = drawBot.openTypeFeatures(liga=False)
     self.assertEqual(fea, {'liga': False, 'tnum': True, 'pnum': False})
     drawBot.font("LucidaGrande")
     fea = drawBot.openTypeFeatures(resetFeatures=True)
     self.assertEqual(fea, {'liga': True})
Esempio n. 4
0
import drawBot
drawBot.newPage(130, 130)
drawBot.font("Times")
drawBot.text("ToTAVAT.", (10, 10))
drawBot.openTypeFeatures(kern=False)
drawBot.text("ToTAVAT.", (10, 30))
drawBot.openTypeFeatures(kern=True)
drawBot.text("ToTAVAT.", (10, 50))
# add tracking
drawBot.tracking(10)
drawBot.text("ToTAVAT.", (10, 70))
drawBot.openTypeFeatures(kern=False)
drawBot.text("ToTAVAT.", (10, 90))
drawBot.openTypeFeatures(kern=True)
drawBot.text("ToTAVAT.", (10, 110))
Esempio n. 5
0
    drawString(s, px, py, 'PropSingleMediumItalic', (0.6, 0.0, 0, 1))
    if HIGHLIGHT:
        drawString(s, px, py, 'PropSingleItalic', (0.8, 0, 0, 1))
        drawString(s, px - 1, py + 1, 'PropSingleLightItalic', (1, 0, 0, 1))
    else:
        drawString(s, px, py, 'PropSingleItalic', (1, 0, 0, 1))


if __name__ == '__main__':

    openTypeFeatures(onum=True,
                     lnum=True,
                     hwid=True,
                     ss01=True,
                     ss02=True,
                     ss04=False,
                     ss05=False,
                     ss06=True,
                     pcap=False,
                     smcp=False,
                     c2sc=False)

    line1 = 'Separate Bitcount fonts @ $10.10'
    line2 = u'Package of all 300 Bitcounts: $101'
    speed = 4
    w = (28 * 6 + 2 + 10) * PIX
    h = 11 * PIX
    for n in range(45):
        makeRunningLeds(line1, w, h, w - (1 + n) * PIX * speed + 9 * PIX,
                        2.5 * PIX, speed)
    for flash in range(4):
Esempio n. 6
0
        for ii in range(startValue, endValue + 1):
            indexI = ii - startValue
            if indexJ == 1:
                typeQualities(8, 9)
                text(f'{ii}', ((indexI + .5) * cellSize, -cellSize / 2),
                     align='center')

            with savedState():
                translate(indexI * cellSize, indexJ * cellSize)

                lineQualities()
                rect(0, 0, cellSize, cellSize)

                typeQualities(14, 14)
                openTypeFeatures(frac=False, tnum=True)
                result = func(jj, ii)

                # decimal
                if result % 1 != 0:
                    resultStr = f'{Fraction(jj, ii)}'
                    openTypeFeatures(frac=True, tnum=False)

                # big values
                elif abs(result) > 99:  # 3 digits at least (and maybe a minus)
                    txtWdt, txtHgt = textSize(f'{int(result)}')
                    bodySize = 15
                    while txtWdt > (cellSize - 4) and bodySize > 0:
                        bodySize -= .25
                        typeQualities(bodySize, bodySize)
                        txtWdt, txtHgt = textSize(f'{int(result)}')