1 type Font
2 {
3 uint hFont
4 }
5
6 type FontManager <inherit=hash>
7 {
8 }
9
10 method Font FontManager.GetFont( str name )
11 {
12 return this[name]->Font
13 }
14
15 method FontManager.AddFont( str name, uint hFont )
16 {
17 uint f as .GetFont( name )
18 if &f
19 {
20 DeleteObject( f.hFont )
21 }
22 else
23 {
24 f as new( Font )->Font
25 this[name] = &f
26 }
27 //print( " \(&f) \(name) \(hFont )\n" )
28 f.hFont = hFont
29 }
30
31 method FontManager FontManager.Default()
32 {
33 uint hfont
34 int cur
35 LOGFONT lf
36
37 GetObject( GetStockObject( $DEFAULT_GUI_FONT ), sizeof( LOGFONT ), &lf )
38
39 .AddFont( "default", CreateFontIndirect( lf ) )
40
41 cur = lf.lfUnderline
42 lf.lfUnderline = 1
43 .AddFont( "default_underline", CreateFontIndirect( lf ) )
44 lf.lfUnderline = cur
45
46 cur = lf.lfWeight
47 lf.lfWeight = 800
48 .AddFont( "default_bold", CreateFontIndirect( lf ) )
49 lf.lfWeight = cur
50
51 cur = lf.lfHeight
52 lf.lfHeight = int( double(cur) * 1.5 )
53 .AddFont( "default_big", CreateFontIndirect( lf ) )
54 lf.lfHeight = cur
55
56 return this
57 }
Edit