示例#1
0
def ttt_segments(text):
    wr = ttt.SEG_Writer()
    wr.arc = False   # approximate arcs with lines
    wr.conic = False # approximate conic with arc/line
    wr.cubic = False # approximate cubic with arc/line
    wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = 50 # =10 increasesn nr of points to 366, = 5 gives 729 pts
    wr.cubic_biarc_subdivision = 10 # no effect?
    wr.cubic_line_subdivision = 10 # no effect?
    wr.scale = 1
    
    wr.setFont(3)
    # 0  freeserif
    # 1  freeserif bold
    # 2  freeserif italic
    # 3  freeserif bold italic
    # 4  "/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf" );
    # 5  "/usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf" ); 
    # 6  "/usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf" )
    # 7  "/usr/share/fonts/truetype/freefont/FreeSans.ttf" );
    # 8  "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf" );
    # 9  "/usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf" );
    # 10 "/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf" );
    
    ttt.ttt(text,wr) 
    segs = wr.get_segments()
    ext = wr.extents
    return [ext, segs]
def ttt_segments(text):
    wr = ttt.SEG_Writer()
    wr.arc = False  # approximate arcs with lines
    wr.conic = False  # approximate conic with arc/line
    wr.cubic = False  # approximate cubic with arc/line
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 50  # =10 increasesn nr of points to 366, = 5 gives 729 pts
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    wr.scale = 1

    wr.setFont(3)
    # 0  freeserif
    # 1  freeserif bold
    # 2  freeserif italic
    # 3  freeserif bold italic
    # 4  "/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf" );
    # 5  "/usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf" );
    # 6  "/usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf" )
    # 7  "/usr/share/fonts/truetype/freefont/FreeSans.ttf" );
    # 8  "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf" );
    # 9  "/usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf" );
    # 10 "/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf" );

    ttt.ttt(text, wr)
    segs = wr.get_segments()
    ext = wr.extents
    return [ext, segs]
示例#3
0
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.scale = float(1) / float(scale)
    ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
示例#4
0
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.scale = float(1) / float(scale)
    ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
def ttt_segments(text, scale, subdivision=100):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    #wr.arc = False
    #wr.conic = False
    #wr.cubic = False
    wr.scale = scale  #float(1)/float(scale)
    # "L" has 36 points by default
    #wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = subdivision  # =10 increasesn nr of points to 366, = 5 gives 729 pts

    # "C"  subd  points
    #       50   248
    #       40   311
    #       30   416
    #       20   627

    #wr.cubic_biarc_subdivision = 10 # no effect?
    #wr.cubic_line_subdivision = 10 # no effect?
    #wr.setFont(0)
    s3 = ttt.ttt(text, wr)
    exts = wr.extents
    #print exts
    segs = wr.get_segments()
    return (segs, exts)
def ttt_segments(text, scale, subdivision=100):
    """ get geometry from truetypetracer
    """
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    # wr.arc = False
    # wr.conic = False
    # wr.cubic = False
    wr.scale = scale  # float(1)/float(scale)
    # "L" has 36 points by default
    # wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = subdivision  # =10 increases nr of points to 366, = 5 gives 729 pts

    # "C"  subd  points
    #       50   248
    #       40   311
    #       30   416
    #       20   627

    # wr.cubic_biarc_subdivision = 10 # no effect?
    # wr.cubic_line_subdivision = 10 # no effect?
    # wr.setFont(0)
    # wr.setFontbyPath("/usr/share/fonts/truetype/freefont/FreeSerif.ttf")
    s3 = ttt.ttt(text, wr)
    exts = wr.extents
    # print exts
    segs = wr.get_segments()
    return (segs, exts)
示例#7
0
def draw_ttt(myscreen, text, x,y,scale):
    wr = ttt.SEG_Writer()
    #wr.arc = False
    wr.arc = True
    #wr.conic = False
    #wr.cubic = False
    wr.scale = float(1)/float(scale)
    # "L" has 36 points by default
    wr.conic_biarc_subdivision = 200 
    wr.conic_line_subdivision = 50 # this increasesn nr of points to 366
    #wr.cubic_biarc_subdivision = 10 # no effect?
    #wr.cubic_line_subdivision = 10 # no effect?
    wr.setFont(0)
    s3 = ttt.ttt(text,wr) 
    ext = wr.extents
    dx = ext.maxx-ext.minx

    segs = wr.get_segments()
    segs = translate(segs, x, y)
    print "number of polygons: ", len(segs)
    np = 0
    sum_pts=0

    segs = modify_segments(segs)
    for s in segs:
        sum_pts+=len(s)
        print " polygon ",np," has ",len(s)," points"
        np=np+1
    print "total points: ",sum_pts
    drawLoops(myscreen, segs, ovdvtk.yellow )
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 25  # this increases nr of points
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    wr.scale = float(1) / float(scale)
    wr.set_font(3)
    # 0 OK   freeserif
    # 1 OK   freeserif bold
    # 2 err  freeserif italic   (has "VX" overlap!)
    # 3 OK   freeserif bold italic
    # 4  OK  fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf" );
    # 5  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf" );  PPPSolver error?
    # 6  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf" ) error?
    # 7  OK  fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSans.ttf" );
    # 8  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf" );
    # 9  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf" );
    # 10 err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf" );
    s3 = ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
示例#9
0
def draw_ttt(myscreen, text, x, y, scale):
    wr = ttt.SEG_Writer()
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.scale = float(1) / float(scale)
    # "L" has 36 points by default
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 10  # this increasesn nr of points to 366
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    wr.set_font(2)
    s3 = ttt.ttt(text, wr)
    ext = wr.extents
    dx = ext.maxx - ext.minx

    segs = wr.get_segments()
    segs = translate(segs, x, y)
    print("number of polygons: %s" % len(segs))
    np = 0
    for s in segs:
        print(" polygon %s has %s points" % (np, len(s)))
        np = np + 1
    segs = modify_segments(segs)
    drawLoops(myscreen, segs, ovdvtk.yellow)
def ttt_segments(text,scale):
    wr = ttt.SEG_Writer()
    wr.arc = False
    wr.conic = False
    wr.cubic = False

    wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = 50 # this increases nr of points 
    wr.cubic_biarc_subdivision = 10 # no effect?
    wr.cubic_line_subdivision = 10 # no effect?
    wr.setFont(3)
    
    wr.scale = float(1)/float(scale)
    ttt.ttt(text,wr) 
    segs = wr.get_segments()
    return segs
示例#11
0
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()
    wr.arc = False
    wr.conic = False
    wr.cubic = False

    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 50  # this increases nr of points
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    wr.setFont(3)

    wr.scale = float(1) / float(scale)
    ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
def ttt_segments(text, scale, subdivision=100):
    """ get geometry from truetypetracer
    """
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    # wr.arc = False
    # wr.conic = False
    # wr.cubic = False
    wr.scale = scale  # float(1)/float(scale)
    # "L" has 36 points by default
    # wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = subdivision  # =10 increases nr of points to 366, = 5 gives 729 pts

    # "C"  subd  points
    #       50   248
    #       40   311
    #       30   416
    #       20   627

    # wr.cubic_biarc_subdivision = 10 # no effect?
    # wr.cubic_line_subdivision = 10 # no effect?
    # wr.setFont(0)
    # wr.setFontbyPath("/usr/share/fonts/truetype/freefont/FreeSerif.ttf")
    s3 = ttt.ttt(text, wr)
    exts = wr.extents
    # print exts
    segs = wr.get_segments()
    return (segs, exts)
def ttt_segments(text,scale, subdivision=100):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    #wr.arc = False
    #wr.conic = False
    #wr.cubic = False
    wr.scale = scale #float(1)/float(scale)
    # "L" has 36 points by default
    #wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = subdivision  # =10 increasesn nr of points to 366, = 5 gives 729 pts
    
    # "C"  subd  points
    #       50   248
    #       40   311
    #       30   416
    #       20   627
    
    #wr.cubic_biarc_subdivision = 10 # no effect?
    #wr.cubic_line_subdivision = 10 # no effect?
    #wr.setFont(0)
    s3 = ttt.ttt(text,wr)
    exts = wr.extents
    #print exts
    segs = wr.get_segments()
    return (segs,exts)
示例#14
0
def draw_ttt(myscreen, text, x, y, scale):
    wr = ttt.SEG_Writer()
    # wr.arc = False
    wr.arc = True
    # wr.conic = False
    # wr.cubic = False
    wr.scale = float(1) / float(scale)
    # "L" has 36 points by default
    wr.conic_biarc_subdivision = 200
    wr.conic_line_subdivision = 50  # this increasesn nr of points to 366
    # wr.cubic_biarc_subdivision = 10 # no effect?
    # wr.cubic_line_subdivision = 10 # no effect?
    wr.setFont(0)
    s3 = ttt.ttt(text, wr)
    ext = wr.extents
    dx = ext.maxx - ext.minx

    segs = wr.get_segments()
    segs = translate(segs, x, y)
    print "number of polygons: ", len(segs)
    np = 0
    sum_pts = 0

    segs = modify_segments(segs)
    for s in segs:
        sum_pts += len(s)
        print " polygon ", np, " has ", len(s), " points"
        np = np + 1
    print "total points: ", sum_pts
    drawLoops(myscreen, segs, ovdvtk.yellow)
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 25  # this increases nr of points 
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    wr.scale = float(1) / float(scale)
    wr.setFont(3)
    # 0 OK   freeserif
    # 1 OK   freeserif bold
    # 2 err  freeserif italic   (has "VX" overlap!)
    # 3 OK   freeserif bold italic
    # 4  OK  fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf" );
    # 5  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf" );  PPPSolver error?
    # 6  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf" ) error?
    # 7  OK  fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSans.ttf" );
    # 8  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf" );
    # 9  err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf" );
    # 10 err fonts.push_back( "/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf" );
    s3 = ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
示例#16
0
def test_basic():
    t = ttt.ngc("a")
    print(t)

    s = ttt.dxf()
    print(s)
    s2 = ttt.dxf("a")
    f = open('test.dxf', 'w')
    f.write(s2)

    wr = ttt.NGC_Writer()
    s3 = ttt.ttt("a", wr)
    print(s3)

    wr = ttt.SEG_Writer()

    # wr.scale = 1
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    s3 = ttt.ttt("LT", wr)
    print(s3)
示例#17
0
def ttt_segments(text,scale):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.scale = float(1)/float(scale)
    # "L" has 36 points by default
    wr.conic_biarc_subdivision = 10 # this has no effect?
    wr.conic_line_subdivision = 50 # =10 increasesn nr of points to 366, = 5 gives 729 pts
    wr.cubic_biarc_subdivision = 10 # no effect?
    wr.cubic_line_subdivision = 10 # no effect?
    s3 = ttt.ttt(text,wr) 
    segs = wr.get_segments()
    return segs
示例#18
0
def ttt_segments(text, scale):
    wr = ttt.SEG_Writer()

    # wr.scale = 3
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    wr.scale = float(1) / float(scale)
    # "L" has 36 points by default
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = 50  # =10 increasesn nr of points to 366, = 5 gives 729 pts
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    s3 = ttt.ttt(text, wr)
    segs = wr.get_segments()
    return segs
示例#19
0
def test_seg_writer():
    #wr = ttt.NGC_Writer()
    wr = ttt.SEG_Writer()

    # wr.scale = 1
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    s3 = ttt.ttt("LT", wr)
    print(s3)
    s = wr.get_segments()
    print(s)
    e = wr.extents
    print("number of segments %s" % len(s))
    print(e)
    print("extents max x %s" % e.maxx)
    print("extents min x %s" % e.minx)
    print("extents max y %s" % e.maxy)
    print("extents min y %s" % e.miny)
def ttt_geometry(text_string="TEST", text_scale=1, subdiv=10):
    """ get geometry from truetypetracer
    """
    wr = ttt.SEG_Writer()
    wr.scale = text_scale
    wr.arc = False
    wr.conic = False
    wr.cubic = False
    
    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = subdiv  # this increasesn nr of points to 366
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    #wr.setFont(2)
    
    s3 = ttt.ttt(text_string,wr)
    print s3
    segments = wr.get_segments()
    # format is 
    # (x, y, r, cw(bool), cx, cy)
    #e = wr.extents
    print "number of loops ",len(segments)
    return segments
示例#21
0
def ttt_geometry(text_string="TEST", text_scale=1, subdiv=10):
    """ get geometry from truetypetracer
    """
    wr = ttt.SEG_Writer()
    wr.scale = text_scale
    wr.arc = False
    wr.conic = False
    wr.cubic = False

    wr.conic_biarc_subdivision = 10  # this has no effect?
    wr.conic_line_subdivision = subdiv  # this increasesn nr of points to 366
    wr.cubic_biarc_subdivision = 10  # no effect?
    wr.cubic_line_subdivision = 10  # no effect?
    #wr.setFont(2)

    s3 = ttt.ttt(text_string, wr)
    print(s3)
    segments = wr.get_segments()
    # format is
    # (x, y, r, cw(bool), cx, cy)
    #e = wr.extents
    print("number of loops %s" % len(segments))
    return segments
示例#22
0
import truetypetracer as ttt

t = ttt.ngc("a")
print t

s = ttt.dxf()
print s
s2 = ttt.dxf("a")
f = open('test.dxf', 'w')
f.write(s2)

wr = ttt.NGC_Writer()
s3 = ttt.ttt("a",wr)
print s3


wr = ttt.SEG_Writer()

# wr.scale = 1
wr.arc = False
wr.conic = False
wr.cubic = False
s3 = ttt.ttt("LT",wr)
print s3

示例#23
0
import truetypetracer as ttt

#wr = ttt.NGC_Writer()
wr = ttt.SEG_Writer()

# wr.scale = 1
wr.arc = False
wr.conic = False
wr.cubic = False
s3 = ttt.ttt("LT", wr)
print s3
s = wr.get_segments()
print s
e = wr.extents
print e
print e.maxx
print e.minx
print e.maxy
print e.miny
示例#24
0
import truetypetracer as ttt

#wr = ttt.NGC_Writer()
wr = ttt.SEG_Writer()

# wr.scale = 1
wr.arc = False
wr.conic = False
wr.cubic = False
s3 = ttt.ttt("LT",wr)
print s3
s = wr.get_segments()
print s
e = wr.extents
print e
print e.maxx
print e.minx
print e.maxy
print e.miny