home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
076-100
/
apd076
/
font_convert.amos
/
font_convert.amosSourceCode
< prev
Wrap
AMOS Source Code
|
1990-11-07
|
4KB
|
151 lines
'----------------------------------------------------------------------------
' FONT CONVERTER by Francois Lionet
' AMOS Basic (c) Mandarin / Jawx 1990
'----------------------------------------------------------------------------
Curs Off : Flash Off : Fade 2,0,0,0 : Wait 32
TITLE
ALERT["...Looking to disc fonts..."]
Fade 8,0,0,$EEE
Get Fonts
'---------------
' Build up menu
'---------------
Menu$(1)=" Choose font "
For N=1 To 50
If Font$(N)<>""
If Val(Mid$(Font$(N),31))=8
Menu$(1,N)=Font$(N)
End If
End If
Next
Menu$(2)=" Disk "
Menu$(2,1)=" Save font to current AMOS folder "
Menu$(2,2)=" Save font to another AMOS disk "
Menu$(2,3)="----------------------------------" : Menu Inactive(2,3)
Menu$(2,4)=" Quit "
Set Menu(2,1) To 10,-64
Menu On
'-----------------
' TEST loop
'-----------------
Do
If FLAG=0
ALERT["Please select a font with menu"]
Else
ALERT["Please select a menu option"]
End If
Repeat : Until Choice
On Choice(1) Gosub MNFONT,MNDISK
TITLE
Loop
' ---> Font menu
MNFONT:
Menu Off
MAKEFONT[Choice(2)]
Set Font 2 : Menu Calc : Menu On
Return
' ---> Disk menu
MNDISK:
If Choice(2)=1 : SVFONT[":AMOS_System/Default.Font"] : End If
If Choice(2)=2 : SVFONT[Fsel$("Default.Font","","Please select DEFAULT.FONT file","in AMOS_System folder...")] : End If
If Choice(2)=4 : End : End If
Return
'
Procedure SVFONT[N$]
Shared FLAG
If FLAG=0 : ALERT["Font not loaded!"] : Bell : Wait 200 : Pop Proc : End If
If N$="" : ALERT["Not done"] : Bell : Wait 100 : Pop Proc : End If
ALERT["Saving..."]
Bsave N$,Start(10) To Start(10)+256*8
End Proc
'
Procedure TITLE
Clw
Centre At(,10)+Border$("AMOS Basic Font Converter",2)
End Proc
'
Procedure ALERT[A$]
Centre At(,22)+Space$(39)
Centre At(,22)+A$
End Proc
'
Procedure MAKEFONT[F]
Shared FLAG
FLAG=False
Set Font F
Clw
'
' Space for new font
Erase 10 : Reserve As Work 10,8*256 : AD=Start(10)+32*8
'
' Reads current font
RASTPORT=Areg(0)
AFONT=Leek(RASTPORT+52)
CDATA=Leek(AFONT+34)
CMOD=Deek(AFONT+38)
CHI=Deek(AFONT+20)
COFFSET=Leek(AFONT+40)
CFIRST=Peek(AFONT+32)
CEND=Peek(AFONT+33)
PROP=Btst(5,Peek(RASTPORT+23))
If CHI<>8 or PROP : BADFONT : Pop Proc : End If
'
' Conversion loop
ALERT["Processing font"]
Print At(16,8)+Border$(At(16+8,8+7),1)
For CC=32 To 255
If CC>=CFIRST and CC<=CEND
T=Deek(COFFSET+(CC-CFIRST)*4) : COFF=T/8 : CBIT=T mod 8
CNBIT=Deek(COFFSET+(CC-CFIRST)*4+2)
If CNBIT<>8 : BADFONT : Pop Proc : End If
Locate 26,8
For Y=0 To CHI-1
CAD=CDATA+CMOD*Y+COFF
N=CBIT
Locate 16,8+Y
PP=0
For L=0 To CNBIT-1
P=Peek(CAD)
If Btst(7-N,P)
Bset 7-L,PP
Print "*";
Else
Print " ";
End If
Inc N
If N>8
Inc CAD : N=0
End If
Next
Poke AD,PP : Inc AD
Next
Else
For L=0 To 7
Poke AD,0 : Inc AD
Next
End If
Next
'
' Add border characters
For L=0 To 32*8-1
Poke Start(10)+L,Peek(Start(9)+L)
Poke Start(10)+128*8+L,Peek(Start(9)+32*8+L)
Next
'
' One character set in memory
Clw
FLAG=True
End Proc
'
Procedure BADFONT
Bell
Clw
Centre At(,10)+"I can't use this font,"
Centre At(,12)+"I need a 8 pixels FIXED WIDTH font!"
Centre At(,14)+"You can use the Font Editor from"
Centre At(,15)+"workbench to convert the font"
Centre At(,16)+"to fixed width..."
Centre At(,22)+"... Press mousekey to go on ..."
Repeat : Until Mouse Click
Clw
End Proc