DEADSOFTWARE

Port, TODO
[bbcp.git] / new / __Interp / Host / Mod / Fonts.txt
1 MODULE HostFonts;
3 (* for Texts, HostTextConv *)
5 IMPORT Fonts;
7 CONST
8 defTypeface = "*";
9 defSize = 12 * Fonts.point;
10 defW = 161925;
11 defAsc = 142875;
12 defDsc = 28575;
14 TYPE
15 Font = POINTER TO RECORD (Fonts.Font)
16 alias-: Fonts.Typeface; (* alias # typeface & typeface # "*" == alien font *)
17 END;
19 Directory = POINTER TO RECORD (Fonts.Directory) END;
21 VAR
22 defFont-: Font; (* for HostTextConv *)
23 ti: Fonts.TypefaceInfo;
24 dir: Directory;
26 PROCEDURE (f: Font) GetBounds (OUT asc, dsc, w: INTEGER);
27 BEGIN
28 asc := defAsc;
29 dsc := defDsc;
30 w := defW
31 END GetBounds;
33 PROCEDURE (f: Font) StringWidth (IN s: ARRAY OF CHAR): INTEGER;
34 BEGIN
35 RETURN LEN(s$) * defW
36 END StringWidth;
38 PROCEDURE (f: Font) SStringWidth (IN s: ARRAY OF SHORTCHAR): INTEGER;
39 BEGIN
40 RETURN LEN(s$) * defW
41 END SStringWidth;
43 PROCEDURE (f: Font) IsAlien (): BOOLEAN;
44 BEGIN
45 RETURN TRUE
46 END IsAlien;
48 PROCEDURE (d: Directory) This (typeface: Fonts.Typeface; size: INTEGER; style: SET; weight: INTEGER): Font;
49 BEGIN
50 RETURN defFont
51 END This;
53 PROCEDURE (d: Directory) Default (): Font;
54 BEGIN
55 RETURN defFont
56 END Default;
58 PROCEDURE (d: Directory) TypefaceList (): Fonts.TypefaceInfo;
59 BEGIN
60 RETURN ti
61 END TypefaceList;
63 PROCEDURE Init;
64 BEGIN
65 NEW(defFont);
66 defFont.Init(defTypeface, defSize, {}, Fonts.normal);
67 defFont.alias := "Arial";
68 NEW(ti);
69 ti.typeface := defTypeface;
70 NEW(dir); Fonts.SetDir(dir)
71 END Init;
73 BEGIN
74 Init
75 END HostFonts.