This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigfont.pas
96 lines (72 loc) · 1.81 KB
/
bigfont.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
unit BigFont;
interface
procedure BigText( x, y : Integer; s : String );
procedure FancyBigText( x, y : Integer; s : String; dx, dy : Integer; xInc, yInc : Integer );
function CharWidth : Integer;
function CharHeight : Integer;
implementation
uses {$IFDEF XLIB} XSPX {$ELSE} SPX_VGA {$ENDIF},
Pics, Fancy;
const
cCapitalA = 140;
cZero = 166;
cDot = 176;
function ValidChar( c : Char ) : Boolean;
begin
ValidChar := c in ['A'..'Z', 'a'..'z', '0'..'9', '.'];
end;
function PicIndex( c : Char ) : Integer;
begin
if c = '.' then
PicIndex := cDot
else if c in ['0'..'9'] then
PicIndex := Ord( c) - Ord( '0') + cZero
else begin
c := UpCase( c);
PicIndex := Ord( c) - Ord( 'A') + cCapitalA;
end;
end;
procedure BigText( x, y : Integer; s : String );
var i : Integer;
w : Integer;
begin
w := CharWidth;
for i := 1 to Length( s) do
begin
if ValidChar( s[i]) then
ftPut_Clip( x, y, gPics[ PicIndex( s[i])]^, True);
Inc( x, w);
end;
end;
procedure FancyBigText( x, y : Integer; s : String; dx, dy : Integer; xInc, yInc : Integer );
var i : Integer;
w : Integer;
begin
w := CharWidth;
for i := 1 to Length( s) do
begin
if ValidChar( s[i]) then
begin
if (dx <= 0) and (dy <= 0) then
ftPut_Clip( x, y, gPics[ PicIndex( s[i])]^, True)
else
FancyPut( x, y, gPics[ PicIndex( s[i])]^, True, dx, dy);
end;
Inc( dx, xInc);
Inc( dy, yInc);
Inc( x, w);
end;
end;
function CharWidth : Integer;
var w, h : Integer;
begin
ImageDims( gPics[ cCapitalA]^, w, h);
CharWidth := w + 1;
end;
function CharHeight : Integer;
var w, h : Integer;
begin
ImageDims( gPics[ cCapitalA]^, w, h);
CharHeight := h + 5;
end;
end.