Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
wwfont.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program 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** This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : Command & Conquer *
24 * *
25 * $Archive:: /G/wwlib/wwfont.h $*
26 * *
27 * $Author:: Scott_b $*
28 * *
29 * $Modtime:: 4/21/00 1:03p $*
30 * *
31 * $Revision:: 3 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#ifndef WWFONT_H
38#define WWFONT_H
39
40#include "font.h"
41#include "surface.h"
42
43class ConvertClass;
44
45/*
46** This is a concrete font class object that is used to handle font data as generated by
47** the legacy FONTMAKE.EXE utility.
48*/
49class WWFontClass : public FontClass
50{
51 typedef FontClass BASECLASS;
52
53 public:
54 WWFontClass(void const * fontdata, bool isoutlined=false, int shadow=0, ConvertClass *convert = 0, unsigned char *remap = 0);
55 virtual ~WWFontClass(void) {}
56
57 void *Set_Font_Data(void const * fontdata);
58 void *Get_Font_Data() {
59 return((void *)FontData);
60 }
61
62 // User can setup a palette to use for this font.
63 // If set, this will override all other colors (even fore and background colors).
64 // User should reset to default when done.
65 unsigned char *Set_Remap_Palette(unsigned char *palette) {
66 unsigned char *old = RemapPalette;
67 RemapPalette = palette;
68 return(old);
69 }
70 unsigned char *Get_Remap_Palette() const {
71 return(RemapPalette);
72 }
73
75 ConvertClass *old = Converter;
76 Converter = convert;
77 return(old);
78 }
80 return(Converter);
81 }
82
83 virtual int Char_Pixel_Width(char c) const;
84 virtual int String_Pixel_Width(char const * string) const;
85 virtual int Get_Width(void) const;
86 virtual int Get_Height(void) const;
87 virtual Point2D Print(char const * string, Surface & surface, Rect const & cliprect, Point2D const & point, ConvertClass const & converter, unsigned char const * remap=NULL) const;
88
89 virtual int Set_XSpacing(int x);
90 virtual int Set_YSpacing(int y);
91
92 private:
93
94 /*
95 ** Is the font an outline type font (with special outline
96 ** pixels in the source art)?
97 */
98 bool IsOutlinedData;
99
100 /*
101 ** Shadow type to use when displaying this font. The value only applies if the
102 ** font is equipped with outline data.
103 */
104 int Shadow;
105
106 /*
107 ** Override font X spacing value.
108 */
109 int FontXSpacing;
110
111 /*
112 ** Override font Y spacing value.
113 */
114 int FontYSpacing;
115
116 /*
117 ** Header structure of the font data file.
118 */
119 typedef struct FontType {
120 unsigned short FontLength;
121 unsigned char FontCompress;
122 unsigned char FontDataBlocks;
123 unsigned short InfoBlockOffset;
124 unsigned short OffsetBlockOffset;
125 unsigned short WidthBlockOffset;
126 unsigned short DataBlockOffset;
127 unsigned short HeightOffset;
128 } FontType;
129 FontType const * FontData;
130
131
132 // Pointer to a font palette for the font.
133 unsigned char *RemapPalette;
134
135 // Pointer to a converter.
136 ConvertClass *Converter;
137
138 int Raw_Width(void) const;
139 int Raw_Height(void) const;
140};
141
142
143#endif
#define NULL
Definition BaseType.h:92
ConvertClass * Set_Converter(ConvertClass *convert)
Definition wwfont.h:74
unsigned char * Get_Remap_Palette() const
Definition wwfont.h:70
virtual Point2D Print(char const *string, Surface &surface, Rect const &cliprect, Point2D const &point, ConvertClass const &converter, unsigned char const *remap=NULL) const
Definition wwfont.cpp:371
virtual int Get_Width(void) const
Definition wwfont.cpp:232
void * Set_Font_Data(void const *fontdata)
Definition wwfont.cpp:102
virtual int Set_YSpacing(int y)
Definition wwfont.cpp:315
virtual int Set_XSpacing(int x)
Definition wwfont.cpp:275
virtual int Get_Height(void) const
Definition wwfont.cpp:253
virtual ~WWFontClass(void)
Definition wwfont.h:55
WWFontClass(void const *fontdata, bool isoutlined=false, int shadow=0, ConvertClass *convert=0, unsigned char *remap=0)
Definition wwfont.cpp:79
virtual int Char_Pixel_Width(char c) const
Definition wwfont.cpp:131
unsigned char * Set_Remap_Palette(unsigned char *palette)
Definition wwfont.h:65
ConvertClass * Get_Converter() const
Definition wwfont.h:79
virtual int String_Pixel_Width(char const *string) const
Definition wwfont.cpp:154
void * Get_Font_Data()
Definition wwfont.h:58
TRect< int > Rect
Definition trect.h:221