Debian Codegraph @

Data_Generators/makedata/getfont.pas

raw
1 program getfontfromfile;
2 (********************************************************************
3 This file is part of Ironseed.
4
5 Ironseed is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ironseed is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ironseed. If not, see <https://www.gnu.org/licenses/>.
17 ********************************************************************)
18
19 {*********************************************
20 Data Generator: fonts
21
22 Copyright:
23 1994 Channel 7, Destiny: Virtual
24 2020 Matija Nalis <[email protected]>
25 **********************************************}
26
27 {$PACKRECORDS 1}
28
29 uses crt, data, utils_;
30
31 var
32 ft: text;
33
34 procedure getfont(y1: integer);
35 var a,x,i,j,b: integer;
36 d: array[0..2] of byte;
37 begin
38 write(ft,'(');
39 b:=-1;
40 for a:=0 to 83 do
41 begin
42 inc(b);
43 if b=5 then
44 begin
45 writeln(ft);
46 b:=0;
47 end;
48 if a=56 then inc(y1,10);
49 if a<56 then x:=a*5
50 else x:=(a-56)*5;
51 d[0]:=0; d[1]:=0; d[2]:=0;
52 for i:=0 to 5 do
53 for j:=0 to 3 do
54 begin
55 if screen[i+y1,x+j]=31 then
56 d[i div 2]:=d[i div 2] or (1 shl (7-(j+(i mod 2)*4)));
57 end;
58 write(ft,'(',d[0],',',d[1],',',d[2],')');
59 if a<83 then write(ft,',');
60 end;
61 writeln(ft,')');
62 end;
63
64 procedure getfont2(y1: integer);
65 var a,x,i,j,b: integer;
66 d: array[0..7] of byte;
67 begin
68 write(ft,'(');
69 b:=-1;
70 for a:=0 to 83 do
71 begin
72 inc(b);
73 if b=4 then
74 begin
75 writeln(ft);
76 b:=0;
77 end;
78 if (a mod 28=0) and (a>0) then inc(y1,10);
79 if a<28 then x:=a*9
80 else if a<56 then x:=(a-28)*9
81 else x:=(a-56)*9;
82 d[0] := 0; // just to get rid of warnings, fillchar will initialize it
83 fillchar(d,8,0);
84 for i:=0 to 7 do
85 for j:=0 to 7 do
86 begin
87 if screen[i+y1,x+j]=31 then
88 d[i]:=d[i] or (1 shl (7-j));
89 end;
90 write(ft,'(',d[0],',',d[1],',',d[2],',',d[3],',',d[4],',',d[5],',',d[6],',',d[7],')');
91 if a<83 then write(ft,',');
92 end;
93 writeln(ft,')');
94 end;
95
96 begin
97 //setvidmode($13);
98 init_everything;
99 loadscreen('Data_Generators/makedata/font0',@screen);
100 set256colors(colors);
101 assign(ft,'fontdata');
102 rewrite(ft);
103 getfont(0);
104 writeln(ft);
105 getfont(20);
106 writeln(ft);
107 getfont(40);
108 writeln(ft);
109 getfont2(60);
110 writeln(ft);
111 getfont2(90);
112 close(ft);
113 while not fastkeypressed do delay(1);
114 readkey;
115 //setvidmode($03);
116 end.