home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1994-02-25 | 3.3 KB | 113 lines |
- 'These are the upcoming TURBO PLUS font commands in BASIC.
- 'They are being converted to machine language commands and will
- 'be available in the first update. - GET THE FULL VERSION!!!!
-
- 'for now you can use these procedures. They are fast enough for
- 'most applications, even scroll text.
-
- 'these commands assume proportional spacing. If you wish to
- 'use standard spacing, see the F_Text command and F_Width at '************
-
- ' like Text x,y,s$ - print the string starting at x,y
- Procedure F_TEXT[X,Y,S$]
- 'like Text x,y,s$
- XC=X : NC=Deek(Start(4))
- For A=1 To Len(S$)
- CH=0
- B=0
- Repeat
- If Peek(Start(4)+6+B)=Asc(Mid$(S$,A,1)) Then CH=B+1
- Inc B
- Until B=NC or CH>0
- If CH>0
- R=Start(4)+6+NC+(CH-1)*8
- Paste Bob XC+(Peek(R+4)*256+Peek(R+5)),Y-(Peek(R)*256+Peek(R+1)),CH
- '*******************
- 'here we increment the xposition,
- 'we assume proportional. If not proportional,
- 'just Add XC with the spacing you desire
- Add XC,(Peek(R+6)*256+Peek(R+6+1))+1
- End If
- Next
- End Proc
-
- ' whats the width of the string? returned in param
- Procedure F_TEXT_WIDTH[S$]
- 'whats the width of the string?
- WIDTH=0
- NC=Deek(Start(4))
- For A=1 To Len(S$)
- CH=0
- B=0
- Repeat
- If Peek(Start(4)+6+B)=Asc(Mid$(S$,A,1)) Then CH=B+1
- Inc B
- Until B=NC or CH>0
- If CH>0
- R=Start(4)+6+NC+(CH-1)*8
- '*********************
- 'here we increment the xposition,
- 'we assume proportional. If not proportional,
- 'just Add XC with the spacing you desire
- Add WIDTH,Peek(R+6)*256+Peek(R+7)+1
- End If
- Next
- End Proc[WIDTH]
-
- ' return width of a character in param
- Procedure F_WIDTH
- 'return width of a character in param
- WIDTH=Deek(Start(4)+2)
- End Proc[WIDTH]
-
- ' height of character returned in param
- Procedure F_HEIGHT
- 'height of character returned in param
- HEIGHT=Deek(Start(4)+4)
- End Proc[HEIGHT]
-
- ' center the string on point x,y
- Procedure F_TEXT_CENTRE[X,Y,S$]
- 'center the string on point x,y
- F_TEXT_WIDTH[S$]
- F_TEXT[X-Param/2,Y,S$]
- End Proc
-
-
-
- 'a little demo of the commands
-
- Screen Open 0,336,200,32,0
- Curs Off : Flash Off : Cls 0
- Screen Display 0,112,50,336,200
- C=Screen Width/2
- Limit Mouse 112,50 To 111+Screen Width,49+Screen Height
- Do
- F$=Fsel$("*.fin","","select a font to display!")
- F$=F$-".fin"
- Load F$+".abk"
- Load F$+".fin",4 : Rem combine these 2 into one command-
- 'font load. Then font bank x would mean use font bank x & fin (order) bank x+1 (?)
- Cls 0
- Get Sprite Palette
- F_HEIGHT
- A=Param+1
- A$=Str$(Param)
- F_WIDTH
- B$=Str$(Param)
- F_TEXT_CENTRE[C,A,"THIS IS A"]
- F_TEXT_CENTRE[C,A*2,"FONT TEST."]
- F_TEXT_CENTRE[C,A*4,"ABCDEFGabcHIJKLM"]
- ' F_TEXT_CENTRE[C,A,"IIIIIIII"]:rem test proportional since I's should be smaller
- ' F_TEXT_CENTRE[C,A*2,"BBBBBBBB"]:rem than b's but make sure its that way in the actual font! (use editor)
- ' F_TEXT_CENTRE[C,A*4,"ABCDEFGabcHIJKLM"]
-
- F_TEXT_CENTRE[C,A*5,"NOPQRSTnopUVWXYZ"]
- F_TEXT_CENTRE[C,A*6,"0123456789"]
- F_TEXT_CENTRE[C,A*7,"HEIGHT:"+A$]
- F_TEXT_CENTRE[C,A*8,"MAX WIDTH:"+B$]
- F_TEXT_CENTRE[C,A*10,"!,.?:;'"+Chr$(34)]
- Repeat : Until Mouse Key
- Erase 1 : Erase 4
- Loop
- Edit