Implementing Vector Fonts

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Implementing Vector Fonts

Postby BasicCoder2 » Jan 29, 2015 2:17

This is my effort to implement a vector graphic character set.
In this demo example the font is of fixed width and so far I have only completed the numeral characters and capital letters.
The size can be adjusted with the mag variable and I will include another line routine which can use larger pen sizes.
In use a program would simply load the character set from the HD and use the printString()

Edited in suggestions and example provided by Quark.

Code: Select all

screenres 640,480,32
dim shared as integer charSet(128,100)  'char data

dim as integer i,x,y

for j as integer = 65 to 90   'read each capital letter data
    i = 0   'first number
    do
        read x
        charSet(j,i)=x
        i = i + 1
        read y
        charSet(j,i)=y
        i = i + 1     
    loop while y<>-2
    print
next j

for j as integer = 48 to 57   'read each numeral data
    i = 0   'first number
    do
        read x
        charSet(j,i)=x
        i = i + 1
        read y
        charSet(j,i)=y
        i = i + 1     
    loop while y<>-2
    print
next j

sub printString(s as string,xp as integer ,yp as integer,mag as single)
    dim as string  c
    dim as integer n,j,inc
    dim as integer x1,y1,x2,y2
    for ii as integer = 1 to len(s)   
        c = mid(s,ii,1)
        n = 0  'default to "0" for the time being
        if (c>="A" and c<="Z") or (c>="0" and c<="9") then
            n = asc(c)
        end if
       
        'PRINT CHAR n
        j = 0
        do
            x1 = charSet(n,j):j=j+1
            y1 = charSet(n,j):j=j+1
            x2 = charSet(n,j):j=j+1
            y2 = charSet(n,j):j=j+1

            while x2>-1
                line (x1*mag+xp,y1*mag+yp)-(x2*mag+xp,y2*mag+yp),rgb(100,255,100)
                x1 = x2
                y1 = y2
                x2 = charSet(n,j):j=j+1
                y2 = charSet(n,j):j=j+1
            wend
        loop until y2=-2
        xp = xp + mag*8+8
    next ii
end sub

Dim As String s
Dim As Single mag = .2
s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
For i As Integer = 0 To 9
  mag + = .15
  'printstring(string,x,y,mag)
  printString(s,4,i*40,mag)
Next


sleep
'A
data 0,16, 0,3, 1,1, 3,0,5,0,7,1, 8,3, 8,16, -1,-1, 0,8, 8,8, -2,-2
'B
data 0,8, 0,0, 5,0, 7,1, 8,3, 8,5, 7,7, 5,8, 0,8, 0,16, 5,16, 7,15, 8,13, 8,11, 7,9, 5,8, -2,-2
'C
data 8,3, 7,1, 5,0, 3,0, 1,1, 0,3, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, -2,-2
'D
data 0,0, 4,0, 6,1, 7,2, 8,4, 8,12, 7,14, 6,15, 4,16, 0,16, 0,0, -2,-2
'E
data 8,0, 0,0, 0,16, 8,16, -1,-1, 0,8, 6,8, -2,-2
'F
data 8,0, 0,0, 0,16, -1,-1, 0,8, 6,8, -2,-2
'G
data 8,3, 7,1, 5,0, 3,0, 1,1, 0,3, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, 8,10, 4,10, 4,12, -2,-2
'H
data 0,0, 0,16, -1,-1, 8,0, 8,16, -1,-1, 0,8, 8,8, -2,-2
'I
data 2,0, 6,0, -1,-1, 4,0, 4,16, -1,-1, 2,16, 6,16, -2,-2
'J
data 8,0, 8,12, 7,14, 6,15, 4,16, 2,15, 1,14, 0,12, -2,-2
'K
data 0,0, 0,16, -1,-1, 8,0, 0,7, 8,16, -2,-2
'L
data 0,0, 0,16, 8,16, -2,-2
'M
data 0,16, 0,0, 4,7, 8,0, 8,16, -2,-2
'N
data 0,16, 0,0, 8,16, 8,0, -2,-2
'O
data 0,3, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, 8,3, 7,1, 5,0, 3,0, 1,1, 0,3, -2,-2
'P
data 0,16, 0,0, 5,0, 7,1, 8,3, 8,5, 7,7, 5,8, 0,8, -2,-2
'Q
data 0,3, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, 8,3, 7,1, 5,0, 3,0, 1,1, 0,3, -1,-1, 4,12, 8,16, -2,-2
'R
data 0,16, 0,0, 4,0, 6,1, 7,2, 8,4, 7,6, 6,7, 4,8, 8,16, -1,-1, 0,8, 4,8, -2,-2
'S
data 8,2, 7,1, 5,0, 3,0, 1,1, 0,3, 0,5, 1,7, 3,8, 5,8, 7,9, 8,11, 8,13, 7,15, 5,16, 3,16, 1,15, 0,14, -2,-2
'T
data 0,0, 8,0, -1,-1, 4,0, 4,16, -2,-2
'U
data 0,0, 0,12, 1,14, 2,15, 4,16, 6,15, 7,14, 8,12, 8,0, -2,-2
'V
data 0,0, 4,16, 8,0, -2,-2
'W
data 0,0, 0,16, 4,9, 8,16, 8,0, -2,-2
'X
data 0,0, 8,16, -1,-1, 8,0, 0,16, -2,-2
'Y
data 0,0, 4,8, 8,0, -1,-1, 4,8, 4,16, -2,-2
'Z
data 0,0, 8,0, 0,16, 8,16, -2,-2


'0
data 0,3, 1,1, 3,0, 5,0, 7,1, 8,3, 8,13, 7,15, 5,16, 3,16, 1,15, 0,13, 0,3, -2,-2
'1
data 2,2, 4,0, 4,16, 2,16, 6,16, -2,-2
'2
data 0,3, 1,1, 3,0, 5,0, 7,1, 8,5, 7,7, 0,13, 0,16, 8,16, -2,-2
'3
data 0,3, 1,1, 3,0, 5,0, 7,1, 8,3, 8,5, 7,7, 4,8, 7,9, 8,11, 8,13, 7,15, 5,16, 3,16, 1,15, 0,13, -2,-2
'4
data 8,8, 0,8, 5,0, 5,16, -2,-2
'5
data 8,0, 0,0, 0,5, 4,5, 6,6, 7,7, 8,9, 8,12, 7,14, 6,15, 4,16, 2,15, 0,12,-2,-2
'6
data 7,1, 5,0, 3,0, 1,1, 0,3, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, 8,11, 7,9, 5,8, 0,8,  -2,-2
'7
data 0,1, 2,0, 8,0, 4,16, -2,-2
'8
data 3,8, 5,8, 7,7, 8,5, 8,3, 7,1, 5,0, 3,0, 1,1, 0,3, 0,5, 1,7, 3,8, 2,9, 0,11, 0,13, 1,15, 3,16, 5,16, 7,15, 8,13, 8,11, 7,9, 5,8, -2,-2
'9
data 8,8, 3,8, 1,7, 0,6, 0,3, 1,1, 3,0, 5,0, 7,1, 8,3, 8,13, 7,15, 5,16, 3,16, 1,15, -2,-2

Last edited by BasicCoder2 on Feb 08, 2015 19:44, edited 2 times in total.
Tyr_Anassazi
Posts: 28
Joined: Jul 01, 2013 15:01
Location: Russia, Novosibirsk
Contact:

Re: Implementing Vector Fonts

Postby Tyr_Anassazi » Jan 29, 2015 8:35

Good job!
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Implementing Vector Fonts

Postby BasicCoder2 » Jan 29, 2015 9:03

@Tyr_Anassazi,
Glad you like it. The impetus behind it was to provide vector fonts for retro-style games without having to include some library.
I have just changed the characters to be more rounded.
Hopefully I will make it a full ascii char set and add the option to change the pen thickness, color and perhaps a text box demo using the printString() routine.
I3I2UI/I0
Posts: 90
Joined: Jun 03, 2005 10:39
Location: Germany

Re: Implementing Vector Fonts

Postby I3I2UI/I0 » Jan 29, 2015 13:29

a QB - FB vector font:

Code: Select all

ScreenRes 640,100

Dim Shared Zeichen(32 To 252) As String
Zeichen(32) = "BR4"'space
Zeichen(33) = "BD U BU U7 BD8 BR4"'!
Zeichen(34) = "BU7DD BR2UU BD7 BR3"'"

Zeichen(36) = "FRREUUHLLHUUERRF BH BL BUD10 BU2 BR6"'$

Zeichen(38) = "BD BR6H5ERFG3DFRE3 BD2 BR4"'&
Zeichen(39) = "BR2 BU7DG BD5 BR4"
Zeichen(40) = "BUU4EEGGD4FF BU BR4"'(
Zeichen(41) = "BR2 BUU4HHFFD4GG BU BR6"')
Zeichen(42) = "BR2U6D3LLR4 BL4 BD2E4 BL4F4 BD BR4"'*
Zeichen(43) = "BR BU3RR BU2D3D BU2RR BD3 BR5"'+
Zeichen(44) = "BR2LURDDG BU2 BR4"',
Zeichen(45) = "BR BU3 R4 BD3 BR5"'-
Zeichen(46) = "BR BDLURD BU BR4"'.

Zeichen(48) = "BD BUU6ERRFD6GLLH BR6"'0
Zeichen(49) = "BD BR2U7 BLED BD6 BR3"'1
Zeichen(50) = "BR BU6ERRFDDG4DRR3 BU BR3"'2
Zeichen(51) = "BU6ERRFDDGLLRRFDDGLLH BR7"'3
Zeichen(52) = "BU3E4DD7U4L4R5 BD3 BR3"'4
Zeichen(53) = "BR BU3U4R4L4D4ERRFD3GLLH BR7"'5
Zeichen(54) = "BR BD BU4U3ERRFHLLGD6FRREU3HLLG BD3 BR6"'6
Zeichen(55) = "BR BU7 R4 D3 G4D BU BR7"'7
Zeichen(56) = "BR BU6ERRFDDGLLRRFDDGLLHUUEHUU BD6 BR7"'8
Zeichen(57) = "BR BU4UUERRF D6 GLLH BU4F R3 BD3 BR3"'9
Zeichen(58) = "BR U BU2 U BD4 BR3"':
Zeichen(59) = "BD2 E U BU2 U BD3 BR3"';

Zeichen(60) = "E7D5R9D4L9LD5H7 BR"                             '< graphic
Zeichen(61) = "BU3 R4 BD2 L4 BR7 BD"'=
Zeichen(62) = "UUR10U5F7G7U5L11U3 BR8"                           '> graphic
Zeichen(63) = ""'?

Zeichen(65) = "BDU7E R3F D3 BL5R5 D4 BR4 BU"'A
Zeichen(66) = "BDU8 R4FDDG L4 R4FDDG L4 BU BR8 BR"'B
Zeichen(67) = "BD BUU6E R3F BD6G L3HF R3 BR4 BU"'C
Zeichen(68) = "BDU8 R4F D6 G L4 BR8 BR BU"'D
Zeichen(69) = "BDU8 R4 L4 D4 R3 L3 D4 R4 BU BR4"'E
Zeichen(70) = "BDU8 R5 L5 D4 R4 L4 D4 BR8 BU"'F
Zeichen(71) = "BD BUU6E R3F BD6G L3HF R3EU3LLRR D3 BR4"'G
Zeichen(72) = "BDU8 D4 R4U4D8 BR4 BU"'H
Zeichen(73) = "BD BRU8LRRLD8 LRR BR4 BU"'I
Zeichen(74) = "BD BUFRREU7LRRL D7 BR5"'J
Zeichen(75) = "BD BU8D8 U4R E4 G4 F4 BR4 BU"'K
Zeichen(76) = "BD BU8D8 R4 BU BR4"'L
Zeichen(77) = "BDU7ERRF D7 U7ERRF D7 BU BR4"'M
Zeichen(78) = "BDU8D F5 DDU8D8 BR4 BU"'N
Zeichen(79) = "BD BUU6E R3F BD6G L3H BR5U6 D6 BR4"'O
Zeichen(80) = "BDU8 R4FDDG L4 D4 BR8 BR BU"'P
Zeichen(81) = "BD BUU6E R3F BD6G L3H BR5U6 BL3 BD5 F3 BG BG BG BR7 BU5"'Q
Zeichen(82) = "BDU8 R4FDDG L4R F4 BR4 BU"'R
Zeichen(83) = "BD BU5UUE R3F BD2 BL5F R3FDDG L3H BR8 BR"'S
Zeichen(84) = "BR3 BD BU8 L4 R6 L3D8 BR6 BU"'T
Zeichen(85) = "BD BUU6U D7 F R3EU7 D7 BR4"'U
Zeichen(86) = "BD BU8D5FFDUEEU5D5 BR5 BD2"'V
Zeichen(87) = "BD BUU7 D7 FRREU7D7FRREU7D7 BD BR4 BU"'W
Zeichen(88) = "BD BU8D F3 E3UD G6 DU E3 F3D BU BR5"'X
Zeichen(89) = "BL BU5UUDD F3 E3UUDD G3 D3 BU BR7"'Y
Zeichen(90) = "BU7 R5DD G5 D R5 BR4 BU"'Z
Zeichen(91) = "BU7RR BD8U8RR BD8U8RR BD8U8RR BD8U8RR BD8U8RRD8 LLUU BR2LLUU BR2LLUU BR2LLUU BR2LL BR4 BD7" '[

Zeichen(93) = "BU5 R10 D6 L10 U6 BD5 BR4"                             '] graphic
Zeichen(94) = "E6F6LL BR5"                                      '^ graphic


Zeichen(97) = "UUE R3UHLLGERRF D4GLLHF BR2EUU D3 BR4 BU"'a
Zeichen(98) = "BDU8D8 R3EU4HLLG D4 BR8"'b
Zeichen(99) = "U4ERRF BD4GLLHFRRE BR4"'c
Zeichen(100) = "U4ERRFHLLG D4FRREU7D8 BU BR4"'d
Zeichen(101) = "U4ERRFDD L4DDFRRE BR4"'e
Zeichen(102) = "BR BDU7ERRFHLLG D3L R3 BD3 BR5"'f
Zeichen(103) = "U4ERRF D4GLLH BD3FRREU3 BR4"'g
Zeichen(104) = "BU7D8 U5ERRF D5 BU BR4"'h
Zeichen(105) = "BDU5 BU2U BD7 BR4"'i
Zeichen(106) = "BDU5 BU2U BD7 D3GLL BU4 BR7"'j
Zeichen(107) = "BD BU8D8 U3 E3 G3 F3 BU BR3"'k
Zeichen(108) = "BR BDU8LRD8 LRR BR4 BU"'l
Zeichen(109) = "BDU6DERF D5U5ERF D5 BU BR4"'m
Zeichen(110) = "BDU6DERRF D5U4 BD3 BR4"'n
Zeichen(111) = "U4ERRF D4GLLH BR8"'o
Zeichen(112) = "U4ERRF D4GLLH D4U4 BR8"'p
Zeichen(113) = "U4ERRF D4GLLH BR4 D4LRRLU4 BR4"'q
Zeichen(114) = "BDU6DERRFHLLGU D6 BU BR8"'r
Zeichen(115) = "BU3UERRFHLLGDFRRFDGLLH BR8"'s
Zeichen(116) = "BR BU7DDLL R4LL D5FRE BR4"'t
Zeichen(117) = "U5 D5FRREU5 D5 BR4"'u
Zeichen(118) = "BD BU6 D3FDFDUEUEU3 D3 BD2 BR4"'v
Zeichen(119) = "BD BU6 D5FREU4 D4FREU5 D5 BR4"'w
Zeichen(120) = "BD BU6DFFEEUD G4 DUEEFFD BU BR4"'x
Zeichen(121) = "BU5 D5FRRE U5 D8 GLLH BU3 BR8"'y
Zeichen(122) = "BU5 R4D G4 DR4 BU BR4"'z

Zeichen(196) = "BDU6 BU2UD BD2EERFF BU2UD BD2DD BL5 R5 D4 BR4 BU"'Ä
Zeichen(214) = "U5 BU2UD BD2E R3F BD5G L3H BR5U5 BU2UD BD2D5 BR4"'O
Zeichen(220) = "U6 BEUD BG D6F R3EU6 BHUD BF D6 BR4"'Ü
Zeichen(223) = "D4U11ERRFDDGLRFD3GL BU BR6"'ß
Zeichen(228) = "UUE R3UHLLGE BU2UD BD2RR BU2UD BD2FD4GLLHF BR2EUU D3 BR4 BU"'ä
Zeichen(246) = "U4 BU3UD BD3ERRF BU3UD BD3D4GLLH BR8"'ö
Zeichen(252) = "U5 BU2UD BD2D5FRREU5 BU2UD BD2D5 BR4"'ü

Function form (Text As String, size As Byte =4, spacing As Byte =1, angle As Byte =0)As String
  Dim As String t,c
  Dim i As Integer
  form = ""
  If text = "" Then Exit Function
  If angle > 3 Then angle Mod= 4
  If spacing >0 Then c ="BR" + Str(spacing)
  If spacing <0 Then c ="BL" + Str(Abs(spacing))
  t = "S" + Str(size)
  For i = 1 To Len(text)
    t = "A" + Str(angle) + (t + Zeichen(Asc(Mid(text, i, 1))) + c)
  Next
  form = t
End Function

Dim As String text,c1,c2,c3,c4
'Color
c1="C" +Str(RGB(255,255,255))
c2="C" +Str(RGB(0,255,155))
c3="C" +Str(RGB(255,0,155))
c4="C" +Str(RGB(150,150,150))

text= form ( "!$&+-.,()*",8,5)
PSet (10,30), -1: Draw text
text= form ( "Sylvia wagt quick den Jux bei Pforzheim.", 8)
PSet (10,60), -1: Draw text
text= form ( "ÄÖÜäöüß",8)
PSet (10,90), -1: Draw c4 + text
Sleep
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Implementing Vector Fonts

Postby BasicCoder2 » Jan 29, 2015 19:15

I3I2UI/I0 wrote:a QB - FB vector font:

Ausgezeichnet!
Quark
Posts: 474
Joined: May 27, 2011 18:16
Location: Pennsylvania, U.S.
Contact:

Re: Implementing Vector Fonts

Postby Quark » Feb 06, 2015 1:40

.
@BasicCoder2

It is useful to use a SINGLE or DOUBLE for the mag variable -- much better control over sizes of font.

Having set mag variable as SINGLE in printString(), i inserted this code to make a set of 10 lines of increasing size:

Code: Select all

Dim As String s
Dim As Single mag = .2
s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
For i As Integer = 0 To 9
  mag + = .15
  printString(s,4,i*40,mag)
Next

.
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Implementing Vector Fonts

Postby BasicCoder2 » Feb 08, 2015 19:49

@Quark,
Thanks. I have implemented your suggestions in the first post along with your example.
Maybe when/if I revisit the program I will clean up the curves , add line thickness and create full ASCII sets.
Quark
Posts: 474
Joined: May 27, 2011 18:16
Location: Pennsylvania, U.S.
Contact:

Re: Implementing Vector Fonts

Postby Quark » Feb 08, 2015 22:19

.
@BasicCoder2

if I revisit the program I will clean up the curves , add line thickness and create full ASCII sets.


Hope you do -- I'll use it.
.
dodicat
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Implementing Vector Fonts

Postby dodicat » Feb 08, 2015 22:58

Five or six years ago I posted a Pseudo Font, strangely enough the sub was called paintstring also.
The original post is still there but this crappy code block on the forum these days has it corrupted.

It took a while to draw all the keyboard characters, I have hardly ever used it.
Mainly it draws enlarged text, it doesn't go small.
Here is that sub and a few lines of text.

Code: Select all

 '__ START OF PAINTSTRING ___________________________
Dim Shared np(1 To 4) As Double
Sub rotate(Byval pivot_x As Double,_   'turns about this point
    Byval pivot_y As Double,_
    Byval first_x As Double,_    'centre for circles
    Byval first_y As Double,_
    Byval second_x As Double, _   'radius for circles
    Byval second_y As Double, _   'aspect
    byval arc_1 as double,_       'arcs only for circle, 0 for lines
    byval arc_2 as double,_
    Byval angle As Double, _      'all below for circles and lines
    Byval magnifier As Double,_
    Byval dilator as double,_
    Byval colour As Integer,_
    byval thickness as double,_
    Byref shape As String,_
    image as any pointer=0)
   
    shape=lcase$(shape)     
    Dim As Double p = 4*Atn(1),radians,LX,LY,PX,PY,th=thickness,sx=second_x
    angle=angle mod 360
    radians=(p/180)*angle      'change from degrees to radians
    #Macro thickline(t)
    Dim As Double s,h,c
    Dim As Uinteger prime=rgb(255,255,255)
    h=Sqr(((np(1))-(np(3)))^2+((np(2))-(np(4)))^2)
    s=((np(4))-np(2))/h
    c=(np(1)-(np(3)))/h
    for x as integer=1 to 2
        line image, (np(3)+s*t/2,np(4)+c*t/2)-(np(1)+s*t/2,np(2)+c*t/2),prime
        line image, (np(3)-s*t/2,np(4)-c*t/2)-(np(1)-s*t/2,np(2)-c*t/2),prime
        line image, (np(3)+s*t/2,np(4)+c*t/2)-(np(3)-s*t/2,np(4)-c*t/2),prime
        line image, (np(1)+s*t/2,np(2)+c*t/2)-(np(1)-s*t/2,np(2)-c*t/2),prime
        paint image,((np(3)+np(1))/2, (np(4)+np(2))/2),prime,prime
        prime=colour
    next x
    #EndMacro
   
    #macro thickcircle(t)
    Dim As Uinteger prime=rgb(255,255,255)
    dim as double xp1,xp2,yp1,yp2
    dim arc1 as double=arc_1*p/180
    dim arc2 as double=arc_2*p/180
    arc1=2*p+(arc1-(radians))
    arc2=2*p+(arc2-(radians))
    sx=sx*magnifier
    if arc1=arc2 then
        for x as integer=1 to 2
            circle image,(np(3),np(4)),sx+t/2,prime,,,second_y
            circle image,(np(3),np(4)),sx-t/2,prime,,,second_y
            paint image,(np(3),np(4)+sx),prime,prime
            paint image,(np(3)+sx,np(4)),prime,prime
            prime=colour
        next x
       
    end if
    if arc1<>arc2 then
        xp1=np(3)+(sx)*cos(.5*(arc2+arc1))
        yp1=np(4)-(sx)*sin(.5*(arc2+arc1))
        for x as integer=1 to 2
        circle image,(np(3),np(4)),sx+t/2,prime,arc1,arc2,second_y
        circle image,(np(3),np(4)),sx-t/2,prime,arc1,arc2,second_y
        line image,(np(3)+(sx+t/2)*cos(arc1),np(4)-(sx+t/2)*sin(arc1))-(np(3)+(sx-t/2)*cos(arc1),np(4)-(sx-t/2)*sin(arc1)),prime
        line image,(np(3)+(sx+t/2)*cos(arc2),np(4)-(sx+t/2)*sin(arc2))-(np(3)+(sx-t/2)*cos(arc2),np(4)-(sx-t/2)*sin(arc2)),prime
        paint image,(xp1,yp1),prime,prime
        prime=colour
        next x
    end if
    #endmacro
    magnifier=dilator*magnifier     
    PX=(first_x-pivot_x)*dilator
    PY=(first_y-pivot_y)*dilator
    LX=magnifier*(second_x-first_x)                 
    LY=magnifier*(second_y-first_y)                 
    np(1)=cos(radians)*(LX+PX)-sin(radians)*(LY+PY)+pivot_x
    np(2)=sin(radians)*(LX+PX)+cos(radians)*(LY+PY)+pivot_y
    np(3)=Cos(radians)*PX-sin(radians)*PY +pivot_x
    np(4)=sin(radians)*PX+Cos(radians)*PY +pivot_y
    Select Case shape
    Case "line"
        If th<2 Then
            line image,(np(3),np(4))-(np(1),np(2)),colour
        Else
            thickline(th)   
        End If
    Case "circle"
        dim arc1 as double=arc_1*p/180
        dim arc2 as double=arc_2*p/180
        if arc1=arc2 then
            If th<=3 Then
                for n as double=magnifier*sx-1 to magnifier*sx+1 step .5
                    circle image,(np(3),np(4)),n,colour,,,second_y       
                    'circle image,(np(3),np(4)),magnifier*sx,colour,,,second_y
                next n
            Else
                thickcircle(th)
            End If
            endif
            if arc1<>arc2 then
                If th<=3 Then
                    arc1=2*p+(arc1-(radians))'new
                    arc2=2*p+(arc2-(radians))'new
                    for n as double=magnifier*sx-1 to magnifier*sx+1 step .5
                        circle image,(np(3),np(4)),n,colour,arc1,arc2,second_y   
                        ' circle image,(np(3),np(4)),magnifier*sx,colour,arc1,arc2,second_y
                    next n
                else
                    thickcircle(th)
                end if
            end if
        Case "circlefill"
            dim as double xp1,xp2,yp1,yp2
            Dim As Uinteger prime=rgb(255,255,255)
            dim arc1 as double=arc_1*p/180
            dim arc2 as double=arc_2*p/180
            if arc1=arc2 then circle image,(np(3),np(4)),magnifier*sx,colour,,,second_y,F
            if arc1<>arc2 then
                xp1=np(3)+magnifier*sx*cos(.5*(arc2+arc1))*3/4
                yp1=np(4)-magnifier*sx*sin(.5*(arc2+arc1))*3/4
                for x as integer=1 to 2
                circle image,(np(3),np(4)),magnifier*sx,prime,arc1,arc2,second_y
                line image,(np(3),np(4))-(np(3)+magnifier*sx*cos(arc2),np(4)-magnifier*sx*sin(arc2)),prime
                line image,(np(3),np(4))-(np(3)+magnifier*sx*cos(arc1),np(4)-magnifier*sx*sin(arc1)),prime
                paint image,(xp1,yp1),prime,prime
                prime=colour
                next x
            end if
            Case"box"
            line image,(np(3),np(4))-(np(1),np(2)),colour,b
        Case "boxfill"
            line image,(np(3),np(4))-(np(1),np(2)),colour,bf
        Case "linepoint","circlepoint"
            'nothing drawn
        Case "linepointset","circlepointset"
            If shape="linepointset" Then
                Pset image,(np(1),np(2)),colour
                Pset image,(np(3),np(4)),colour
                Endif
                If shape="circlepointset" Then
                    Pset image,(np(3),np(4)),colour
                End If
            Case Else
                Print "unknown rotation shape"
            End Select
        End Sub
dim shared as double next_x,next_y


sub paintstring(x as double,_
           y as double,_
           s as string,_
           size as double,_
           c as uinteger,_
           line_angle as double=0,_
           char_angle as double=0,_
           thickness_tweak as double=1,_
           image as any pointer=0)
dim l as integer=len(s)
dim px as double=16*size+x
y=y+16*size
dim py as double=y'16*size+y
dim z as integer=0
dim th as double'=4
th=((.5-size)/4.5+5)*thickness_tweak
dim sp as double=6
dim sp2 as double=6
dim pi as double=4*atn(1)
dim la as double=(line_angle *.5)
dim ca as double=(char_angle*.5)
sp2=sp2+30*abs(sin(ca*pi/180-la*pi/180))

#macro set(x1,y1,x2,y2,sarc,earc,shape,im)
rotate(px,py,x1,y1,x2,y2,sarc,earc,-char_angle,1,size,c,th*size,shape,im)
#endmacro

#macro spaces(xpixels,ypixels)
px=px+(xpixels*size+sp2*size)*cos(line_angle*pi/180)
py=py-(ypixels*size+sp2*size)*sin(line_angle*pi/180)
next_x=px-16*size
next_y=py-16*size
#endmacro

for n as integer=1 to l
   
    select case mid$(s,n,1)
    case " "
 spaces(20,20)

 
case "|"
 z=z+1
 px=(x+16*size+z*16*sin(line_angle*pi/180))+1.3*z*(24*size+size*sp*size)*sin(line_angle*pi/180)
 py=(y+z*16*cos(line_angle*pi/180))+1.3*z*(24*size+size*sp*size)*cos(line_angle*pi/180)
 next_x=px-16*size
next_y=py-16*size
case "1"
 set(px-8,py-18,px-8,py+16,.0,.0,"line",image)'vert
 set(px-8,py-16,px-12,py-8,.0,.0,"line",image)
 spaces(12,12)
case "2"
 set(px-2,py-8,9,1,310,530,"circle",image)'curve
 set(px-15,py+14,px+5,py-2,.0,.0,"line",image)
 set(px-16,py+14,px+10,py+14,.0,.0,"line",image)'base
 spaces(28,28)
case "3"
 set(px-2,py-7,9,1,300,530,"circle",image)'curve top
 set(px-2,py+6,9,1,190,395,"circle",image)'curve
 set(px-3,py,px+5,py,.0,.0,"line",image)
 spaces(28,28)
case "4"
 set(px-16,py+4,px+12,py+4,.0,.0,"line",image)'horiz
 set(px-14,py+4,px+4,py-16,.0,.0,"line",image)'slope
 set(px+4,py-18,px+4,py+16,.0,.0,"line",image)
 spaces(28,28)
case "5"
 set(px-14,py-16,px+6,py-16,.0,.0,"line",image)'top
 set(px-12,py-16,px-12,py+1,.0,.0,"line",image)'vert
 set(px-4,py+6,9,1,210,500,"circle",image)'curve
 spaces(28,28)
case "6"
 set(px-2,py+6,9,1,360,360,"circle",image)'curve base
 set(px+16,py+4,27,1,130,180,"circle",image)'curve edge
 spaces(28,28)
case "7"
 set(px-14,py-16,px+6,py-16,.0,.0,"line",image)'top
 set(px+5,py-16,px-12,py+16,.0,.0,"line",image)'slope
 spaces(26,26)
case "8"
 set(px-2,py-7,9,1,320,575,"circle",image)'curve top
 set(px-2,py+6,9,1,130,415,"circle",image)'curve
 set(px-9,py-1,px+6,py-1,.0,.0,"line",image)
 spaces(28,28)
 
case "9"
 set(px-2,py-6,9,1,360,360,"circle",image)'top
 set(px-20,py-4,27,1,310,360,"circle",image)
 spaces(28,28)
case "0"
 set(px,py-1,15,1,360,360,"circle",image)
 spaces(36,36)
case "."
 set(px-12,py+12,1,1,360,360,"circle",image)
 spaces(10,10)
case "A"
 set(px,py-16,px-12,py+16,.0,.0,"line",image)
 set(px,py-16,px+12,py+16,.0,.0,"line",image)
 set(px-8,py+3,px+8,py+3,.0,.0,"line",image)
 spaces(30,30)'36
 case "a"
 set(px-4,py+4,10,1,360,360,"circle",image)
 set(px+6,py-8,px+6,py+16,.0,.0,"line",image)
 spaces(26,26)
case "B"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-14,px-5,py-14,.0,.0,"line",image)'top
  set(px-12,py+14,px-5,py+14,.0,.0,"line",image)'base
  set(px-5,py-6,8,1,290,450,"circle",image)'top loop
  set(px-5,py+6,8,1,270,430,"circle",image)'base loop
  set(px-12,py,px-2,py,.0,.0,"line",image)'middle
  spaces(24,24)
case "b"
    set(px-2,py+4,10,1,360,360,"circle",image)
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)
 spaces(28,28)
case "C"
    set(px,py,14,1,60,300,"circle",image)
    spaces(25,25)
case "c"
    set(px-4,py+4,10,1,60,300,"circle",image)
    spaces(20,20)
    case "D"
  set(px-12,py-16,px-12,py+16,.0,.0,"line",image)
 set(px-5,py,14,1,270,450,"circle",image)
 set(px-12,py-14,px-5,py-14,.0,.0,"line",image)
  set(px-12,py+14,px-5,py+14,.0,.0,"line",image)
 
  'rotate(px,py,px-24,py+20,px-24,py-20,0,0,-line_angle,1,size,rgb(255,0,0),1,"line",image)
 spaces(30,30)
case "d"
 set(px-4,py+4,10,1,360,360,"circle",image)
 set(px+6,py-16,px+6,py+16,.0,.0,"line",image)
 spaces(26,26)
case "E"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-14,px+6,py-14,.0,.0,"line",image)'top
  set(px-12,py+14,px+6,py+14,.0,.0,"line",image)'base
  set(px-12,py,px-2,py,.0,.0,"line",image)'middle
  spaces(25,25)
case "e"
  set(px-4,py+4,10,1,0,320,"circle",image)
  set(px-12,py+3,px+8,py+3,.0,.0,"line",image)
  spaces(26,26)
case "F"
  set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-14,px+6,py-14,.0,.0,"line",image)'top
  set(px-12,py,px-2,py,.0,.0,"line",image)'middle
  spaces(24,24)
case "f"
  set(px-2,py-8,10,1,0,170,"circle",image)'curve
 set(px-12,py-10,px-12,py+16,.0,.0,"line",image)'vert
 set(px-10,py,px-2,py,.0,.0,"line",image)'middle
 spaces(28,28)
case "G"
  set(px,py,14,1,50,350,"circle",image)
  set(px,py,px+16,py,.0,.0,"line",image)
    spaces(35,35)
case "g"
    set(px-4,py+4,10,1,360,360,"circle",image)
 set(px+6,py-6,px+6,py+20,.0,.0,"line",image)
 set(px-4,py+17,10,1,230,345,"circle",image)
 
 spaces(26,26)
case "H"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px+12,py-16,px+12,py+16,.0,.0,"line",image)'vert
 set(px-12,py,px+12,py,.0,.0,"line",image)'middle
 spaces(32,32)
case "h"
  'set(px-6,py+4,10,1,0,150,"circle",image)
  set(px-4,py+2,8,1,0,170,"circle",image)'curve right
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)
 set(px+4,py,px+4,py+16,.0,.0,"line",image)
 spaces(25,25)
case "I"
 set(px,py+16,px,py-16,.0,.0,"line",image)'vert
 set(px-12,py+14,px+12,py+14,.0,.0,"line",image)
 set(px-12,py-14,px+12,py-14,.0,.0,"line",image)
 spaces(30,30)
case "i"
  set(px-12,py-6,px-12,py+16,.0,.0,"line",image)
  set(px-12,py-14,1,1,360,360,"circle",image)
  spaces(10,10)
case "J"
    'set(px-2,py+4,12,1,200,270,"circle",image)
    set(px-7,py+8,7,1,220,355,"circle",image)
 set(px,py-16,px,py+9,.0,.0,"line",image)'vert
 set(px-12,py-14,px+12,py-14,.0,.0,"line",image)'top
 spaces(30,30)
case "j"
 set(px,py-6,px,py+20,.0,.0,"line",image)
 set(px-7,py+20,7,1,220,360,"circle",image)
 set(px,py-14,1,1,360,360,"circle",image)
 spaces(22,22)
case "K"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px+6,py-16,px-12,py,.0,.0,"line",image)'upper
 set(px+6,py+16,px-6,py-3,.0,.0,"line",image)
 spaces(25,25)
case "k"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px+3,py-6,px-12,py,.0,.0,"line",image)'upper
 set(px,py+16,px-8,py-3,.0,.0,"line",image)'lower
 spaces(20,20)
case "L"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py+14,px+6,py+14,.0,.0,"line",image)'base
 spaces(25,25)
case "l"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 spaces(10,10)
case "M"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px+12,py-16,px+12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-16,px,py,.0,.0,"line",image)'left arm
 set(px+12,py-16,px,py,.0,.0,"line",image)'right arm
 
 spaces(32,32)
case "m"
 set(px-6,py+2,6,1,0,170,"circle",image)'curve left
 set(px+6,py+2,6,1,0,170,"circle",image)'curve right
 set(px-12,py-5,px-12,py+16,.0,.0,"line",image)'vert left
 set(px+12,py,px+12,py+16,.0,.0,"line",image)'vert right
 set(px,py+16,px,py,.0,.0,"line",image)'mid arm
 spaces(32,32)
case "N"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px+12,py-16,px+12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-16,px+12,py+16,.0,.0,"line",image)'middle
 spaces(32,32)
case "n"
    set(px-4,py+2,8,1,0,170,"circle",image)'curve right
 set(px-12,py-5,px-12,py+16,.0,.0,"line",image)'vert left
 set(px+4,py+16,px+4,py,.0,.0,"line",image)'mid arm
 spaces(24,24)
case "O"
 set(px,py,14,1,360,360,"circle",image)
 spaces(36,36)
case "o"
 set(px-4,py+4,10,1,360,360,"circle",image)
 'set(px+6,py-16,px+6,py+16,.0,.0,"line",image)
 spaces(26,26)
case "P"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-14,px-5,py-14,.0,.0,"line",image)'top
  'set(px-12,py+14,px-5,py+14,.0,.0,"line",image)'base
  set(px-5,py-6,8,1,280,450,"circle",image)'top loop
  'set(px-5,py+6,10,1,270,430,"circle",image)'base loop
  set(px-12,py+2,px-2,py+2,.0,.0,"line",image)'middle
  spaces(24,24)
case "p"
 set(px-5,py+4,10,1,270,435,"circle",image)' loop
  set(px-14,py-5,px-2,py-5,.0,.0,"line",image)'top
 set(px-12,py+14,px-5,py+14,.0,.0,"line",image)'base
 set(px-12,py-6,px-12,py+26,.0,.0,"line",image)'vert
 spaces(24,24)
case "Q"
 set(px,py,14,1,360,360,"circle",image)
 set(px+5,py+20,16,1,400,460,"circle",image)
 spaces(36,36)
case "q"
 set(px-5,py+6,10,1,110,270,"circle",image)' loop
 set(px-9,py-3,px+2,py-3,.0,.0,"line",image)'top
 set(px-8,py+16,px,py+16,.0,.0,"line",image)'base
 set(px,py-3,px,py+26,.0,.0,"line",image)'vert
 spaces(20,20)
case "R"
 set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
 set(px-12,py-14,px-5,py-14,.0,.0,"line",image)'top
  'set(px-12,py+14,px-5,py+14,.0,.0,"line",image)'base
  set(px-5,py-6,8,1,290,450,"circle",image)'top loop
  'set(px-5,py+6,10,1,270,430,"circle",image)'base loop
  set(px-12,py+2,px-2,py+2,.0,.0,"line",image)'middle
  set(px-8-1+3,py+1,px+12-8-1,py+16+1-2,.0,.0,"line",image)'slope
  spaces(24,24)
case "r"
  set(px-4,py+4,10,1,30,130,"circle",image)
 set(px-12,py-8,px-12,py+16,.0,.0,"line",image)
 spaces(24,24)
case "S"
 set(px-2,py-7,8,1,20,240,"circle",image)'curve top
 set(px-2,py+6,8,1,200,500,"circle",image)'curve
 'set(px-9,py-1,px+6,py-1,.0,.0,"line",image)
 spaces(26,26)
case "s"
 set(px-4,py+4,10,1,40,140,"circle",image)'top
 set(px-1,py-4,10,1,180,240,"circle",image)'topslant
 set(px-6,py+14,10,1,20,100,"circle",image)'baseslant
 set(px-4,py+4,10,1,220,325,"circle",image)'base
 'set(px-12,py-4,px+2,py+12,.0,.0,"line",image)
 'set(px+6,py-8,px+6,py+16,.0,.0,"line",image)
 spaces(26,26)
case "T"
 set(px,py-12,px,py+16,.0,.0,"line",image)'vert
 set(px-16,py-12-2,px+16,py-12-2,.0,.0,"line",image)
 spaces(34,34)
case "t"
 set(px-12,py-16,px-12,py+10,.0,.0,"line",image)'edge
 set(px-12,py-4,px-2,py-4,.0,.0,"line",image)
 set(px-4,py+4,10,1,210,320,"circle",image)
 spaces (24,24)
case "U"
 set(px-12,py-16,px-12,py+8,.0,.0,"line",image)'vert
 set(px+12,py-16,px+12,py+8,.0,.0,"line",image)'vert
 set(px,py,14,1,205,335,"circle",image)
 'set(px-12,py,px+12,py,.0,.0,"line",image)'middle
 spaces(33,33)
case "u"
 set(px-4,py+4,10,1,210,360,"circle",image)
 set(px+6,py-6,px+6,py+16,.0,.0,"line",image)
 set(px-12,py-6,px-12,py+10,.0,.0,"line",image)'left edge
 spaces(26,26)
case "V"
 set(px,py+16,px-12,py-16,.0,.0,"line",image)
 set(px,py+16,px+12,py-16,.0,.0,"line",image)
 'set(px-8,py+3,px+8,py+3,.0,.0,"line",image)
 spaces(32,32)'36
        Case "v"
  set(px-12,py-6,px-4,py+16,.0,.0,"line",image)'left
  set(px-4,py+16,px+4,py-6,.0,.0,"line",image)
  spaces(24,24)
        Case "W"
   set(px-12,py-16,px-8,py+16,.0,.0,"line",image)'vert left
 set(px+12,py-16,px+8,py+16,.0,.0,"line",image)'vert
 set(px-8,py+16,px,py,.0,.0,"line",image)'left arm
 set(px+8,py+16,px,py,.0,.0,"line",image)'right arm
 spaces(32,32)
        Case "w"
            set(px-14,py-6,px-8,py+16,.0,.0,"line",image)'vert left
            set(px+8,py+16,px+12,py-6,.0,.0,"line",image)'vert right
            set(px-8,py+16,px,py,.0,.0,"line",image)'left arm
 set(px+8,py+16,px,py,.0,.0,"line",image)'right arm
            spaces(33,33)
        case "X"
            set(px-12,py-16,px+12,py+16,.0,.0,"line",image)
            set(px+12,py-16,px-12,py+16,.0,.0,"line",image)
            spaces(32,32)
        case "x"
            set(px-12,py-6,px+2,py+16,.0,.0,"line",image)
            set(px+2,py-6,px-12,py+16,.0,.0,"line",image)
            spaces(22,22)
        case "Y"
            set(px-12,py-16,px,py,.0,.0,"line",image)
            set(px+12,py-16,px,py,.0,.0,"line",image)
            set(px,py,px,py+16,.0,.0,"line",image)
            spaces(32,32)
        case "y"
               set(px-4,py+4,8,1,180,380,"circle",image)'top
 set(px+4,py-6,px+4,py+20,.0,.0,"line",image)'right
 set(px-6,py+17,10,1,230,345,"circle",image)'base
 set(px-12,py-6,px-12,py+4,.0,.0,"line",image)'left
 spaces(24,24)
case "Z"
 set(px-12,py-14,px+12,py-14,.0,.0,"line",image)'top
 set(px-12,py+14,px+12,py+14,.0,.0,"line",image)
 set(px+10,py-14,px-10,py+14,.0,.0,"line",image)'slope
 spaces(30,30)
case "z"
 set(px-16,py-4,px+2,py-4,.0,.0,"line",image)'top
 set(px-16,py+14,px+2,py+14,.0,.0,"line",image)'base
 set(px+1,py-5,px-14,py+14,.0,.0,"line",image)'slope
 spaces(20,20)
           
 '************************************************     
case ","
 set(px-12,py+12,px-18,py+20,.0,.0,"line",image)
 set(px-12,py+12,1,1,360,360,"circle",image)
 spaces(10,10)

 case"£"
 set(px-5,py-5,8,1,40,220,"circle",image)'top
 set(px-19-5-5,py+10-5,18,1,320,390,"circle",image)
 set(px-16,py+16,px+8,py+16,.0,.0,"line",image)'base
 set(px-16,py+2,px,py+2,.0,.0,"line",image)
 spaces(28,28)
case "$"
  set(px-2,py-7,8,1,20,240,"circle",image)'curve top
 set(px-2,py+6,8,1,200,495,"circle",image)'curve
 set(px-2,py-17,px-2,py+17,.0,.0,"line",image)
 'set(px-9,py-1,px+6,py-1,.0,.0,"line",image)
 spaces(26,26)
case "%"
 set(px-10,py-10,6,1,360,360,"circle",image)
 set(px+10,py+10,6,1,360,360,"circle",image)
 set(px+8,py-8,px-8,py+8,.0,.0,"line",image)
 spaces(33,33)
case "^"
 set(px-14,py,px-7,py-16,.0,.0,"line",image)
 set(px-7,py-16,px,py,.0,.0,"line",image)
 spaces(20,20)
 case"&"
 set(px-2,py-7,8,1,70,220,"circle",image)'curve top
 set(px-2,py+6,8,1,110,415,"circle",image)'curve
 set(px-4-4-2,py-8,px+12-4,py+16,.0,.0,"line",image)
 'set(px-9,py-1,px+6,py-1,.0,.0,"line",image)
 spaces(28,28)
case "*"
 set(px-12,py-6-8,px+2,py+16-8,.0,.0,"line",image)
            set(px+2,py-6-8,px-12,py+16-8,.0,.0,"line",image)
            set(px-16,py-3,px+6,py-3,.0,.0,"line",image)
            spaces(24,24)
        case "("
            set(px+22,py,38,1,150,210,"circle",image)
            spaces(12,12)
        case ")"
       set(px-22-16-6,py,38,1,330,390,"circle",image)
            spaces(12,12)
        case "-"
            set(px-16,py,px+8,py,.0,.0,"line",image)
            spaces(26,26)
        case "_"
            set(px-16,py+16,px+16,py+16,.0,.0,"line",image)
            spaces(34,34)
            case "+"
            set(px-16,py,px+8,py,.0,.0,"line",image)
            set(px-4,py+12,px-4,py-12,.0,.0,"line",image)
            spaces(26,26)
        case "="
        set(px-16,py-4,px+8,py-4,.0,.0,"line",image)
        set(px-16,py+4,px+8,py+4,.0,.0,"line",image)
        spaces(26,26)
    case "!"
        set(px-12,py-16,px-12,py+6,.0,.0,"line",image)
        set(px-12,py+12,1,1,360,360,"circle",image)
        spaces(10,10)
    case "¬"
    set(px-16,py+4,px+8,py+4,.0,.0,"line",image)
    set(px+6,py+4,px+6,py+12,.0,.0,"line",image)
    spaces(26,26)
case "`"
    set(px-16,py-16,px-12,py-12,.0,.0,"line",image)
    spaces(8,8)
case ";"
    set(px-12,py-4,1,1,360,360,"circle",image)'top
  set(px-12,py+12,px-18,py+20,.0,.0,"line",image)
 set(px-12,py+12,1,1,360,360,"circle",image)
 spaces(10,10)
case ":"
   set(px-12,py-4,1,1,360,360,"circle",image)'top
  'set(px-12,py+12,px-18,py+20,.0,.0,"line",image)
 set(px-12,py+12,1,1,360,360,"circle",image)
 spaces(10,10)
case "@"
 set(px,py,14,1,0,290,"circle",image)
 set(px+6,py,7,1,100,365,"circle",image)
 spaces(36,36)
case "'"
 set(px-12,py-12,px-18,py-4,.0,.0,"line",image)
 set(px-12,py-12,1,1,360,360,"circle",image)
 spaces(10,10)
case "#"
 set(px-16,py-4,px+8,py-4,.0,.0,"line",image)
set(px-16,py+4,px+8,py+4,.0,.0,"line",image)
set(px-8,py-12,px-8,py+12,.0,.0,"line",image)
set(px,py-12,px,py+12,.0,.0,"line",image)
        spaces(26,26)
    case "~"
  set(px-8,py+16,14,1,60,120,"circle",image)
  set(px+4,py-8,14,1,240,300,"circle",image)
  spaces(30,30)
case "/"
  set(px+14,py-16,px-14,py+16,.0,.0,"line",image)
  spaces(34,34)
case ""
  set(px-14,py-16,px+14,py+16,.0,.0,"line",image)
  spaces(34,34)
case "["
  set(px-12,py-16,px-12,py+16,.0,.0,"line",image)'vert
  set(px-12,py-14,px-4,py-14,.0,.0,"line",image)'top
  set(px-12,py+14,px-4,py+14,.0,.0,"line",image)
  spaces(14,14)
case "]"
  set(px-4,py-16,px-4,py+16,.0,.0,"line",image)'vert
  set(px-4,py-14,px-12,py-14,.0,.0,"line",image)'top
  set(px-12,py+14,px-4,py+14,.0,.0,"line",image)
  spaces(16,16)
case "&#123;"
  set(px+12,py-8,28,1,160,200,"circle",image)
  set(px+12,py+8,28,1,160,200,"circle",image)
            spaces(8,8)
case "&#125;"
  set(px-12-16-6,py-8,28,1,340,380,"circle",image)
  set(px-12-16-6,py+8,28,1,340,380,"circle",image)
            spaces(14,14)
case "<"
    set(px-16,py,px+4,py-12,.0,.0,"line",image)
    set(px-16,py,px+4,py+12,.0,.0,"line",image)
    spaces(24,24)
case ">"
    set(px+4,py,px-16,py-12,.0,.0,"line",image)
    set(px+4,py,px-16,py+12,.0,.0,"line",image)
    spaces(24,24)
case "?"
     set(px-5,py-6,8,1,280,490,"circle",image)'top loop
     set(px-4,py,px-4,py+8,.0,.0,"line",image)
     set(px-4,py+15,1,1,360,360,"circle",image)
     spaces(24,24)
     case """"
  set(px-12,py-16,px-18,py-8,.0,.0,"line",image)
 set(px-12,py-16,1,1,360,360,"circle",image)
 
 set(px-4,py-16,px-10,py-8,.0,.0,"line",image)
 set(px-4,py-16,1,1,360,360,"circle",image)
 spaces(16,16) 
  case else
    draw string(px,py),"?",c
    spaces(24,24)
    end select
    next n
end sub
'************************* END OF PAINTSTRING ******************************


screen 20,32
dim as string s="ABCDEFGHIJKLMN|OPQRSTUVWXYZ|"
dim as string s3="abcdefghijklmn|opqrstuvwxyz|"
dim as string s5="1234567890|1£$%^&*()_+=-&#123;&#125;[]:;@'~#<>.?/"
paintstring(10,50,s,2,rgb(0,200,0))
paintstring(10,next_y,s3,2,rgb(200,200,0))
paintstring(0,next_y,s5,1,rgb(0,200,0))

paintstring(20,610,"(That's most of my keyboard)|....",.8,rgb(255,255,254))
sleep
cls
s="The rain in California|falls mainly|on the pavement."
paintstring(20,20,s,.8,rgb(255,255,254))
sleep
cls
s="Slight text line angle."
paintstring(20,20,s,.8,rgb(255,255,254),-20)
sleep
cls
s="Slight character angle with the text."
paintstring(20,20,s,.8,rgb(255,55,0),-20,-20)
sleep
paintstring(20,200,"Goodbye",3,rgb(255,55,0),-20,-20)
 sleep


I like the draw one by I3I2UI/I0.
Basiccoder2' s one also of course.
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Implementing Vector Fonts

Postby BasicCoder2 » Feb 09, 2015 22:10

@Quark,
Ideally if I revisit the vector graphic fonts I should write a simple font editor to generate the actual polygon line data as it is very time consuming typing it in the way it has been done in the examples given in this thread. It would be a bit like the trace programs we played with using DRAW where the pictures would be fonts.

@Dodicat,
An interesting implementation.
Quark
Posts: 474
Joined: May 27, 2011 18:16
Location: Pennsylvania, U.S.
Contact:

Re: Implementing Vector Fonts

Postby Quark » Feb 10, 2015 0:53

.
@BasicCoder2

I wondered if you might approach the creation of fonts as a DRAW exercise. Seems like that has great possibilities.

@dodicat

Your font creation example is an impressive amount of effort, and the results, including slanted letters, are nicely formed and effective.
.
BasicCoder2
Posts: 3586
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Implementing Vector Fonts

Postby BasicCoder2 » Feb 10, 2015 7:02

Quark wrote:.
@BasicCoder2
I wondered if you might approach the creation of fonts as a DRAW exercise. Seems like that has great possibilities..


No I wouldn't use DRAW because it isn't easily translated to another language and has severe limitations. It makes some code quick and easy but other code difficult and impractical as I found out in the trace an image programs.
My interest in the vector fonts was because at the time I wanted to see how hard it was to make an Asteroid like retro game.
Quark
Posts: 474
Joined: May 27, 2011 18:16
Location: Pennsylvania, U.S.
Contact:

Re: Implementing Vector Fonts

Postby Quark » Feb 10, 2015 10:20

.
@BasicCoder2

If not DrAW, then drawing by another means :-) Some kind of font editor. For Asteroid or whatever purpose, it would be good if there were few limits on the font styles that users can imagine and implement. If one were looking for a good little project...
.
Quark
Posts: 474
Joined: May 27, 2011 18:16
Location: Pennsylvania, U.S.
Contact:

Re: Implementing Vector Fonts

Postby Quark » Feb 11, 2015 2:47

'
Good update!
'

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests