143 lines
5 KiB
C++
143 lines
5 KiB
C++
/*
|
|
** Command & Conquer Renegade(tm)
|
|
** Copyright 2025 Electronic Arts Inc.
|
|
**
|
|
** This program is free software: you can redistribute it and/or modify
|
|
** it under the terms of the GNU General Public License as published by
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
** (at your option) any later version.
|
|
**
|
|
** This program is distributed in the hope that it will be useful,
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
** GNU General Public License for more details.
|
|
**
|
|
** You should have received a copy of the GNU General Public License
|
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/***********************************************************************************************
|
|
*** 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 ***
|
|
***********************************************************************************************
|
|
* *
|
|
* Project Name : Command & Conquer *
|
|
* *
|
|
* $Archive:: /G/wwlib/wwfont.h $*
|
|
* *
|
|
* $Author:: Scott_b $*
|
|
* *
|
|
* $Modtime:: 4/21/00 1:03p $*
|
|
* *
|
|
* $Revision:: 3 $*
|
|
* *
|
|
*---------------------------------------------------------------------------------------------*
|
|
* Functions: *
|
|
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
|
|
|
#ifndef WWFONT_H
|
|
#define WWFONT_H
|
|
|
|
#include "font.h"
|
|
#include "surface.h"
|
|
|
|
class ConvertClass;
|
|
|
|
/*
|
|
** This is a concrete font class object that is used to handle font data as generated by
|
|
** the legacy FONTMAKE.EXE utility.
|
|
*/
|
|
class WWFontClass : public FontClass
|
|
{
|
|
typedef FontClass BASECLASS;
|
|
|
|
public:
|
|
WWFontClass(void const * fontdata, bool isoutlined=false, int shadow=0, ConvertClass *convert = 0, unsigned char *remap = 0);
|
|
virtual ~WWFontClass(void) {}
|
|
|
|
void *Set_Font_Data(void const * fontdata);
|
|
void *Get_Font_Data() {
|
|
return((void *)FontData);
|
|
}
|
|
|
|
// User can setup a palette to use for this font.
|
|
// If set, this will override all other colors (even fore and background colors).
|
|
// User should reset to default when done.
|
|
unsigned char *Set_Remap_Palette(unsigned char *palette) {
|
|
unsigned char *old = RemapPalette;
|
|
RemapPalette = palette;
|
|
return(old);
|
|
}
|
|
unsigned char *Get_Remap_Palette() const {
|
|
return(RemapPalette);
|
|
}
|
|
|
|
ConvertClass *Set_Converter(ConvertClass *convert) {
|
|
ConvertClass *old = Converter;
|
|
Converter = convert;
|
|
return(old);
|
|
}
|
|
ConvertClass *Get_Converter() const {
|
|
return(Converter);
|
|
}
|
|
|
|
virtual int Char_Pixel_Width(char c) const;
|
|
virtual int String_Pixel_Width(char const * string) const;
|
|
virtual int Get_Width(void) const;
|
|
virtual int Get_Height(void) const;
|
|
virtual Point2D Print(char const * string, Surface & surface, Rect const & cliprect, Point2D const & point, ConvertClass const & converter, unsigned char const * remap=NULL) const;
|
|
|
|
virtual int Set_XSpacing(int x);
|
|
virtual int Set_YSpacing(int y);
|
|
|
|
private:
|
|
|
|
/*
|
|
** Is the font an outline type font (with special outline
|
|
** pixels in the source art)?
|
|
*/
|
|
bool IsOutlinedData;
|
|
|
|
/*
|
|
** Shadow type to use when displaying this font. The value only applies if the
|
|
** font is equipped with outline data.
|
|
*/
|
|
int Shadow;
|
|
|
|
/*
|
|
** Override font X spacing value.
|
|
*/
|
|
int FontXSpacing;
|
|
|
|
/*
|
|
** Override font Y spacing value.
|
|
*/
|
|
int FontYSpacing;
|
|
|
|
/*
|
|
** Header structure of the font data file.
|
|
*/
|
|
typedef struct FontType {
|
|
unsigned short FontLength;
|
|
unsigned char FontCompress;
|
|
unsigned char FontDataBlocks;
|
|
unsigned short InfoBlockOffset;
|
|
unsigned short OffsetBlockOffset;
|
|
unsigned short WidthBlockOffset;
|
|
unsigned short DataBlockOffset;
|
|
unsigned short HeightOffset;
|
|
} FontType;
|
|
FontType const * FontData;
|
|
|
|
|
|
// Pointer to a font palette for the font.
|
|
unsigned char *RemapPalette;
|
|
|
|
// Pointer to a converter.
|
|
ConvertClass *Converter;
|
|
|
|
int Raw_Width(void) const;
|
|
int Raw_Height(void) const;
|
|
};
|
|
|
|
|
|
#endif
|