Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/engine/RefAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ struct WindowConfig {
int vidWidth, vidHeight; // what the game is using
};

// font support
struct glyphInfo_t
{
int height; // number of scan lines
int top; // top of glyph in buffer
int bottom; // bottom of glyph in buffer
int pitch; // width for copying
int xSkip; // x adjustment
int imageWidth; // width of actual image
int imageHeight; // height of actual image
float s; // x offset in image where glyph starts
float t; // y offset in image where glyph starts
float s2;
float t2;
qhandle_t glyph; // handle to the shader with the glyph
char shaderName[ 32 ];
};

struct fontInfo_t
{
void *face, *faceData;
glyphInfo_t *glyphBlock[0x110000 / 256]; // glyphBlock_t
int pointSize;
char name[ MAX_QPATH ];
};

//
// these are the functions exported by the refresh module
//
Expand All @@ -77,7 +103,6 @@ struct refexport_t {
qhandle_t( *RegisterShader )( const char* name, int flags );
fontInfo_t* ( *RegisterFont )( const char* fontName, int pointSize );
void ( *UnregisterFont )( fontInfo_t* font );
void ( *Glyph )( fontInfo_t* font, const char* str, glyphInfo_t* glyph );
void ( *GlyphChar )( fontInfo_t* font, int ch, glyphInfo_t* glyph );

void ( *LoadWorld )( const char* name );
Expand Down
5 changes: 2 additions & 3 deletions src/engine/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,7 @@ void CL_Vid_Restart_f()
Audio::StopAllSounds();
// shutdown the CGame
CL_ShutdownCGame();
// clear the font cache
re.UnregisterFont( nullptr );
re.UnregisterFont( cls.consoleFont );
cls.consoleFont = nullptr;
// shutdown the renderer and clear the renderer interface
CL_ShutdownRef();
Expand Down Expand Up @@ -2461,7 +2460,7 @@ void CL_Shutdown()

if ( re.UnregisterFont )
{
re.UnregisterFont( nullptr );
re.UnregisterFont( cls.consoleFont );
cls.consoleFont = nullptr;
}

Expand Down
7 changes: 1 addition & 6 deletions src/engine/null/null_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fontInfo_t* RE_RegisterFont( const char *, int )
{
return nullptr;
}
void RE_Glyph( fontInfo_t *, const char *, glyphInfo_t *glyph )
void RE_GlyphChar( fontInfo_t *, int, glyphInfo_t *glyph )
{
glyph->height = 1;
glyph->top = 1;
Expand All @@ -70,10 +70,6 @@ void RE_Glyph( fontInfo_t *, const char *, glyphInfo_t *glyph )
glyph->glyph = 1;
glyph->shaderName[0] = '\0';
}
void RE_GlyphChar( fontInfo_t *font, int, glyphInfo_t *glyph )
{
RE_Glyph( font, nullptr, glyph );
}
void RE_UnregisterFont( fontInfo_t* ) { }
void RE_LoadWorldMap( const char * ) { }
void RE_SetWorldVisData( const byte * ) { }
Expand Down Expand Up @@ -205,7 +201,6 @@ refexport_t *GetRefAPI( int, refimport_t* )
re.RegisterSkin = RE_RegisterSkin;
re.RegisterShader = RE_RegisterShader;
re.RegisterFont = RE_RegisterFont;
re.Glyph = RE_Glyph;
re.GlyphChar = RE_GlyphChar;
re.UnregisterFont = RE_UnregisterFont;
re.LoadWorld = RE_LoadWorldMap;
Expand Down
39 changes: 0 additions & 39 deletions src/engine/qcommon/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -2152,45 +2152,6 @@ union OpaquePlayerState {
CA_ACTIVE, // game views should be displayed
};

// font support

#define GLYPH_START 0
#define GLYPH_END 255
#define GLYPH_CHARSTART 32
#define GLYPH_CHAREND 127
#define GLYPHS_PER_FONT ( GLYPH_END - GLYPH_START + 1 )
struct glyphInfo_t
{
int height; // number of scan lines
int top; // top of glyph in buffer
int bottom; // bottom of glyph in buffer
int pitch; // width for copying
int xSkip; // x adjustment
int imageWidth; // width of actual image
int imageHeight; // height of actual image
float s; // x offset in image where glyph starts
float t; // y offset in image where glyph starts
float s2;
float t2;
qhandle_t glyph; // handle to the shader with the glyph
char shaderName[ 32 ];
};

// Unlike with many other handle types, 0 is valid, not an error or default return value.
using fontHandle_t = int;

using glyphBlock_t = glyphInfo_t[256];

struct fontInfo_t
{
void *face, *faceData;
glyphInfo_t *glyphBlock[0x110000 / 256]; // glyphBlock_t
int pointSize;
int height;
float glyphScale;
char name[ MAX_QPATH ];
};

// real time
//=============================================

Expand Down
Loading